Arrays work now

This commit is contained in:
nilspolek 2024-01-23 22:05:23 +01:00
parent 797bfa45eb
commit 4f0fc8a364

10
njvm.c
View File

@ -43,7 +43,6 @@ void execute(struct program program) {
ObjRef tempObj2;
int tempInt;
for (i = 0; i < *program.size; ++i) {
printf("Program ist an der stelle %i\n", i);
if (debug == 1) debugMenu(fp, stack, &debug, i);
switch (program.program[i] >> 24) {
case HALT:
@ -274,12 +273,11 @@ void execute(struct program program) {
break;
case PUTFA:
if (debug == 1) printf("putfa");
tempObj = pop(stack).u.objRef;
tempObj2 = pop(stack).u.objRef;
bip.op1 = pop(stack).u.objRef;
bigPrint(stdout);
tempObj = pop(stack).u.objRef; // Value
tempObj2 = pop(stack).u.objRef; // Index
bip.op1 = tempObj2;
tempInt = bigToInt();
setField(tempObj2, tempInt,tempObj);
setField(pop(stack).u.objRef, tempInt,tempObj);
break;
case GETSZ:
if (debug == 1) printf("getsz");