Compare commits

..

No commits in common. "0291279f1a8a2d7a649ec9d14a8d5b3756b62755" and "3e3f01db4e53ccbe29367da390374e52d343296a" have entirely different histories.

3 changed files with 7 additions and 9 deletions

View File

@ -3,8 +3,7 @@ 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. Install [SDL3](https://github.com/libsdl-org/SDL) and [SDL3_image](https://github.com/libsdl-org/SDL_image) from package manager or source. 2. ```sh
3. ```sh
cbuild build_exec_dbg cbuild build_exec_dbg
``` ```
@ -26,10 +25,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) |
|------|------|-------------| |------|------|-------------|
| 01 | ax | 32 | | 00 | ax | 32 |
| 02 | bx | 32 | | 01 | bx | 32 |
| 03 | cx | 32 | | 02 | cx | 32 |
| 04 | dx | 32 | | 03 | 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.

View File

@ -32,13 +32,12 @@ case "$OS" in
WINDOWS) WINDOWS)
EXEC_FILE="$PROJECT.exe" EXEC_FILE="$PROJECT.exe"
SHARED_LIB_FILE="$PROJECT.dll" SHARED_LIB_FILE="$PROJECT.dll"
LINKER_LIBS="-lSDL3_image -lSDL3" # example: "-I./"
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=""
;; ;;
*) *)

View File

@ -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->registers.a.u32v0; return vm->ax.i32v;
} }
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){