implement border and some more commands
This commit is contained in:
parent
3199955517
commit
ff6b76ba04
124
term.tal
124
term.tal
|
@ -133,25 +133,49 @@
|
||||||
#0018 .rows STZ2
|
#0018 .rows STZ2
|
||||||
#0050 .cols STZ2
|
#0050 .cols STZ2
|
||||||
|
|
||||||
( set initial cursor )
|
|
||||||
#0000 .cur-x STZ2
|
|
||||||
#0000 .cur-y STZ2
|
|
||||||
|
|
||||||
( start cursor at origin - including border )
|
( start cursor at origin - including border )
|
||||||
#0010 ( border ) .Screen/x DEO2
|
#0010 ( border ) .Screen/x DEO2
|
||||||
#0010 ( border ) .Screen/y DEO2
|
#0010 ( border ) .Screen/y DEO2
|
||||||
|
|
||||||
( confirm no buttons pressed yet )
|
|
||||||
#00 .lastkey STZ
|
|
||||||
|
|
||||||
( set colors )
|
( set colors )
|
||||||
#07bf .System/r DEO2
|
#07bf .System/r DEO2
|
||||||
#07bf .System/g DEO2
|
#07bf .System/g DEO2
|
||||||
#07bf .System/b DEO2
|
#07bf .System/b DEO2
|
||||||
|
|
||||||
|
( set up interrupts )
|
||||||
|
;redraw .Screen/vect DEO2 ( set up screen )
|
||||||
|
;on-key .Controller/vect DEO2 ( set up keyboard )
|
||||||
|
;on-mouse .Mouse/vect DEO2 ( set up mouse )
|
||||||
|
;on-read .Console/vect DEO2 ( set up stdin )
|
||||||
|
|
||||||
( load theme to override colors and maybe dimension )
|
( load theme to override colors and maybe dimension )
|
||||||
load-theme
|
load-theme
|
||||||
|
|
||||||
|
( these only work with a patched uxnemu )
|
||||||
|
( on other emulators they should be no-ops )
|
||||||
|
;shell .Console/exec DEO2 ( set up bash subprocess )
|
||||||
|
#80 .Console/mode DEO ( start bash subprocess )
|
||||||
|
|
||||||
|
( initialize terminal state and settings )
|
||||||
|
reset-terminal
|
||||||
|
|
||||||
|
( set to 01 to enable debug log )
|
||||||
|
#00 .debug STZ
|
||||||
|
|
||||||
|
.debug LDZ ?&continue BRK &continue
|
||||||
|
#99 #010e DEO
|
||||||
|
;debug-log .File1/name DEO2
|
||||||
|
#01 .File1/append DEO
|
||||||
|
BRK
|
||||||
|
|
||||||
|
@reset-terminal ( -> )
|
||||||
|
( set initial cursor )
|
||||||
|
#0000 .cur-x STZ2
|
||||||
|
#0000 .cur-y STZ2
|
||||||
|
|
||||||
|
( confirm no buttons pressed yet )
|
||||||
|
#00 .lastkey STZ
|
||||||
|
|
||||||
( calculate derived dimensions from cols/rows )
|
( calculate derived dimensions from cols/rows )
|
||||||
update-dimensions
|
update-dimensions
|
||||||
|
|
||||||
|
@ -168,28 +192,12 @@
|
||||||
( clear screen for initial draw )
|
( clear screen for initial draw )
|
||||||
clear-screen
|
clear-screen
|
||||||
|
|
||||||
( set up interrupts )
|
|
||||||
;redraw .Screen/vect DEO2 ( set up screen )
|
|
||||||
;on-key .Controller/vect DEO2 ( set up keyboard )
|
|
||||||
;on-mouse .Mouse/vect DEO2 ( set up mouse )
|
|
||||||
;on-read .Console/vect DEO2 ( set up stdin )
|
|
||||||
|
|
||||||
( these only work with a patched uxnemu )
|
|
||||||
( on other emulators they should be no-ops )
|
|
||||||
;shell .Console/exec DEO2 ( set up bash subprocess )
|
|
||||||
#80 .Console/mode DEO ( start bash subprocess )
|
|
||||||
|
|
||||||
( user defaults )
|
( user defaults )
|
||||||
#01 .visual-bell STZ
|
#01 .visual-bell STZ
|
||||||
|
|
||||||
( set to 01 to enable debug log )
|
( draw border )
|
||||||
#00 .debug STZ
|
draw-border
|
||||||
|
JMP2r
|
||||||
.debug LDZ ?&continue BRK &continue
|
|
||||||
#99 #010e DEO
|
|
||||||
;debug-log .File1/name DEO2
|
|
||||||
#01 .File1/append DEO
|
|
||||||
BRK
|
|
||||||
|
|
||||||
@update-dimensions ( -> )
|
@update-dimensions ( -> )
|
||||||
( set col-bytes, frequently needed )
|
( set col-bytes, frequently needed )
|
||||||
|
@ -265,6 +273,36 @@
|
||||||
#40 .Screen/sprite DEO STH2r ( y* ; s/s<-40 )
|
#40 .Screen/sprite DEO STH2r ( y* ; s/s<-40 )
|
||||||
.Screen/y DEO2 JMP2r ( ; s/y<-y )
|
.Screen/y DEO2 JMP2r ( ; s/y<-y )
|
||||||
|
|
||||||
|
@draw-border ( -> )
|
||||||
|
#0200 ;cp437 ADD2 .Screen/addr DEO2
|
||||||
|
#04 .Screen/sprite
|
||||||
|
#0000 draw-border/row
|
||||||
|
#0008 draw-border/row
|
||||||
|
.rows LDZ2 #000c MUL2 #0010 ADD2 draw-border/row
|
||||||
|
.rows LDZ2 #000c MUL2 #0018 ADD2 draw-border/row
|
||||||
|
#0000 draw-border/col
|
||||||
|
#0008 draw-border/col
|
||||||
|
.cols LDZ2 #0008 MUL2 #0010 ADD2 draw-border/col
|
||||||
|
.cols LDZ2 #0008 MUL2 #0018 ADD2 draw-border/col
|
||||||
|
#00 .Screen/auto DEO POP2 !screen-to-cursor
|
||||||
|
|
||||||
|
&row ( y* -> )
|
||||||
|
.Screen/y DEO2
|
||||||
|
#0000 .Screen/x DEO2
|
||||||
|
#01 .Screen/auto DEO
|
||||||
|
#0000 .cols LDZ2 #0004 ADD2 SUB2 STH2
|
||||||
|
!&loop
|
||||||
|
|
||||||
|
&col ( x* -> )
|
||||||
|
.Screen/x DEO2
|
||||||
|
#0000 .Screen/y DEO2
|
||||||
|
#02 .Screen/auto DEO
|
||||||
|
#0000 .rows LDZ2 #0003 MUL2 INC2 #0002 DIV2 #0004 ADD2 SUB2 STH2
|
||||||
|
!&loop
|
||||||
|
|
||||||
|
&loop ( 04 sprite^ [-count] )
|
||||||
|
DEOk INC2r STH2kr ORA ?&loop POP2r JMP2r
|
||||||
|
|
||||||
@redraw ( -> BRK )
|
@redraw ( -> BRK )
|
||||||
.pointer-ttl LDZ #00 EQU ?&pointer-ok ( )
|
.pointer-ttl LDZ #00 EQU ?&pointer-ok ( )
|
||||||
.pointer-ttl LDZk INC DUP ROT STZ ?&pointer-ok
|
.pointer-ttl LDZk INC DUP ROT STZ ?&pointer-ok
|
||||||
|
@ -711,6 +749,7 @@
|
||||||
DUP LIT "L EQU ?exec-insert-lines ( insert blank lines )
|
DUP LIT "L EQU ?exec-insert-lines ( insert blank lines )
|
||||||
DUP LIT "M EQU ?exec-delete-lines ( delete n lines )
|
DUP LIT "M EQU ?exec-delete-lines ( delete n lines )
|
||||||
DUP LIT "P EQU ?exec-delete-chars ( delete n chars )
|
DUP LIT "P EQU ?exec-delete-chars ( delete n chars )
|
||||||
|
DUP LIT "Z EQU ?exec-back-tabs ( backward by tab stops )
|
||||||
( ` - horizontal position absolute )
|
( ` - horizontal position absolute )
|
||||||
( S - scroll up n lines )
|
( S - scroll up n lines )
|
||||||
( X - erase n chars )
|
( X - erase n chars )
|
||||||
|
@ -778,6 +817,7 @@
|
||||||
@exec-delete-chars POP ;delete-n-chars !exec1
|
@exec-delete-chars POP ;delete-n-chars !exec1
|
||||||
@exec-insert-lines POP ;insert-n-lines !exec1
|
@exec-insert-lines POP ;insert-n-lines !exec1
|
||||||
@exec-forward-tabs POP ;forward-n-tabs !exec1
|
@exec-forward-tabs POP ;forward-n-tabs !exec1
|
||||||
|
@exec-back-tabs POP ;back-n-tabs !exec1
|
||||||
|
|
||||||
@exec-erase-line ( c^ -> BRK )
|
@exec-erase-line ( c^ -> BRK )
|
||||||
POP #0000 read-arg-1
|
POP #0000 read-arg-1
|
||||||
|
@ -854,8 +894,14 @@
|
||||||
@on-read-esc ( -> BRK )
|
@on-read-esc ( -> BRK )
|
||||||
.Console/r DEI
|
.Console/r DEI
|
||||||
DUP debug-esc
|
DUP debug-esc
|
||||||
|
DUP LIT "D EQU ?exec-ind
|
||||||
|
DUP LIT "E EQU ?exec-nel
|
||||||
|
DUP LIT "H EQU ?exec-hts
|
||||||
|
DUP LIT "M EQU ?exec-ri
|
||||||
|
DUP LIT "P EQU ?exec-dcs
|
||||||
DUP LIT "[ EQU ?start-csi
|
DUP LIT "[ EQU ?start-csi
|
||||||
DUP LIT "] EQU ?start-osc
|
DUP LIT "] EQU ?start-osc
|
||||||
|
DUP LIT "c EQU ?exec-ris
|
||||||
DUP LIT "( EQU ?start-charset
|
DUP LIT "( EQU ?start-charset
|
||||||
DUP LIT ") EQU ?start-charset
|
DUP LIT ") EQU ?start-charset
|
||||||
DUP LIT "7 EQU ?&skip ( save cursor )
|
DUP LIT "7 EQU ?&skip ( save cursor )
|
||||||
|
@ -865,6 +911,17 @@
|
||||||
!on-read
|
!on-read
|
||||||
&skip POP ;on-read .Console/vect DEO2 BRK
|
&skip POP ;on-read .Console/vect DEO2 BRK
|
||||||
|
|
||||||
|
@exec-ind ( c^ -> ) POP down BRK
|
||||||
|
@exec-nel ( c^ -> ) POP cr BRK
|
||||||
|
@exec-hts ( c^ -> ) POP BRK
|
||||||
|
@exec-ri ( c^ -> ) POP up BRK
|
||||||
|
@exec-dcs ( c^ -> ) POP BRK
|
||||||
|
@exec-st ( c^ -> ) POP BRK
|
||||||
|
|
||||||
|
@exec-ris ( c^ -> )
|
||||||
|
POP first-addr limit-addr erase
|
||||||
|
reset-terminal BRK
|
||||||
|
|
||||||
@on-read-skip ( -> BRK )
|
@on-read-skip ( -> BRK )
|
||||||
;on-read .Console/vect DEO2
|
;on-read .Console/vect DEO2
|
||||||
BRK
|
BRK
|
||||||
|
@ -937,9 +994,12 @@
|
||||||
INC DUP ?&loop ( i+1^ )
|
INC DUP ?&loop ( i+1^ )
|
||||||
POP BRK ( )
|
POP BRK ( )
|
||||||
|
|
||||||
|
@cr ( -> )
|
||||||
|
clear-cursor #0000 .cur-x STZ2 !draw-cursor
|
||||||
|
|
||||||
@read-cr ( 0d -> BRK )
|
@read-cr ( 0d -> BRK )
|
||||||
POP .cur-wrap LDZ ?&skip
|
POP .cur-wrap LDZ ?&skip
|
||||||
clear-cursor #0000 .cur-x STZ2 draw-cursor
|
( clear-cursor #0000 .cur-x STZ2 draw-cursor ) cr
|
||||||
&skip BRK
|
&skip BRK
|
||||||
|
|
||||||
@at-max-y ( -> true? )
|
@at-max-y ( -> true? )
|
||||||
|
@ -980,13 +1040,14 @@
|
||||||
&zero POP2 POP2 #0000
|
&zero POP2 POP2 #0000
|
||||||
&done .cur-y STZ2 !draw-cursor
|
&done .cur-y STZ2 !draw-cursor
|
||||||
|
|
||||||
|
@up ( -> ) #0001 !up-n
|
||||||
|
|
||||||
@down-n ( n* -> )
|
@down-n ( n* -> )
|
||||||
clear-cursor
|
clear-cursor
|
||||||
.cur-y LDZ2 ADD2 .max-y LDZ2 min .cur-y STZ2
|
.cur-y LDZ2 ADD2 .max-y LDZ2 min .cur-y STZ2
|
||||||
!draw-cursor
|
!draw-cursor
|
||||||
|
|
||||||
@down ( -> )
|
@down ( -> ) #0001 !down-n
|
||||||
#0001 !down-n
|
|
||||||
|
|
||||||
@maybe-autowrap ( -> )
|
@maybe-autowrap ( -> )
|
||||||
.cur-wrap LDZ #00 EQU ?&skip
|
.cur-wrap LDZ #00 EQU ?&skip
|
||||||
|
@ -1017,6 +1078,11 @@
|
||||||
#0008 .cur-x LDZ2 #0007 AND2 SUB2 ( i* 8-cur%8* )
|
#0008 .cur-x LDZ2 #0007 AND2 SUB2 ( i* 8-cur%8* )
|
||||||
ADD2 !forward-n ( )
|
ADD2 !forward-n ( )
|
||||||
|
|
||||||
|
@back-n-tabs ( n* -> )
|
||||||
|
dec-floor #30 SFT2 ( i=(n-1)8* )
|
||||||
|
.cur-x LDZ2 #0007 AND2 ( i* cur%8* )
|
||||||
|
ADD2 !back-n ( )
|
||||||
|
|
||||||
@insert-n-lines ( n* -> )
|
@insert-n-lines ( n* -> )
|
||||||
.col-bytes LDZ2 MUL2 STH2 ( [i*] )
|
.col-bytes LDZ2 MUL2 STH2 ( [i*] )
|
||||||
bol-addr ( bound* [i*] )
|
bol-addr ( bound* [i*] )
|
||||||
|
|
Loading…
Reference in New Issue