diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-22 19:28:45 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-22 19:28:45 +0100 |
commit | 33364fddabb25b2e419a672b80ee1f2bf3e82f68 (patch) | |
tree | 83180e2fc2f39a1ce5240569256cf960f2cfc3d6 | |
parent | ed630259277deb8a17d993574cec93397183c26d (diff) | |
download | ovm-33364fddabb25b2e419a672b80ee1f2bf3e82f68.tar.gz ovm-33364fddabb25b2e419a672b80ee1f2bf3e82f68.tar.bz2 ovm-33364fddabb25b2e419a672b80ee1f2bf3e82f68.zip |
Fix bug where accessing byte/hword registers > 8 wouldn't work
This is because we were checking them as if they were word registers.
-rw-r--r-- | src/runtime.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime.c b/src/runtime.c index 77ad109..67ea779 100644 --- a/src/runtime.c +++ b/src/runtime.c @@ -382,7 +382,7 @@ void vm_push_word_register(vm_t *vm, byte reg) data_t vm_mov_byte(vm_t *vm, byte reg) { - if (reg >= VM_REGISTERS) + if (reg >= (VM_REGISTERS * 8)) // TODO: Error (reg is not a valid byte register) return DBYTE(0); else if (vm->stack.ptr == 0) @@ -396,7 +396,7 @@ data_t vm_mov_byte(vm_t *vm, byte reg) data_t vm_mov_hword(vm_t *vm, byte reg) { - if (reg >= VM_REGISTERS) + if (reg >= (VM_REGISTERS * 2)) // TODO: Error (reg is not a valid hword register) return DHWORD(0); else if (vm->stack.ptr < sizeof(f64)) |