-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
This guide will help you get MVM (Micro Virtual Machine) set up and running, so you can start executing assembly code.
- Java Development Kit (JDK): MVM is written in Kotlin, which requires a JDK. Make sure you have JDK 17 or later installed. You can download it from https://www.oracle.com/java/technologies/downloads/.
-
Clone the Repository:
git clone --depth 1 https://github.com/ChippyPlus/MVM.git
-
Navigate to the Project Directory:
cd MVM
-
Build with Gradle:
MVM uses Gradle as its build system. To build the VM, run the following command:
This will create a self-contained executable JAR file in the
./gradlew build
build/libs/
directory.
You can run your MVM assembly code (.kar
files) using the following methods:
Method 1: Using Gradle (Recommended for Development)
-
Execute with Gradle:
Replace
./gradlew r --args="run <path_to_assembly_file.kar>"
<path_to_assembly_file.kar>
with the actual path to your assembly file. For example:./gradlew r --args="run src/main/resources/main.kar"
Method 2: Using the Executable JAR
-
Locate the JAR: After building the project, find the JAR file (
MVM-1.0-SNAPSHOT.jar
or similar) in thebuild/libs/
directory. -
Run with Java:
java -jar build/libs/MVM-1.0-SNAPSHOT.jar run <path_to_assembly_file.kar>
Method 3: Using an alias
-
Create an alias for method 2
alias mvm="java -jar build/libs/MVM-1.0-SNAPSHOT.jar"
-
Run with the alias
mvm run <path_to_assembly_file.kar>
Here is a simple example of an MVM assembly program (myprogram.kar
):
// Example program to print the number 10
LIT G1 10 // Load the value 10 into register G1
PUSH G1 // Push G1 onto the stack
PRINTS // Print what's on the stack
To run this program, you would use one of the following commands:
-
Using Gradle:
./gradlew r --args="run myprogram.kar"
-
Using the JAR:
java -jar build/libs/MVM-1.0-SNAPSHOT.jar run myprogram.kar
-
Using the alias
mvm run myprogram.kar
This will execute the assembly code, and the output will be printed to the console.
Now that you have MVM set up and running, you can start writing and executing your own assembly programs! Refer to the Instruction Table for a detailed list of instructions and their syntax.
Built with ❤️ & Kotlin
Getting Started
Assembly Language
Standard Library
- Standard Library Overview
- String Functions
- Array Functions
- Maths Functions
- Clean Functions
- I/O Functions
- System Functions
- Conversion Functions
System Calls
- System Call Overview
- File System Calls
- Process Management Calls
- IPC Calls
- Host OS Calls
- Other System Calls
Kernel + OS
Error Handling
Advanced Topics
Appendix
Project Information