From c92b2009a3cccacbaa49d180c25d3cf8f1e70e07 Mon Sep 17 00:00:00 2001 From: neauoire Date: Sun, 14 Mar 2021 17:41:52 -0700 Subject: [PATCH] Flag unused macros properly --- assembler.c | 1 + projects/examples/dev.controller.usm | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/assembler.c b/assembler.c index 78b0569..d601b5b 100644 --- a/assembler.c +++ b/assembler.c @@ -343,6 +343,7 @@ parsetoken(char *w) return 1; } else if((m = findmacro(w))) { int i; + m->refs++; for(i = 0; i < m->len; ++i) if(!parsetoken(m->items[i])) return 0; diff --git a/projects/examples/dev.controller.usm b/projects/examples/dev.controller.usm index 43f045e..3158d01 100644 --- a/projects/examples/dev.controller.usm +++ b/projects/examples/dev.controller.usm @@ -3,6 +3,7 @@ %INCR2 { #0001 ADD2 } %DECR2 { #0001 SUB2 } %HALF2 { #0002 DIV2 } +%JMC2 { ROT JMP2? POP2 } ;slime { color 1 } @@ -26,21 +27,21 @@ BRK ( hold ctrl key to change slime color ) ~Controller.buttons #0f AND - DUP #01 NEQ ,$no-ctrl ROT JMP2? POP2 #05 =slime $no-ctrl - DUP #02 NEQ ,$no-alt ROT JMP2? POP2 #0f =slime $no-alt + DUP #01 NEQ ,$no-ctrl JMC2 #05 =slime $no-ctrl + DUP #02 NEQ ,$no-alt JMC2 #0f =slime $no-alt POP ( clear ) #10 =Sprite.color ( detect movement ) ~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 - 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 - 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 - 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 POP @@ -62,7 +63,6 @@ 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 } |FF20 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } |FF30 ;Controller { buttons 1 }