( uxncli romviz.rom file.rom ) |00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 |10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |80 @Controller &vector $2 &button $1 &key $1 |90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1 |a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |0000 ( -> ) @src $40 |0100 ( -> ) ;await-src .Console/vector DEO2 BRK @await-src ( -> ) .Console/read DEI .src skey ?on-ready BRK @on-ready ( -> ) ( theme ) [ #f41e .System/r DEO2 #fa71 .System/g DEO2 #f4b1 .System/b DEO2 ] ( resize ) #0240 DUP2 .Screen/width DEO2 .Screen/height DEO2 draw-memory ;on-mouse .Mouse/vector DEO2 BRK @on-mouse ( -> ) [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;cursor-icn update-cursor .Mouse/state DEI ?&on-mouse-down BRK &on-mouse-down ( -> ) ( TODO: ) BRK ( @|drawing ) @draw-memory ( -- ) ;src .File/name DEO2 #0001 .File/length DEO2 ;pixel-icn .Screen/addr DEO2 LIT2r 0000 &stream ;&buf .File/read DEO2 .File/success DEI2 #0000 EQU2 ?&eof [ LIT &buf $1 ] STH2kr draw-byte INC2r !&stream &eof POP2r JMP2r @update-cursor ( color addr* -- ) [ LIT2 00 -Screen/auto ] DEO #40 draw-cursor .Mouse/x DEI2 ,draw-cursor/x STR2 .Mouse/y DEI2 ,draw-cursor/y STR2 .Screen/addr DEO2 @draw-cursor ( color -- ) [ LIT2 &x $2 ] .Screen/x DEO2 [ LIT2 &y $2 ] .Screen/y DEO2 .Screen/sprite DEO JMP2r ( @|stdlib ) @draw-byte ( byte addr* -- ) addr-pos .Screen/y DEO2 .Screen/x DEO2 DUP #00 NEQ ?&no-null .Screen/sprite DEO JMP2r &no-null DUP #20 GTH ?&no-low POP #05 .Screen/sprite DEO JMP2r &no-low #80 GTH ?&no-ascii #0a .Screen/sprite DEO JMP2r &no-ascii #0f .Screen/sprite DEO JMP2r @addr-pos ( addr* -- x* y* ) STH2k ( pixel x ) #000f AND2 ( block x ) STH2kr #48 SFT2 ADD2 #00ff AND2 #10 SFT2 #0020 ADD2 ( pixel y ) STHk2r #04 SFT2 #000f AND2 ( block y ) STH2r #4c SFT2 ADD2 #10 SFT2 #0020 ADD2 JMP2r @skey ( key buf -- proc ) OVR #21 LTH ?&eval #00 SWP sput #00 JMP2r &eval POP2 #01 JMP2r @scap ( str* -- end* ) LDAk #00 NEQ [ JMP JMP2r ] &w INC2 LDAk ?&w JMP2r @sput ( chr str* -- ) scap INC2k #00 ROT ROT STA STA JMP2r @pstr ( str* -- ) &w LDAk #18 DEO INC2 LDAk ?&w POP2 JMP2r @phex ( short* -- ) SWP phex/b &b DUP #04 SFT phex/c &c #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO JMP2r ( @|assets ) @pixel-icn [ c0c0 0000 0000 0000 ] @cursor-icn [ 80c0 e0f0 f8e0 1000 ]