uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit bae2d37fc20ff4c1143de4a800a1ebb87343928b
parent b7ea0b786884d04e6c06223b8534575c2a6b1e8a
Author: neauoire <aliceffekt@gmail.com>
Date:   Mon,  6 Dec 2021 09:01:48 -0800

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

Diffstat:
Mprojects/examples/gui/picture.tal | 30+++++++++++++++++++++++++++++-
Aprojects/pictures/dafu10x10.bit | 0
Dprojects/pictures/dafu80x80.bit | 0
Msrc/uxnasm.c | 2+-
4 files changed, 30 insertions(+), 2 deletions(-)

diff --git 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 Binary files differ. diff --git a/projects/pictures/dafu80x80.bit b/projects/pictures/dafu80x80.bit Binary files differ. diff --git a/src/uxnasm.c b/src/uxnasm.c @@ -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);