95 lines
1.8 KiB
Tal
95 lines
1.8 KiB
Tal
( 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
|
|
|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 ) [
|
|
#014e .System/r DEO2
|
|
#07d1 .System/g DEO2
|
|
#0bf1 .System/b DEO2 ]
|
|
( resize )
|
|
#0200
|
|
DUP2 .Screen/width DEO2
|
|
.Screen/height DEO2
|
|
draw-memory
|
|
( test )
|
|
#f000 #0100
|
|
&l
|
|
STH2k MULk STH2r draw-byte
|
|
INC2 GTH2k ?&l
|
|
POP2 POP2
|
|
|
|
BRK
|
|
|
|
@draw-memory ( -- )
|
|
|
|
;src .File/name DEO2
|
|
#0001 .File/length 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
|
|
|
|
(
|
|
@|stdlib )
|
|
|
|
@draw-byte ( byte addr* -- )
|
|
|
|
addr-pos .Screen/y DEO2 .Screen/x DEO2
|
|
DUP #00 NEQ ?&no-null
|
|
.Screen/pixel DEO JMP2r
|
|
&no-null
|
|
DUP #20 GTH ?&no-low
|
|
POP #01 .Screen/pixel DEO JMP2r
|
|
&no-low
|
|
#80 GTH ?&no-ascii
|
|
#02 .Screen/pixel DEO JMP2r
|
|
&no-ascii
|
|
#03 .Screen/pixel DEO
|
|
|
|
JMP2r
|
|
|
|
@addr-pos ( addr* -- x* y* )
|
|
|
|
STH2k
|
|
( pixel x ) #000f AND2
|
|
( block x ) STH2kr #48 SFT2 ADD2 #00ff AND2
|
|
( pixel y ) STHk2r #04 SFT2 #000f AND2
|
|
( block y ) STH2kr #4c SFT2 ADD2
|
|
POP2r
|
|
|
|
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
|
|
|