Browse code

(uxnasm) Only catch hex labels with slen of 2 or 4

neauoire authored on 06/12/2021 17:01:48
Showing 4 changed files
... ...
@@ -53,7 +53,7 @@
53 53
 
54 54
 BRK
55 55
 
56
-@draw-icn ( x* y* width* height* addr* color  -- )
56
+@draw-icn ( x* y* width* height* addr* color -- )
57 57
 	
58 58
 	( load ) STH .Screen/addr DEO2 .size/height STZ2 .size/width STZ2 .position/y STZ2 .position/x STZ2
59 59
 	.size/height LDZ2 #0000 
... ...
@@ -72,6 +72,34 @@ BRK
72 72
 
73 73
 RTN
74 74
 
75
+@draw-icn-pixels ( x* y* width* height* addr* color -- )
76
+
77
+	( load ) STH .Screen/addr DEO2 .size/height STZ2 .size/width STZ2 .position/y STZ2 .position/x STZ2
78
+	.size/height LDZ2 #0000
79
+	&ver
80
+		( save ) DUP2 .position/y LDZ2 ++ .Screen/y DEO2
81
+		.size/width LDZ2 #0000
82
+		&hor
83
+			( get x,y ) STH2 OVR2 STH2r SWP2 OVR2 SWP2 
84
+			( save ) OVR2 .position/x LDZ2 ++ .Screen/x DEO2
85
+			( draw ) ,get-icn-pixel JSR STHkr * .Screen/pixel DEO
86
+			INC2 GTH2k ,&hor JCN
87
+		POP2 POP2
88
+		INC2 GTH2k ,&ver JCN
89
+	POP2 POP2
90
+	POPr
91
+
92
+RTN
93
+
94
+@get-icn-pixel ( x* y* -- color )
95
+
96
+	( get row ) OVR2 SWP2 DUP2 8MOD2
97
+	( get tile ) SWP2 8// 80** ++ SWP2 STEP8 ++ ;source ++ LDA
98
+	( get mask ) ROT ROT NIP 8MOD 
99
+	( get pixel ) #07 SWP - SFT #01 AND
100
+
101
+RTN
102
+
75 103
 @draw-chr ( x* y* width* height* addr* color -- )
76 104
 	
77 105
 	( load ) STH .Screen/addr DEO2 .size/height STZ2 .size/width STZ2 .position/y STZ2 .position/x STZ2
78 106
new file mode 100644
79 107
Binary files /dev/null and b/projects/pictures/dafu10x10.bit differ
80 108
deleted file mode 100644
81 109
Binary files a/projects/pictures/dafu80x80.bit and /dev/null differ
... ...
@@ -156,7 +156,7 @@ makelabel(char *name)
156 156
 	Label *l;
157 157
 	if(findlabel(name))
158 158
 		return error("Label duplicate", name);
159
-	if(sihx(name) && slen(name) % 2 == 0)
159
+	if(sihx(name) && (slen(name) == 2 || slen(name) == 4))
160 160
 		return error("Label name is hex number", name);
161 161
 	if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name))
162 162
 		return error("Label name is invalid", name);