improvements
This commit is contained in:
parent
9189fb270b
commit
9c60bcde34
111
term.tal
111
term.tal
|
@ -70,8 +70,8 @@
|
|||
@min ( x* y* -> min* )
|
||||
LTH2k JMP SWP2 POP2 JMP2r
|
||||
|
||||
( @max ( x* y* -> max* )
|
||||
LTH2k JMP SWP2 NIP2 JMP2r )
|
||||
@max ( x* y* -> max* )
|
||||
LTH2k JMP SWP2 NIP2 JMP2r
|
||||
|
||||
@clear-screen
|
||||
#01 .dirty? STZ
|
||||
|
@ -152,6 +152,55 @@
|
|||
&c1 LIT "@ SUB
|
||||
&done .Console/w DEO BRK
|
||||
|
||||
@on-read-seq ( -> )
|
||||
.Console/r DEI
|
||||
DUP LIT "; EQU ;next-arg JCN2
|
||||
DUP LIT "0 LTH ;end-arg JCN2
|
||||
DUP LIT "9 GTH ;end-arg JCN2
|
||||
;add-to-arg JMP2
|
||||
|
||||
@end-arg ( c^ -> )
|
||||
;on-read .Console/vect DEO2
|
||||
DUP LIT "h EQU ;exec-noop JCN2 ( enable line wrap )
|
||||
DUP LIT "l EQU ;exec-noop JCN2 ( disable line wrap )
|
||||
DUP LIT "m EQU ;exec-noop JCN2 ( set attr )
|
||||
DUP LIT "n EQU ;exec-noop JCN2 ( get status )
|
||||
DUP LIT "H EQU ;exec-move JCN2 ( move cursor )
|
||||
DUP LIT "A EQU ;exec-up JCN2 ( up )
|
||||
DUP LIT "B EQU ;exec-down JCN2 ( down )
|
||||
DUP LIT "C EQU ;exec-forward JCN2 ( forward )
|
||||
DUP LIT "D EQU ;exec-back JCN2 ( back )
|
||||
DUP LIT "J EQU ;exec-noop JCN2 ( erase line )
|
||||
DUP LIT "K EQU ;exec-noop JCN2 ( erase screen )
|
||||
POP BRK
|
||||
|
||||
@exec-noop ( c^ -> )
|
||||
POP BRK
|
||||
|
||||
@exec1 ( addr* -> )
|
||||
STH2 #0001 ;read-arg-1 JSR2 STH2r JSR2 BRK
|
||||
|
||||
@exec-up POP ;up-n ;exec1 JMP2
|
||||
@exec-down POP ;down-n ;exec1 JMP2
|
||||
@exec-forward POP ;forward-n ;exec1 JMP2
|
||||
@exec-back POP ;back-n ;exec1 JMP2
|
||||
|
||||
@exec-move ( c^ -> )
|
||||
POP LIT2r ffff
|
||||
#0001 ;read-arg-1 JSR2 STH2kr ADD2 ( row )
|
||||
#0001 ;read-arg-2 JSR2 STH2r ADD2 ( col )
|
||||
;goto JSR2 BRK
|
||||
|
||||
@on-read-esc ( -> )
|
||||
.Console/r DEI LIT "[ EQU ;start-seq JCN2
|
||||
;on-read .Console/vect DEO2
|
||||
;on-read JMP2
|
||||
|
||||
@start-seq ( -> )
|
||||
;reset-args JSR2
|
||||
;on-read-seq .Console/vect DEO2
|
||||
BRK
|
||||
|
||||
@on-read
|
||||
.Console/r DEI
|
||||
DUP ,&ok JCN POP BRK
|
||||
|
@ -164,18 +213,24 @@
|
|||
;read-printable JMP2
|
||||
|
||||
@read-ctrl ( c^ -> )
|
||||
DUP #07 EQU ;read-bel JCN2 ( TODO: flash )
|
||||
DUP #07 EQU ;read-bel JCN2
|
||||
DUP #08 EQU ;read-bs JCN2
|
||||
DUP #09 EQU ;read-tab JCN2
|
||||
DUP #0a EQU ;read-nl JCN2
|
||||
DUP #0d EQU ;read-cr JCN2
|
||||
DUP #1b EQU ;read-esc JCN2
|
||||
|
||||
( TODO: we need line-editing! )
|
||||
@read-bel POP JMP2r
|
||||
@read-bs POP JMP2r ( POP ;scroll JMP2 )
|
||||
@read-esc POP JMP2r
|
||||
@read-del POP JMP2r
|
||||
@read-bel ( 07 -> )
|
||||
POP JMP2r ( TODO: flash terminal )
|
||||
|
||||
@read-bs ( 08 -> )
|
||||
POP JMP2r ( POP ;scroll JMP2 )
|
||||
|
||||
@read-esc ( 1b -> )
|
||||
POP ;on-read-esc .Console/vect DEO2 BRK
|
||||
|
||||
@read-del ( 7f -> )
|
||||
POP JMP2r
|
||||
|
||||
( @read-tab POP JMP2r )
|
||||
@read-tab
|
||||
|
@ -203,6 +258,12 @@
|
|||
;draw-tile JSR2
|
||||
;forward JMP2
|
||||
|
||||
@goto ( y* x* -> )
|
||||
;hide-cursor JSR2
|
||||
.max-x LDZ2 ;min JSR2 .cur-x STZ2
|
||||
.max-y LDZ2 ;min JSR2 .cur-y STZ2
|
||||
;show-cursor JMP2
|
||||
|
||||
@forward-n ( n* -> )
|
||||
;hide-cursor JSR2
|
||||
.cur-x LDZ2 ADD2 .max-x LDZ2 ;min JSR2 .cur-x STZ2
|
||||
|
@ -218,8 +279,8 @@
|
|||
&zero POP2 POP2 #0000
|
||||
&done .cur-x STZ2 ;show-cursor JMP2
|
||||
|
||||
@back ( -> )
|
||||
#0001 ,back-n JMP
|
||||
( @back ( -> )
|
||||
#0001 ,back-n JMP )
|
||||
|
||||
@up-n ( n* -> )
|
||||
;hide-cursor JSR2
|
||||
|
@ -228,8 +289,8 @@
|
|||
&zero POP2 POP2 #0000
|
||||
&done .cur-y STZ2 ;show-cursor JMP2
|
||||
|
||||
@up ( -> )
|
||||
#0001 ,up-n JMP
|
||||
( @up ( -> )
|
||||
#0001 ,up-n JMP )
|
||||
|
||||
@down-n ( n* -> )
|
||||
;hide-cursor JSR2
|
||||
|
@ -283,6 +344,32 @@
|
|||
@ascii
|
||||
~chr/ascii.tal
|
||||
|
||||
@next-arg ( c^ -> )
|
||||
POP
|
||||
( TODO: check if we already have max args )
|
||||
;args/pos LDA2k INC2 INC2 STA2 BRK
|
||||
|
||||
@add-to-arg ( c^ -> )
|
||||
LIT "0 SUB LITr 00 STH ( [digit*] )
|
||||
;args/pos LDA2 LDA2k ( addr* value* [digit*] )
|
||||
#000a MUL2 STH2r ADD2 ( addr* value*10+digit )
|
||||
SWP2 STA2 BRK
|
||||
|
||||
@read-arg-1 ( default* -> n* )
|
||||
;args LDA2 ;max JMP2
|
||||
@read-arg-2 ( default* -> n* )
|
||||
;args INC2 INC2 LDA2 ;max JMP2
|
||||
|
||||
@reset-args ( -> )
|
||||
;args ;args/pos STA2
|
||||
#0000 ;args LITr f8
|
||||
&loop STA2k INC2 INC2
|
||||
INCr STHkr ,&loop JCN
|
||||
POPr POP2 POP2 JMP2r
|
||||
|
||||
( store up to 8 arguments for control sequences )
|
||||
@args $10 &pos $2
|
||||
|
||||
( store characters for redraw, etc. )
|
||||
@screen $0c80 ( 80 x 40 )
|
||||
@end-screen
|
||||
|
|
Loading…
Reference in New Issue