Browse code

Flag unused macros properly

neauoire authored on 15/03/2021 00:41:52
Showing 2 changed files
... ...
@@ -343,6 +343,7 @@ parsetoken(char *w)
343 343
 		return 1;
344 344
 	} else if((m = findmacro(w))) {
345 345
 		int i;
346
+		m->refs++;
346 347
 		for(i = 0; i < m->len; ++i)
347 348
 			if(!parsetoken(m->items[i]))
348 349
 				return 0;
... ...
@@ -3,6 +3,7 @@
3 3
 %INCR2 { #0001 ADD2 }
4 4
 %DECR2 { #0001 SUB2 }
5 5
 %HALF2 { #0002 DIV2 }
6
+%JMC2  { ROT JMP2? POP2 }
6 7
 
7 8
 ;slime { color 1 }
8 9
 
... ...
@@ -26,21 +27,21 @@ BRK
26 27
 	( hold ctrl key to change slime color )
27 28
 
28 29
 	~Controller.buttons #0f AND
29
-		DUP #01 NEQ ,$no-ctrl ROT JMP2? POP2 #05 =slime $no-ctrl
30
-		DUP #02 NEQ ,$no-alt ROT JMP2? POP2 #0f =slime $no-alt
30
+		DUP #01 NEQ ,$no-ctrl JMC2 #05 =slime $no-ctrl
31
+		DUP #02 NEQ ,$no-alt JMC2 #0f =slime $no-alt
31 32
 	POP
32 33
 
33 34
 	( clear ) #10 =Sprite.color
34 35
 
35 36
 	( detect movement )
36 37
 	~Controller.buttons #f0 AND
37
-		DUP #04 ROR #01 AND #01 NEQ ,$no-up ROT JMP2? POP2 
38
+		DUP #04 ROR #01 AND #01 NEQ ,$no-up JMC2 
38 39
 			( move ) ~Sprite.y DECR2 =Sprite.y ,up_icn =Sprite.addr $no-up
39
-		DUP #05 ROR #01 AND #01 NEQ ,$no-down ROT JMP2? POP2 
40
+		DUP #05 ROR #01 AND #01 NEQ ,$no-down JMC2 
40 41
 			( move ) ~Sprite.y INCR2 =Sprite.y ,down_icn =Sprite.addr $no-down
41
-		DUP #06 ROR #01 AND #01 NEQ ,$no-left ROT JMP2? POP2 
42
+		DUP #06 ROR #01 AND #01 NEQ ,$no-left JMC2 
42 43
 			( move ) ~Sprite.x DECR2 =Sprite.x ,left_icn =Sprite.addr $no-left
43
-		DUP #07 ROR #01 AND #01 NEQ ,$no-right ROT JMP2? POP2 
44
+		DUP #07 ROR #01 AND #01 NEQ ,$no-right JMC2 
44 45
 			( move ) ~Sprite.x INCR2 =Sprite.x ,right_icn =Sprite.addr $no-right
45 46
 	POP
46 47
 
... ...
@@ -62,7 +63,6 @@ BRK
62 63
 
63 64
 |d000 @ERROR BRK 
64 65
 
65
-|FF00 ;Console { pad 8 char 1 byte 1 short 2 }
66 66
 |FF10 ;Screen { width 2 height 2 pad 4 y 2 x 2 color 1 }
67 67
 |FF20 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
68 68
 |FF30 ;Controller { buttons 1 }