mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-10 21:30:04 +00:00
Update test cases and portable VM
This commit is contained in:
parent
6bbc5b6381
commit
8730e2ff9a
@ -85,7 +85,7 @@ def vals123#3
|
||||
return 1, 2, 3
|
||||
end
|
||||
export def main(range)#0
|
||||
byte a, b, c
|
||||
word a, b, c
|
||||
word lambda
|
||||
|
||||
a = 10
|
||||
@ -127,10 +127,14 @@ export def main(range)#0
|
||||
drop, b, drop = vals123
|
||||
drop, drop, c = vals123
|
||||
puts("a, b, c = "); puti(a); puts(", "); puti(b); puts(", "); puti(c); putln
|
||||
puts(" 8 % 3 = "); puti(8%3); putln
|
||||
puts(" 8 % -3 = "); puti(8%-3); putln
|
||||
puts("-8 % 3 = "); puti(-8%3); putln
|
||||
puts("-8 % -3 = "); puti(-8%-3); putln
|
||||
puts(" 7 / 3 = "); puti(7/3); puts(" ; 7 % 3 = "); puti(7%3); putln
|
||||
puts(" 7 / -3 = "); puti(7/-3); puts("; 7 % -3 = "); puti(7%-3); putln
|
||||
puts("-7 / 3 = "); puti(-7/3); puts("; -7 % 3 = "); puti(-7%3); putln
|
||||
puts("-7 / -3 = "); puti(-7/-3); puts(" ; -7 % -3 = "); puti(-7%-3); putln
|
||||
a,b=divmod(7,3); puts("divmod( 7, 3) = "); puti(a); puts(", "); puti(b); putln
|
||||
a,b=divmod(7,-3); puts("divmod( 7,-3) = "); puti(a); puts(", "); puti(b); putln
|
||||
a,b=divmod(-7,3); puts("divmod(-7, 3) = "); puti(a); puts(", "); puti(b); putln
|
||||
a,b=divmod(-7,-3);puts("divmod(-7,-3) = "); puti(a); puts(", "); puti(b); putln
|
||||
end
|
||||
|
||||
def dummy(zz)#2
|
||||
|
@ -544,12 +544,12 @@ _DIV STY IPY
|
||||
LDY #$11 ; #BITS+1
|
||||
LDX #$00
|
||||
LDA NOS+2,S ; WE JSR'ED HERE SO OFFSET ACCORDINGLY
|
||||
BEQ _DIVEX
|
||||
BPL +
|
||||
LDX #$81
|
||||
EOR #$FFFF
|
||||
INC
|
||||
+ STA TMP ; NOS,S
|
||||
BEQ _DIVEX
|
||||
LDA TOS+2,S
|
||||
BPL +
|
||||
INX
|
||||
|
@ -455,6 +455,7 @@ void interp(code *ip);
|
||||
void call(uword pc)
|
||||
{
|
||||
unsigned int i, s;
|
||||
int a, b;
|
||||
char c, sz[64];
|
||||
|
||||
if (show_state)
|
||||
@ -508,6 +509,12 @@ void call(uword pc)
|
||||
mem_data[0x1FF] = i;
|
||||
PUSH(0x1FF);
|
||||
break;
|
||||
case 24: // LIBRARY CMDSYS::DIVMOD
|
||||
a = POP;
|
||||
b = POP;
|
||||
PUSH(b / a);
|
||||
PUSH(b % a);
|
||||
break;
|
||||
default:
|
||||
printf("\nUnimplemented call code:$%02X\n", mem_data[pc - 1]);
|
||||
exit(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user