mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
WIP: Fixed print bug, tests incomplete, read more
I was sidetracked by a strange display bug - turns out it was caused by pointers - this commit fixes it. The tests for if-then-else still aren't finished, but I'm knocking off as it's past my time limit. I've marked 'TODO' and 'URGENT' using comments, so finding the issues should be easy.
This commit is contained in:
@@ -68,7 +68,7 @@ static void processRead(Toy_VM* vm) {
|
||||
int len = (int)READ_BYTE(vm);
|
||||
|
||||
//grab the jump as an integer
|
||||
unsigned int jump = vm->module[ vm->jumpsAddr + READ_INT(vm) ];
|
||||
unsigned int jump = *((int*)(vm->module + vm->jumpsAddr + READ_INT(vm)));
|
||||
|
||||
//jumps are relative to the data address
|
||||
char* cstring = (char*)(vm->module + vm->dataAddr + jump);
|
||||
@@ -282,7 +282,7 @@ static void processArithmetic(Toy_VM* vm, Toy_OpcodeType opcode) {
|
||||
}
|
||||
|
||||
static void processComparison(Toy_VM* vm, Toy_OpcodeType opcode) {
|
||||
Toy_Value right = Toy_popStack(&vm->stack);
|
||||
Toy_Value right = Toy_popStack(&vm->stack); //URGENT: These are not freed correctly
|
||||
Toy_Value left = Toy_popStack(&vm->stack);
|
||||
|
||||
//most things can be equal, so handle it separately
|
||||
|
||||
Reference in New Issue
Block a user