(uxnasm)Added support for JMI, JCI and JSI
This commit is contained in:
parent
b762c1420a
commit
66de46b352
|
@ -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
|
||||
|
|
19
src/uxnasm.c
19
src/uxnasm.c
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue