From bae2d37fc20ff4c1143de4a800a1ebb87343928b Mon Sep 17 00:00:00 2001 From: neauoire Date: Mon, 6 Dec 2021 09:01:48 -0800 Subject: [PATCH] (uxnasm) Only catch hex labels with slen of 2 or 4 --- projects/examples/gui/picture.tal | 30 +++++++++++++++++++++++++++++- projects/pictures/dafu10x10.bit | Bin 0 -> 2048 bytes projects/pictures/dafu80x80.bit | Bin 2048 -> 0 bytes src/uxnasm.c | 2 +- 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 projects/pictures/dafu10x10.bit delete mode 100644 projects/pictures/dafu80x80.bit diff --git a/projects/examples/gui/picture.tal b/projects/examples/gui/picture.tal index 1424a25..0ce89df 100644 --- a/projects/examples/gui/picture.tal +++ b/projects/examples/gui/picture.tal @@ -53,7 +53,7 @@ BRK -@draw-icn ( x* y* width* height* addr* color -- ) +@draw-icn ( 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 @@ -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 diff --git a/projects/pictures/dafu10x10.bit b/projects/pictures/dafu10x10.bit new file mode 100644 index 0000000000000000000000000000000000000000..e88d7a16843e3d0e65766c25ca9a4c4cd4ca722a GIT binary patch literal 2048 zcmb_dUuYaf7@yg_%N}WyZH`1G)$X-LiK4wi!Rm{(e}QV6p&2FsZ`A>U%c#LhF^r)| z=LqL<5larnRSW~jA_w+M9FOY)Hm!QaVC#h@MQkfA3G^w{NDyTT%&va~|*@=ym_-TGusA?XHidh}JOq zH%>YXRzG1e!B`^UT7wcD#49UajJv?0RK7-o4{+WZdS0E!C{ z2;y2xIse8vqJPPX=AtsX%%p4@>Ri`mcBgqw`FTi$w+-O$SAa5!3EPt zA6+O-&)=0h_3rtd`TVvE1nALIgw%FCJT_MupF2~-Nw!T2sy6V*h*B1C?2Xf9Lgqar z5pKpVROTxcsc!~qI(h7AJ2yVIHIpC8(|d*=xIa(G9e*6yb>5mA|LNm_gE%WkYI}ap zZja{M@6&bT&i(t2)b76O%gRWI z^?ug%xm;@>?`F65itHmYiBPu^njL=etZv>n@mi;K?Q%Vgk~({QmN^bMvfj_To*z&I zrntafn>lgwHQK!{vm*0~msng0@AI2qh z@j*3^@$I$jK}j&i!YG;~IJOYJBL0ezfa z@sMA$F@ooxdi{%cUV8Qk5H_V#$T|kY7USh2!oz}rJO#Lrdy_l@yFu{52@Q`KlSzV^ z)sxL;vn|o6Hyd@RH_Zsa_|I1n+9jqfdgf8rzENc-X+*nefM literal 0 HcmV?d00001 diff --git a/projects/pictures/dafu80x80.bit b/projects/pictures/dafu80x80.bit deleted file mode 100644 index 6a17a89242ed8041cc3407f75de3c88db327201e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2048 zcmb_dUuYaf82@HxdwV1YduVC;P_n1^5E0EiC{_@5A1d`l0%HGIk-NV6QqzaZ390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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);