(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
|
#ff ;draw-tail/last STA
|
||||||
( set screen mode auto-x )
|
( set screen mode auto-x )
|
||||||
#05 .Screen/auto DEO
|
#05 .Screen/auto DEO
|
||||||
,draw-polycat JSR
|
draw-polycat
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ BRK
|
||||||
;body .Screen/addr DEO2
|
;body .Screen/addr DEO2
|
||||||
#81 .Screen/sprite DEO
|
#81 .Screen/sprite DEO
|
||||||
( eye/tail )
|
( eye/tail )
|
||||||
#00 ,draw-eye JSR
|
#00 draw-eye
|
||||||
#00 ,draw-tail JSR
|
#00 draw-tail
|
||||||
|
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
|
@ -62,16 +62,16 @@ JMP2r
|
||||||
|
|
||||||
.Mouse/x DEI2 .cat/x LDZ2 GTH2 #50 SFT
|
.Mouse/x DEI2 .cat/x LDZ2 GTH2 #50 SFT
|
||||||
.Mouse/y DEI2 .cat/y LDZ2 GTH2 #60 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
|
.cat/timer LDZ INC [ DUP ] .cat/timer STZ
|
||||||
#04 SFT ,draw-tail JSR
|
#04 SFT draw-tail
|
||||||
,draw-cursor JSR
|
draw-cursor
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@draw-eye ( quad -- )
|
@draw-eye ( quad -- )
|
||||||
|
|
||||||
DUP ,&last LDR NEQ ,&changed JCN
|
DUP ,&last LDR NEQ ?&changed
|
||||||
POP JMP2r &changed
|
POP JMP2r &changed
|
||||||
( only redraw on change )
|
( only redraw on change )
|
||||||
DUP
|
DUP
|
||||||
|
@ -86,7 +86,7 @@ JMP2r
|
||||||
|
|
||||||
@draw-tail ( frame -- )
|
@draw-tail ( frame -- )
|
||||||
|
|
||||||
STHk ,&last LDR NEQ ,&changed JCN
|
STHk ,&last LDR NEQ ?&changed
|
||||||
POPr JMP2r &changed
|
POPr JMP2r &changed
|
||||||
( only redraw on change )
|
( only redraw on change )
|
||||||
STHr #00 OVR ;frames ADD2 LDA
|
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);
|
makereference(p.scope, w, p.ptr);
|
||||||
if(!writeshort(0xffff, 1)) return 0;
|
if(!writeshort(0xffff, 1)) return 0;
|
||||||
break;
|
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 */
|
case '"': /* raw string */
|
||||||
i = 0;
|
i = 0;
|
||||||
while((c = w[++i]))
|
while((c = w[++i]))
|
||||||
|
@ -355,8 +363,11 @@ parse(char *w, FILE *f)
|
||||||
if(!parse(m->items[i], f))
|
if(!parse(m->items[i], f))
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else {
|
||||||
return error("Unknown token", w);
|
makereference(p.scope, w - 1, p.ptr);
|
||||||
|
if(!writebyte(0x60) || !writeshort(0xffff, 0))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -405,15 +416,13 @@ resolve(void)
|
||||||
p.data[r->addr + 1] = l->addr & 0xff;
|
p.data[r->addr + 1] = l->addr & 0xff;
|
||||||
l->refs++;
|
l->refs++;
|
||||||
break;
|
break;
|
||||||
case ';':
|
default:
|
||||||
if(!(l = findlabel(r->name)))
|
if(!(l = findlabel(r->name)))
|
||||||
return error("Unknown absolute reference", r->name);
|
return error("Unknown absolute reference", r->name);
|
||||||
p.data[r->addr + 1] = l->addr >> 0x8;
|
p.data[r->addr + 1] = l->addr >> 0x8;
|
||||||
p.data[r->addr + 2] = l->addr & 0xff;
|
p.data[r->addr + 2] = l->addr & 0xff;
|
||||||
l->refs++;
|
l->refs++;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
return error("Unknown reference", r->name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue