arrow keys
This commit is contained in:
parent
31294ca6e7
commit
a58b0f1133
22
term.tal
22
term.tal
|
@ -22,11 +22,12 @@
|
||||||
|00 @System [ &vect $2 &pad $6 &r $2 &g $2 &b $2 ]
|
|00 @System [ &vect $2 &pad $6 &r $2 &g $2 &b $2 ]
|
||||||
|10 @Console [ &vect $2 &r $1 &pad $5 &w $1 ]
|
|10 @Console [ &vect $2 &r $1 &pad $5 &w $1 ]
|
||||||
|20 @Screen [ &vect $2 &w $2 &h $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|
|20 @Screen [ &vect $2 &w $2 &h $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|
||||||
|80 @Controller [ &vect $2 &button $1 &key $1 ]
|
|80 @Controller [ &vect $2 &button $1 &key $1 &fn $1 ]
|
||||||
|
|
||||||
|0000
|
|0000
|
||||||
@tint $1 ( draw mode. 01=regular, 04=inverted )
|
@tint $1 ( draw mode. 01=regular, 04=inverted )
|
||||||
@dirty? $1 ( screen needs redraw? )
|
@dirty? $1 ( screen needs redraw? )
|
||||||
|
@lastkey $1 ( last button press )
|
||||||
@rows $2 ( height in characters )
|
@rows $2 ( height in characters )
|
||||||
@cols $2 ( width in characters )
|
@cols $2 ( width in characters )
|
||||||
@cur-x $2 ( cursor x: 0 <= cur-x < cols )
|
@cur-x $2 ( cursor x: 0 <= cur-x < cols )
|
||||||
|
@ -47,6 +48,9 @@
|
||||||
#0000 .cur-x STZ2
|
#0000 .cur-x STZ2
|
||||||
#0000 .cur-y STZ2
|
#0000 .cur-y STZ2
|
||||||
|
|
||||||
|
( confirm no buttons pressed yet )
|
||||||
|
#00 .lastkey STZ
|
||||||
|
|
||||||
( set screen height/width based on rows/cols )
|
( set screen height/width based on rows/cols )
|
||||||
.rows LDZ2 #30 SFT2 .Screen/h DEO2
|
.rows LDZ2 #30 SFT2 .Screen/h DEO2
|
||||||
.cols LDZ2 #30 SFT2 .Screen/w DEO2
|
.cols LDZ2 #30 SFT2 .Screen/w DEO2
|
||||||
|
@ -140,8 +144,22 @@
|
||||||
.cur-y LDZ2 .cols LDZ2 MUL2 .cur-x LDZ2 ADD2 ;screen ADD2 LDA
|
.cur-y LDZ2 .cols LDZ2 MUL2 .cur-x LDZ2 ADD2 ;screen ADD2 LDA
|
||||||
;draw-tile JMP2
|
;draw-tile JMP2
|
||||||
|
|
||||||
|
@on-button ( -> )
|
||||||
|
.lastkey LDZ .Controller/button DEI STHk EOR STHr AND ( new-buttons )
|
||||||
|
DUP #10 AND #00 EQU ,&no-n JCN LIT "A ,arrow JSR
|
||||||
|
&no-n DUP #20 AND #00 EQU ,&no-s JCN LIT "B ,arrow JSR
|
||||||
|
&no-s DUP #40 AND #00 EQU ,&no-w JCN LIT "D ,arrow JSR
|
||||||
|
&no-w DUP #80 AND #00 EQU ,&no-e JCN LIT "C ,arrow JSR
|
||||||
|
&no-e .Controller/button DEI .lastkey STZ BRK
|
||||||
|
|
||||||
|
( send ESC [ $c )
|
||||||
|
@arrow ( c^ -> )
|
||||||
|
.Console/w STH
|
||||||
|
#1b STHkr DEO LIT "[ STHkr DEO STHr DEO
|
||||||
|
JMP2r
|
||||||
|
|
||||||
@on-key ( -> )
|
@on-key ( -> )
|
||||||
.Controller/key DEI ,&ok JCN BRK
|
.Controller/key DEI ,&ok JCN ,on-button JMP
|
||||||
&ok ,alt? JSR ,on-alt-key JCN
|
&ok ,alt? JSR ,on-alt-key JCN
|
||||||
,ctrl? JSR ,on-ctrl-key JCN
|
,ctrl? JSR ,on-ctrl-key JCN
|
||||||
.Controller/key DEI .Console/w DEO BRK
|
.Controller/key DEI .Console/w DEO BRK
|
||||||
|
|
Loading…
Reference in New Issue