control characters work now
This commit is contained in:
parent
7757e71409
commit
927aece263
46
term.tal
46
term.tal
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
|0000
|
|0000
|
||||||
@tint $1 ( draw mode. 01=regular, 04=inverted )
|
@tint $1 ( draw mode. 01=regular, 04=inverted )
|
||||||
@pos $1 ( cur buffer position )
|
|
||||||
@max $1 ( max buffer position )
|
|
||||||
@dirty? $1 ( screen needs redraw? )
|
@dirty? $1 ( screen needs redraw? )
|
||||||
|
|
||||||
@rows $2 ( height in characters )
|
@rows $2 ( height in characters )
|
||||||
|
@ -14,8 +12,6 @@
|
||||||
@cur-x $2 ( cursor x: 0 <= cur-x < cols )
|
@cur-x $2 ( cursor x: 0 <= cur-x < cols )
|
||||||
@cur-y $2 ( cursor y: 0 <= cur-y < rows )
|
@cur-y $2 ( cursor y: 0 <= cur-y < rows )
|
||||||
|
|
||||||
@buffer $c8 ( input buffer, 200 bytes )
|
|
||||||
|
|
||||||
|0100
|
|0100
|
||||||
( 80 cols x 24 rows )
|
( 80 cols x 24 rows )
|
||||||
#0028 .rows STZ2
|
#0028 .rows STZ2
|
||||||
|
@ -30,10 +26,6 @@
|
||||||
#0c88 .System/g DEO2
|
#0c88 .System/g DEO2
|
||||||
#0c0f .System/b DEO2
|
#0c0f .System/b DEO2
|
||||||
|
|
||||||
( set pos )
|
|
||||||
.buffer .pos STZ
|
|
||||||
.buffer .max STZ
|
|
||||||
|
|
||||||
( clear screen for initial draw )
|
( clear screen for initial draw )
|
||||||
;clear-screen JSR2
|
;clear-screen JSR2
|
||||||
|
|
||||||
|
@ -97,15 +89,38 @@
|
||||||
.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-key
|
@on-key ( -> )
|
||||||
.Controller/key DEI #00 EQU ,&skip JCN
|
.Controller/key DEI ,&ok JCN BRK
|
||||||
.Controller/key DEI .Console/w DEO &skip BRK
|
&ok ,alt? JSR ,on-alt-key JCN
|
||||||
|
,ctrl? JSR ,on-ctrl-key JCN
|
||||||
|
.Controller/key DEI .Console/w DEO BRK
|
||||||
|
|
||||||
|
@ctrl? ( -> down? ) .Controller/button DEI #01 AND JMP2r
|
||||||
|
@alt? ( -> down? ) .Controller/button DEI #02 AND JMP2r
|
||||||
|
|
||||||
|
( alt-XYZ emits ESC and then emits XYZ )
|
||||||
|
@on-alt-key ( -> )
|
||||||
|
#1b .Console/w DEO
|
||||||
|
,ctrl? JSR ,on-ctrl-key JCN
|
||||||
|
.Controller/key DEI .Console/w DEO BRK
|
||||||
|
|
||||||
|
( ctrl-$n emits: )
|
||||||
|
( 0 <= $n < @ -> $n )
|
||||||
|
( @ <= $n < ` -> $n #40 SUB )
|
||||||
|
( ` <= $n <= #ff -> $n #60 SUB )
|
||||||
|
@on-ctrl-key ( -> )
|
||||||
|
.Controller/key DEI
|
||||||
|
DUP LIT "@ LTH ,&done JCN
|
||||||
|
DUP LIT "` LTH ,&c1 JCN
|
||||||
|
LIT "` SUB ,&done JMP
|
||||||
|
&c1 LIT "@ SUB
|
||||||
|
&done .Console/w DEO BRK
|
||||||
|
|
||||||
@on-input
|
@on-input
|
||||||
.Console/r DEI #00 EQU ,&skip JCN
|
.Console/r DEI
|
||||||
#41 .tint STZ
|
DUP ,&ok JCN POP BRK
|
||||||
.Console/r DEI ;read JSR2
|
&ok #41 .tint STZ
|
||||||
&skip BRK
|
;read JSR2 BRK
|
||||||
|
|
||||||
@read ( byte^ -> )
|
@read ( byte^ -> )
|
||||||
DUP #07 EQU ;read-bel JCN2
|
DUP #07 EQU ;read-bel JCN2
|
||||||
|
@ -156,7 +171,6 @@
|
||||||
POP2 POP JMP2r
|
POP2 POP JMP2r
|
||||||
&continue ( addr^ value* )
|
&continue ( addr^ value* )
|
||||||
;hide-cursor JSR2
|
;hide-cursor JSR2
|
||||||
.pos LDZ #01 SUB .pos STZ
|
|
||||||
.cur-x LDZ2 #0001 SUB2 .cur-x STZ2
|
.cur-x LDZ2 #0001 SUB2 .cur-x STZ2
|
||||||
;show-cursor JMP2
|
;show-cursor JMP2
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue