0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-27 08:13:01 +00:00

Flag unused macros properly

This commit is contained in:
neauoire 2021-03-14 17:41:52 -07:00
parent c549a6c710
commit c92b2009a3
2 changed files with 8 additions and 7 deletions

View file

@ -343,6 +343,7 @@ parsetoken(char *w)
return 1; return 1;
} else if((m = findmacro(w))) { } else if((m = findmacro(w))) {
int i; int i;
m->refs++;
for(i = 0; i < m->len; ++i) for(i = 0; i < m->len; ++i)
if(!parsetoken(m->items[i])) if(!parsetoken(m->items[i]))
return 0; return 0;

View file

@ -3,6 +3,7 @@
%INCR2 { #0001 ADD2 } %INCR2 { #0001 ADD2 }
%DECR2 { #0001 SUB2 } %DECR2 { #0001 SUB2 }
%HALF2 { #0002 DIV2 } %HALF2 { #0002 DIV2 }
%JMC2 { ROT JMP2? POP2 }
;slime { color 1 } ;slime { color 1 }
@ -26,21 +27,21 @@ BRK
( hold ctrl key to change slime color ) ( hold ctrl key to change slime color )
~Controller.buttons #0f AND ~Controller.buttons #0f AND
DUP #01 NEQ ,$no-ctrl ROT JMP2? POP2 #05 =slime $no-ctrl DUP #01 NEQ ,$no-ctrl JMC2 #05 =slime $no-ctrl
DUP #02 NEQ ,$no-alt ROT JMP2? POP2 #0f =slime $no-alt DUP #02 NEQ ,$no-alt JMC2 #0f =slime $no-alt
POP POP
( clear ) #10 =Sprite.color ( clear ) #10 =Sprite.color
( detect movement ) ( detect movement )
~Controller.buttons #f0 AND ~Controller.buttons #f0 AND
DUP #04 ROR #01 AND #01 NEQ ,$no-up ROT JMP2? POP2 DUP #04 ROR #01 AND #01 NEQ ,$no-up JMC2
( move ) ~Sprite.y DECR2 =Sprite.y ,up_icn =Sprite.addr $no-up ( move ) ~Sprite.y DECR2 =Sprite.y ,up_icn =Sprite.addr $no-up
DUP #05 ROR #01 AND #01 NEQ ,$no-down ROT JMP2? POP2 DUP #05 ROR #01 AND #01 NEQ ,$no-down JMC2
( move ) ~Sprite.y INCR2 =Sprite.y ,down_icn =Sprite.addr $no-down ( move ) ~Sprite.y INCR2 =Sprite.y ,down_icn =Sprite.addr $no-down
DUP #06 ROR #01 AND #01 NEQ ,$no-left ROT JMP2? POP2 DUP #06 ROR #01 AND #01 NEQ ,$no-left JMC2
( move ) ~Sprite.x DECR2 =Sprite.x ,left_icn =Sprite.addr $no-left ( move ) ~Sprite.x DECR2 =Sprite.x ,left_icn =Sprite.addr $no-left
DUP #07 ROR #01 AND #01 NEQ ,$no-right ROT JMP2? POP2 DUP #07 ROR #01 AND #01 NEQ ,$no-right JMC2
( move ) ~Sprite.x INCR2 =Sprite.x ,right_icn =Sprite.addr $no-right ( move ) ~Sprite.x INCR2 =Sprite.x ,right_icn =Sprite.addr $no-right
POP POP
@ -62,7 +63,6 @@ BRK
|d000 @ERROR BRK |d000 @ERROR BRK
|FF00 ;Console { pad 8 char 1 byte 1 short 2 }
|FF10 ;Screen { width 2 height 2 pad 4 y 2 x 2 color 1 } |FF10 ;Screen { width 2 height 2 pad 4 y 2 x 2 color 1 }
|FF20 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } |FF20 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|FF30 ;Controller { buttons 1 } |FF30 ;Controller { buttons 1 }