1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-07 15:31:49 +00:00

Add CFFB to portable VM with test case

This commit is contained in:
dschmenk 2017-07-27 19:15:57 -07:00
parent 0ffaef968d
commit c4912583de
3 changed files with 8 additions and 5 deletions

View File

@ -143,5 +143,6 @@ putln
puti(mystruc)
putln
puts(@constr); puti(constval); putln
puts("Signed byte constant:"); puti(-3); putln
puts("Hello from in-line string!\$7F\n")
done

View File

@ -540,12 +540,12 @@ void emit_codetag(int tag)
}
void emit_const(int cval)
{
if (cval == 0)
if (cval == 0x0000)
printf("\t%s\t$00\t\t\t; ZERO\n", DB);
else if (cval > 0 && cval < 256)
else if ((cval & 0xFF00) == 0x0000)
printf("\t%s\t$2A,$%02X\t\t\t; CB\t%d\n", DB, cval, cval);
else if ((cval&0xFF00) >= 0xFF00)
printf("\t%s\t$5E,$%02X\t\t\t; CFFB\t%d\n", DB, cval&0xFF, cval&0xFF);
else if ((cval & 0xFF00) == 0xFF00)
printf("\t%s\t$5E,$%02X\t\t\t; CFFB\t%d\n", DB, cval&0xFF, cval);
else
printf("\t%s\t$2C,$%02X,$%02X\t\t; CW\t%d\n", DB, cval&0xFF,(cval>>8)&0xFF, cval);
}

View File

@ -776,7 +776,9 @@ void interp(code *ip)
fp += PLA;
case 0x5C: // RET : IP = TOFP
return;
case 0x5E: // ???
case 0x5E: // CFFB : TOS = CONSTANTBYTE(IP) | 0xFF00
PUSH(BYTE_PTR(ip) | 0xFF00);
ip++;
break;
/*
* 0x60-0x6F