Compare commits
2 Commits
3e3f01db4e
...
0291279f1a
| Author | SHA1 | Date | |
|---|---|---|---|
| 0291279f1a | |||
| c2bd5922ff |
11
README.md
11
README.md
@ -3,7 +3,8 @@ Machine code interpreter written in pure C. Can execute programs up to 1 MEGABYT
|
|||||||
|
|
||||||
## Building
|
## Building
|
||||||
1. Install [cbuild](https://timerix.ddns.net:3322/Timerix/cbuild.git)
|
1. Install [cbuild](https://timerix.ddns.net:3322/Timerix/cbuild.git)
|
||||||
2. ```sh
|
2. Install [SDL3](https://github.com/libsdl-org/SDL) and [SDL3_image](https://github.com/libsdl-org/SDL_image) from package manager or source.
|
||||||
|
3. ```sh
|
||||||
cbuild build_exec_dbg
|
cbuild build_exec_dbg
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -25,10 +26,10 @@ Machine code interpreter written in pure C. Can execute programs up to 1 MEGABYT
|
|||||||
### Registers
|
### Registers
|
||||||
| code | name | size (bits) |
|
| code | name | size (bits) |
|
||||||
|------|------|-------------|
|
|------|------|-------------|
|
||||||
| 00 | ax | 32 |
|
| 01 | ax | 32 |
|
||||||
| 01 | bx | 32 |
|
| 02 | bx | 32 |
|
||||||
| 02 | cx | 32 |
|
| 03 | cx | 32 |
|
||||||
| 03 | dx | 32 |
|
| 04 | dx | 32 |
|
||||||
|
|
||||||
### System functions
|
### System functions
|
||||||
To call a system function you need to push values to registers and write `SYS` opcode. The return value of a function will will be avaliable in `ax` after call.
|
To call a system function you need to push values to registers and write `SYS` opcode. The return value of a function will will be avaliable in `ax` after call.
|
||||||
|
|||||||
@ -32,12 +32,13 @@ case "$OS" in
|
|||||||
WINDOWS)
|
WINDOWS)
|
||||||
EXEC_FILE="$PROJECT.exe"
|
EXEC_FILE="$PROJECT.exe"
|
||||||
SHARED_LIB_FILE="$PROJECT.dll"
|
SHARED_LIB_FILE="$PROJECT.dll"
|
||||||
# example: "-I./"
|
LINKER_LIBS="-lSDL3_image -lSDL3"
|
||||||
INCLUDE=""
|
INCLUDE=""
|
||||||
;;
|
;;
|
||||||
LINUX)
|
LINUX)
|
||||||
EXEC_FILE="$PROJECT"
|
EXEC_FILE="$PROJECT"
|
||||||
SHARED_LIB_FILE="$PROJECT.so"
|
SHARED_LIB_FILE="$PROJECT.so"
|
||||||
|
LINKER_LIBS="-lSDL3_image -lSDL3"
|
||||||
INCLUDE=""
|
INCLUDE=""
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@ -72,7 +72,7 @@ i32 VM_boot(VM* vm){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// exit code of the program should be in ax register
|
// exit code of the program should be in ax register
|
||||||
return vm->ax.i32v;
|
return vm->registers.a.u32v0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VM_dataRead(VM* vm, void* dst, size_t pos, size_t size){
|
bool VM_dataRead(VM* vm, void* dst, size_t pos, size_t size){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user