Compare commits
No commits in common. "0291279f1a8a2d7a649ec9d14a8d5b3756b62755" and "3e3f01db4e53ccbe29367da390374e52d343296a" have entirely different histories.
0291279f1a
...
3e3f01db4e
11
README.md
11
README.md
@ -3,8 +3,7 @@ Machine code interpreter written in pure C. Can execute programs up to 1 MEGABYT
|
||||
|
||||
## Building
|
||||
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.
|
||||
3. ```sh
|
||||
2. ```sh
|
||||
cbuild build_exec_dbg
|
||||
```
|
||||
|
||||
@ -26,10 +25,10 @@ Machine code interpreter written in pure C. Can execute programs up to 1 MEGABYT
|
||||
### Registers
|
||||
| code | name | size (bits) |
|
||||
|------|------|-------------|
|
||||
| 01 | ax | 32 |
|
||||
| 02 | bx | 32 |
|
||||
| 03 | cx | 32 |
|
||||
| 04 | dx | 32 |
|
||||
| 00 | ax | 32 |
|
||||
| 01 | bx | 32 |
|
||||
| 02 | cx | 32 |
|
||||
| 03 | dx | 32 |
|
||||
|
||||
### 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.
|
||||
|
||||
@ -32,13 +32,12 @@ case "$OS" in
|
||||
WINDOWS)
|
||||
EXEC_FILE="$PROJECT.exe"
|
||||
SHARED_LIB_FILE="$PROJECT.dll"
|
||||
LINKER_LIBS="-lSDL3_image -lSDL3"
|
||||
# example: "-I./"
|
||||
INCLUDE=""
|
||||
;;
|
||||
LINUX)
|
||||
EXEC_FILE="$PROJECT"
|
||||
SHARED_LIB_FILE="$PROJECT.so"
|
||||
LINKER_LIBS="-lSDL3_image -lSDL3"
|
||||
INCLUDE=""
|
||||
;;
|
||||
*)
|
||||
|
||||
@ -72,7 +72,7 @@ i32 VM_boot(VM* vm){
|
||||
}
|
||||
|
||||
// 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){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user