2024-02-10 15:16:58 -05:00
|
|
|
( uxnemu shaviankb.rom | listener )
|
|
|
|
|
|
|
|
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|
|
|
|
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &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
|
2024-02-10 23:00:10 -05:00
|
|
|
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1 &pad $4 &scrolly &scrolly-hb $1 &scrolly-lb $1
|
2024-02-10 15:16:58 -05:00
|
|
|
|
2024-02-10 23:56:26 -05:00
|
|
|
|0000
|
|
|
|
|
|
|
|
@hover $2
|
|
|
|
|
2024-02-10 15:16:58 -05:00
|
|
|
|0100
|
|
|
|
|
|
|
|
@on-reset ( -> )
|
2024-02-10 22:56:20 -05:00
|
|
|
#9c0f .System/r DEO2
|
|
|
|
#7c0f .System/g DEO2
|
|
|
|
#de0f .System/b DEO2
|
2024-02-10 23:37:27 -05:00
|
|
|
#0130 .Screen/width DEO2
|
|
|
|
#00d0 .Screen/height DEO2
|
2024-02-10 23:00:10 -05:00
|
|
|
;on-mouse .Mouse/vector DEO2
|
2024-02-10 15:16:58 -05:00
|
|
|
<draw-keyboard>
|
2024-02-10 15:57:38 -05:00
|
|
|
( #010e DEO ) BRK
|
|
|
|
|
2024-02-10 23:00:10 -05:00
|
|
|
@on-mouse ( -> )
|
|
|
|
[ LIT2 00 -Mouse/state ] DEI NEQ #42 ADD ;pointer-icn <update-pointer>
|
2024-02-10 23:56:26 -05:00
|
|
|
.Mouse/state DEI ?on-mouse-down
|
|
|
|
( | hover )
|
|
|
|
get-mouse-key <set-hover>
|
|
|
|
BRK
|
|
|
|
|
|
|
|
@on-mouse-down ( -> )
|
2024-02-10 23:00:10 -05:00
|
|
|
BRK
|
|
|
|
|
2024-02-10 23:56:26 -05:00
|
|
|
(
|
|
|
|
@|core )
|
|
|
|
|
|
|
|
@<set-hover> ( id* -- )
|
|
|
|
DUP2 .hover LDZ2 EQU2 ?{ .hover STZ2
|
|
|
|
JMP2r }
|
|
|
|
POP2 JMP2r
|
|
|
|
|
|
|
|
@get-mouse-key ( -- id* )
|
|
|
|
( x ) .Mouse/x DEI2 #0008 SUB2 #05 SFT2
|
|
|
|
( y ) .Mouse/y DEI2 #0008 SUB2 #0030 DIV2 #0009 MUL2 ADD2
|
|
|
|
( last2 ) DUP #22 LTH ?{ #0004 SUB2 JMP2r }
|
|
|
|
( space ) DUP #1d SUB #04 GTH ?{ POP2 #001d }
|
|
|
|
JMP2r
|
|
|
|
|
2024-02-10 22:09:42 -05:00
|
|
|
@<set-position> ( id* -- )
|
2024-02-10 23:37:27 -05:00
|
|
|
DUP2 #0009 DIV2 #0030 MUL2 #0008 ADD2 .Screen/y DEO2
|
2024-02-10 22:09:42 -05:00
|
|
|
DUP #1e NEQ ?{ POP2 #0007 }
|
|
|
|
DUP #1f NEQ ?{ POP2 #0008 }
|
2024-02-10 23:37:27 -05:00
|
|
|
#0009 DIV2k MUL2 SUB2 #0020 MUL2 #0008 ADD2 .Screen/x DEO2
|
2024-02-10 15:57:38 -05:00
|
|
|
JMP2r
|
2024-02-10 15:16:58 -05:00
|
|
|
|
|
|
|
@<draw-keyboard> ( -- )
|
2024-02-10 22:09:42 -05:00
|
|
|
#0020 #0000
|
|
|
|
&l ( -- )
|
2024-02-10 23:56:26 -05:00
|
|
|
DUP2 #00 <draw-key-id>
|
|
|
|
( ) INC2 GTH2k ?&l
|
|
|
|
POP2 POP2 JMP2r
|
|
|
|
|
|
|
|
@<draw-key-id> ( id* state -- )
|
|
|
|
POP DUP2 <set-position>
|
|
|
|
DUP #1d EQU ?<draw-key-space>
|
|
|
|
#0006 MUL2 ;layout ADD2
|
2024-02-10 23:37:27 -05:00
|
|
|
( ) STH2k #0004 ADD2 LDA2
|
|
|
|
( ) STH2kr #0002 ADD2 LDA2
|
|
|
|
( ) STH2r LDA2 <draw-key>
|
2024-02-10 23:56:26 -05:00
|
|
|
JMP2r
|
2024-02-10 15:57:38 -05:00
|
|
|
|
|
|
|
@<draw-glyph> ( addr* -- )
|
2024-02-10 22:09:42 -05:00
|
|
|
.Screen/addr DEO2
|
2024-02-10 15:57:38 -05:00
|
|
|
[ LIT2 15 -Screen/auto ] DEO
|
2024-02-10 22:56:20 -05:00
|
|
|
[ LIT2 0a -Screen/sprite ] DEO
|
2024-02-10 15:57:38 -05:00
|
|
|
JMP2r
|
|
|
|
|
2024-02-10 22:09:42 -05:00
|
|
|
@<draw-key> ( a* b* c* -- )
|
2024-02-10 15:16:58 -05:00
|
|
|
<draw-button>
|
2024-02-10 22:09:42 -05:00
|
|
|
.Screen/x DEI2k #0006 ADD2 ROT DEO2
|
2024-02-10 15:57:38 -05:00
|
|
|
.Screen/y DEI2k #0004 ADD2 ROT DEO2
|
|
|
|
( | a )
|
|
|
|
<draw-glyph>
|
2024-02-10 22:09:42 -05:00
|
|
|
.Screen/x DEI2k #0002 SUB2 ROT DEO2
|
|
|
|
.Screen/y DEI2k #000c ADD2 ROT DEO2
|
2024-02-10 15:57:38 -05:00
|
|
|
( | b )
|
|
|
|
<draw-glyph>
|
2024-02-10 22:09:42 -05:00
|
|
|
.Screen/x DEI2k #0002 SUB2 ROT DEO2
|
|
|
|
.Screen/y DEI2k #000c ADD2 ROT DEO2
|
2024-02-10 15:57:38 -05:00
|
|
|
( | c )
|
|
|
|
<draw-glyph>
|
2024-02-10 22:09:42 -05:00
|
|
|
.Screen/x DEI2k #0006 ADD2 ROT DEO2
|
|
|
|
.Screen/y DEI2k #001c SUB2 ROT DEO2
|
2024-02-10 15:16:58 -05:00
|
|
|
JMP2r
|
|
|
|
|
2024-02-10 23:56:26 -05:00
|
|
|
@<draw-key-space> ( id* -- )
|
|
|
|
POP2 [ LIT2 35 -Screen/auto ] DEO
|
2024-02-10 23:37:27 -05:00
|
|
|
;button-wide-icn/left .Screen/addr DEO2
|
|
|
|
[ LIT2 81 -Screen/sprite ] DEOk DEOk #ef
|
|
|
|
&l ( -- )
|
|
|
|
;button-wide-icn/center .Screen/addr DEO2
|
|
|
|
[ LIT2 81 -Screen/sprite ] DEO
|
|
|
|
INC DUP ?&l
|
|
|
|
POP DEO
|
|
|
|
JMP2r
|
|
|
|
|
2024-02-10 15:16:58 -05:00
|
|
|
@<draw-button> ( -- )
|
2024-02-10 15:57:38 -05:00
|
|
|
.Screen/x DEI2 .Screen/y DEI2
|
|
|
|
( | draw )
|
|
|
|
[ LIT2 36 -Screen/auto ] DEO
|
2024-02-10 15:16:58 -05:00
|
|
|
;button-icn/top .Screen/addr DEO2
|
2024-02-10 22:56:20 -05:00
|
|
|
[ LIT2 81 -Screen/sprite ] DEOk DEOk
|
2024-02-10 15:16:58 -05:00
|
|
|
( ) ;button-icn/middle .Screen/addr DEO2
|
2024-02-10 15:57:38 -05:00
|
|
|
DEOk
|
|
|
|
( ) ;button-icn/middle .Screen/addr DEO2
|
|
|
|
DEOk
|
|
|
|
( ) ;button-icn/middle .Screen/addr DEO2
|
2024-02-10 15:16:58 -05:00
|
|
|
DEOk DEO
|
2024-02-10 15:57:38 -05:00
|
|
|
.Screen/y DEO2
|
|
|
|
.Screen/x DEO2
|
2024-02-10 15:16:58 -05:00
|
|
|
JMP2r
|
|
|
|
|
2024-02-10 23:00:10 -05:00
|
|
|
@<update-pointer> ( color addr* -- )
|
|
|
|
[ LIT2 00 -Screen/auto ] DEO
|
|
|
|
;fill-icn .Screen/addr DEO2
|
|
|
|
#40 <draw-pointer>
|
|
|
|
.Mouse/x DEI2 ,<draw-pointer>/x STR2
|
|
|
|
.Mouse/y DEI2 ,<draw-pointer>/y STR2
|
|
|
|
.Screen/addr DEO2
|
|
|
|
|
|
|
|
@<draw-pointer> ( color -- )
|
|
|
|
[ LIT2 &x $2 ] .Screen/x DEO2
|
|
|
|
[ LIT2 &y $2 ] .Screen/y DEO2
|
|
|
|
.Screen/sprite DEO
|
|
|
|
JMP2r
|
|
|
|
|
2024-02-10 15:57:38 -05:00
|
|
|
(
|
|
|
|
@|stdlib )
|
|
|
|
|
2024-02-10 15:16:58 -05:00
|
|
|
@<phex> ( short* -- )
|
|
|
|
SWP <phex>/b
|
|
|
|
&b ( -- )
|
|
|
|
DUP #04 SFT <phex>/c
|
|
|
|
&c ( -- )
|
|
|
|
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO
|
|
|
|
JMP2r
|
|
|
|
|
2024-02-10 16:32:01 -05:00
|
|
|
~assets.tal
|
2024-02-10 15:16:58 -05:00
|
|
|
|