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

This commit is contained in:
neauoire 2021-12-06 09:01:48 -08:00
parent b7ea0b7868
commit bae2d37fc2
4 changed files with 30 additions and 2 deletions

View File

@ -72,6 +72,34 @@ BRK
RTN
@draw-icn-pixels ( x* y* width* height* addr* color -- )
( load ) STH .Screen/addr DEO2 .size/height STZ2 .size/width STZ2 .position/y STZ2 .position/x STZ2
.size/height LDZ2 #0000
&ver
( save ) DUP2 .position/y LDZ2 ++ .Screen/y DEO2
.size/width LDZ2 #0000
&hor
( get x,y ) STH2 OVR2 STH2r SWP2 OVR2 SWP2
( save ) OVR2 .position/x LDZ2 ++ .Screen/x DEO2
( draw ) ,get-icn-pixel JSR STHkr * .Screen/pixel DEO
INC2 GTH2k ,&hor JCN
POP2 POP2
INC2 GTH2k ,&ver JCN
POP2 POP2
POPr
RTN
@get-icn-pixel ( x* y* -- color )
( get row ) OVR2 SWP2 DUP2 8MOD2
( get tile ) SWP2 8// 80** ++ SWP2 STEP8 ++ ;source ++ LDA
( get mask ) ROT ROT NIP 8MOD
( get pixel ) #07 SWP - SFT #01 AND
RTN
@draw-chr ( x* y* width* height* addr* color -- )
( load ) STH .Screen/addr DEO2 .size/height STZ2 .size/width STZ2 .position/y STZ2 .position/x STZ2

Binary file not shown.

Binary file not shown.

View File

@ -156,7 +156,7 @@ makelabel(char *name)
Label *l;
if(findlabel(name))
return error("Label duplicate", name);
if(sihx(name) && slen(name) % 2 == 0)
if(sihx(name) && (slen(name) == 2 || slen(name) == 4))
return error("Label name is hex number", name);
if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name))
return error("Label name is invalid", name);