(uxnasm)Added support for JMI, JCI and JSI

This commit is contained in:
Devine Lu Linvega 2023-01-02 14:15:54 -08:00
parent b762c1420a
commit 66de46b352
4 changed files with 24 additions and 15 deletions

View File

@ -36,7 +36,7 @@
#ff ;draw-tail/last STA
( set screen mode auto-x )
#05 .Screen/auto DEO
,draw-polycat JSR
draw-polycat
BRK
@ -53,8 +53,8 @@ BRK
;body .Screen/addr DEO2
#81 .Screen/sprite DEO
( eye/tail )
#00 ,draw-eye JSR
#00 ,draw-tail JSR
#00 draw-eye
#00 draw-tail
JMP2r
@ -62,16 +62,16 @@ JMP2r
.Mouse/x DEI2 .cat/x LDZ2 GTH2 #50 SFT
.Mouse/y DEI2 .cat/y LDZ2 GTH2 #60 SFT
ADD ,draw-eye JSR
ADD draw-eye
.cat/timer LDZ INC [ DUP ] .cat/timer STZ
#04 SFT ,draw-tail JSR
,draw-cursor JSR
#04 SFT draw-tail
draw-cursor
BRK
@draw-eye ( quad -- )
DUP ,&last LDR NEQ ,&changed JCN
DUP ,&last LDR NEQ ?&changed
POP JMP2r &changed
( only redraw on change )
DUP
@ -86,7 +86,7 @@ JMP2r
@draw-tail ( frame -- )
STHk ,&last LDR NEQ ,&changed JCN
STHk ,&last LDR NEQ ?&changed
POPr JMP2r &changed
( only redraw on change )
STHr #00 OVR ;frames ADD2 LDA

View File

@ -57,7 +57,7 @@ static void
console_deo(Uint8 *d, Uint8 port)
{
FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr :
0;
0;
if(fd) {
fputc(d[port], fd);
fflush(fd);

View File

@ -328,6 +328,14 @@ parse(char *w, FILE *f)
makereference(p.scope, w, p.ptr);
if(!writeshort(0xffff, 1)) return 0;
break;
case '!': /* JMI */
makereference(p.scope, w, p.ptr);
if(!writebyte(0x20) || !writeshort(0xffff, 0)) return 0;
break;
case '?': /* JCI */
makereference(p.scope, w, p.ptr);
if(!writebyte(0x40) || !writeshort(0xffff, 0)) return 0;
break;
case '"': /* raw string */
i = 0;
while((c = w[++i]))
@ -355,8 +363,11 @@ parse(char *w, FILE *f)
if(!parse(m->items[i], f))
return 0;
return 1;
} else
return error("Unknown token", w);
} else {
makereference(p.scope, w - 1, p.ptr);
if(!writebyte(0x60) || !writeshort(0xffff, 0))
return 0;
}
}
return 1;
}
@ -405,15 +416,13 @@ resolve(void)
p.data[r->addr + 1] = l->addr & 0xff;
l->refs++;
break;
case ';':
default:
if(!(l = findlabel(r->name)))
return error("Unknown absolute reference", r->name);
p.data[r->addr + 1] = l->addr >> 0x8;
p.data[r->addr + 2] = l->addr & 0xff;
l->refs++;
break;
default:
return error("Unknown reference", r->name);
}
}
return 1;

View File

@ -38,7 +38,7 @@ static void
console_deo(Uint8 *d, Uint8 port)
{
FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr :
0;
0;
if(fd) {
fputc(d[port], fd);
fflush(fd);