Starting keyboard input

This commit is contained in:
Devine Lu Linvega 2024-02-11 11:36:26 -08:00
parent b15cf14dfc
commit 25bd28617f
1 changed files with 15 additions and 14 deletions

View File

@ -3,6 +3,7 @@
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 |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 |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 |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 &pad $4 &scrolly &scrolly-hb $1 &scrolly-lb $1 |90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1 &pad $4 &scrolly &scrolly-hb $1 &scrolly-lb $1
|0000 |0000
@ -20,6 +21,7 @@
#0130 .Screen/width DEO2 #0130 .Screen/width DEO2
#00d0 .Screen/height DEO2 #00d0 .Screen/height DEO2
;on-mouse .Mouse/vector DEO2 ;on-mouse .Mouse/vector DEO2
;on-control .Controller/vector DEO2
<draw-keyboard> <draw-keyboard>
( #010e DEO ) BRK ( #010e DEO ) BRK
@ -46,6 +48,11 @@
[ LIT2 01 -lock ] STZ } [ LIT2 01 -lock ] STZ }
BRK BRK
@on-control ( -> )
.Controller/button DEI #02 SFT #01 AND .layer STZ
<draw-keyboard>
BRK
( (
@|core ) @|core )
@ -73,21 +80,15 @@
.Mouse/state DEI .Mouse/state DEI
( ) DUP #02 AND ?&top ( ) DUP #02 AND ?&top
( ) #04 AND ?&bottom ( ) #04 AND ?&bottom
[ LIT2 00 -layer ] LDZ JMP2r .Controller/button DEI
( ) #04 AND ?&top
.layer LDZ
( ) DUP #00 EQU ?&top
( ) #02 EQU ?&bottom
#0000 JMP2r
&top POP #0001 JMP2r &top POP #0001 JMP2r
&bottom #0002 JMP2r &bottom #0002 JMP2r
@<detect-layer> ( state -- )
DUP #02 AND ?&top
DUP #04 AND ?&bottom
POP JMP2r
&top ( state -- )
POP #01 .layer STZ
JMP2r
&bottom ( state -- )
POP #02 .layer STZ
JMP2r
@<toggle-layer> ( -- ) @<toggle-layer> ( -- )
.layer LDZ INC #03 DIVk MUL SUB .layer STZ .layer LDZ INC #03 DIVk MUL SUB .layer STZ
!<draw-keyboard> !<draw-keyboard>
@ -141,11 +142,11 @@
.Screen/x DEI2k #0002 SUB2 ROT DEO2 .Screen/x DEI2k #0002 SUB2 ROT DEO2
.Screen/y DEI2k #0024 STHr SUB STHr SUB SUB2 ROT DEO2 .Screen/y DEI2k #0024 STHr SUB STHr SUB SUB2 ROT DEO2
( | a ) ( | a )
#0a00 [ LIT2 00 -layer ] LDZ EQU [ JMP SWP POP ] <draw-glyph> #0a00 [ LIT2 01 -layer ] LDZ EQU [ JMP SWP POP ] <draw-glyph>
.Screen/x DEI2k #0002 SUB2 ROT DEO2 .Screen/x DEI2k #0002 SUB2 ROT DEO2
.Screen/y DEI2k #000c ADD2 ROT DEO2 .Screen/y DEI2k #000c ADD2 ROT DEO2
( | b ) ( | b )
#0a00 [ LIT2 01 -layer ] LDZ EQU [ JMP SWP POP ] <draw-glyph> #0a00 [ LIT2 00 -layer ] LDZ EQU [ JMP SWP POP ] <draw-glyph>
.Screen/x DEI2k #0002 SUB2 ROT DEO2 .Screen/x DEI2k #0002 SUB2 ROT DEO2
.Screen/y DEI2k #000c ADD2 ROT DEO2 .Screen/y DEI2k #000c ADD2 ROT DEO2
( | c ) ( | c )