very basic autowrap
This commit is contained in:
parent
3c471499c9
commit
d711a6106e
41
term.tal
41
term.tal
|
@ -98,6 +98,7 @@
|
||||||
@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 )
|
||||||
@cur-y $2 ( cursor y: 0 <= cur-y < rows )
|
@cur-y $2 ( cursor y: 0 <= cur-y < rows )
|
||||||
|
@cur-wrap $1 ( did cursor just wrap? )
|
||||||
@max-x $2 ( cols-1 )
|
@max-x $2 ( cols-1 )
|
||||||
@max-y $2 ( rows-1 )
|
@max-y $2 ( rows-1 )
|
||||||
@col-bytes $2 ( 2*cols )
|
@col-bytes $2 ( 2*cols )
|
||||||
|
@ -130,7 +131,7 @@
|
||||||
|
|
||||||
( 80 cols x 24 rows + 1 col for padding )
|
( 80 cols x 24 rows + 1 col for padding )
|
||||||
#0018 .rows STZ2
|
#0018 .rows STZ2
|
||||||
#0051 .cols STZ2
|
#0050 .cols STZ2
|
||||||
|
|
||||||
( set initial cursor )
|
( set initial cursor )
|
||||||
#0000 .cur-x STZ2
|
#0000 .cur-x STZ2
|
||||||
|
@ -881,9 +882,12 @@
|
||||||
&ok
|
&ok
|
||||||
DUP #20 LTH ?read-ctrl
|
DUP #20 LTH ?read-ctrl
|
||||||
DUP #7f EQU ?read-del
|
DUP #7f EQU ?read-del
|
||||||
( read printable )
|
.tint LDZ SWP DUP2 insert-cell draw-cell
|
||||||
.tint LDZ SWP DUP2 insert-cell
|
forward
|
||||||
draw-cell forward BRK
|
( TODO: all cursor movement should potentially set/unset this flag )
|
||||||
|
( so this should move into forward and everything else )
|
||||||
|
.cur-x LDZ2 .max-x LDZ2 EQU2 .cur-wrap STZ
|
||||||
|
BRK
|
||||||
|
|
||||||
@read-ctrl ( c^ -> BRK )
|
@read-ctrl ( c^ -> BRK )
|
||||||
DUP #07 EQU ?read-bel
|
DUP #07 EQU ?read-bel
|
||||||
|
@ -930,7 +934,9 @@
|
||||||
.cur-y LDZ2 .max-y LDZ2 EQU2 JMP2r
|
.cur-y LDZ2 .max-y LDZ2 EQU2 JMP2r
|
||||||
|
|
||||||
@read-nl ( 0a -> BRK )
|
@read-nl ( 0a -> BRK )
|
||||||
POP clear-cursor at-max-y ?scroll down BRK
|
POP clear-cursor at-max-y ?&scrolling
|
||||||
|
down BRK
|
||||||
|
&scrolling scroll BRK
|
||||||
|
|
||||||
@goto ( y* x* -> )
|
@goto ( y* x* -> )
|
||||||
clear-cursor
|
clear-cursor
|
||||||
|
@ -968,7 +974,16 @@
|
||||||
@down ( -> )
|
@down ( -> )
|
||||||
#0001 !down-n
|
#0001 !down-n
|
||||||
|
|
||||||
|
@maybe-autowrap ( -> )
|
||||||
|
.cur-wrap LDZ #00 EQU ?&skip
|
||||||
|
clear-cursor #0000 .cur-x STZ2
|
||||||
|
at-max-y ?&scrolling
|
||||||
|
.cur-y LDZ2k INC2 ROT STZ2
|
||||||
|
&skip JMP2r
|
||||||
|
&scrolling #010e DEO !scroll
|
||||||
|
|
||||||
@insert-cell ( cell* -> )
|
@insert-cell ( cell* -> )
|
||||||
|
maybe-autowrap ( cell* )
|
||||||
.irm LDZ #00 EQU ?&replace ( cell* )
|
.irm LDZ #00 EQU ?&replace ( cell* )
|
||||||
cur-addr ( cell* lim* )
|
cur-addr ( cell* lim* )
|
||||||
eol-addr #0002 SUB2 ( cell* lim* last=eol-2* )
|
eol-addr #0002 SUB2 ( cell* lim* last=eol-2* )
|
||||||
|
@ -1037,16 +1052,16 @@
|
||||||
eol-addr ( limit* start* [n*] )
|
eol-addr ( limit* start* [n*] )
|
||||||
!delete-n-chars/loop
|
!delete-n-chars/loop
|
||||||
|
|
||||||
@scroll ( -> BRK )
|
@scroll ( -> )
|
||||||
limit-addr STH2
|
limit-addr STH2 ( [lim*] )
|
||||||
;cells .col-bytes LDZ2 ADD2 STH2
|
;cells .col-bytes LDZ2 ADD2 STH2 ( [lim* addr*] )
|
||||||
&loop
|
&loop ( [lim* pos*] )
|
||||||
STH2kr LDA2 #0200 STH2kr STA2
|
STH2kr LDA2 #0200 STH2kr STA2 ( cell* [lim* pos* cell*] ; pos<-0200 )
|
||||||
STH2kr .col-bytes LDZ2 SUB2 STA2
|
STH2kr .col-bytes LDZ2 SUB2 STA2 ( [lim* pos*] ; pos-cb<-cell )
|
||||||
INC2r INC2r GTH2kr STHr ?&loop
|
INC2r INC2r GTH2kr STHr ?&loop ( [lim* pos+2*] )
|
||||||
POP2r POP2r
|
POP2r POP2r
|
||||||
#01 .dirty STZ
|
#01 .dirty STZ
|
||||||
draw-cursor BRK
|
!draw-cursor
|
||||||
|
|
||||||
( bits: Rx xx FF BB )
|
( bits: Rx xx FF BB )
|
||||||
( - R: reversed [0=normal, 1=reversed] )
|
( - R: reversed [0=normal, 1=reversed] )
|
||||||
|
|
Loading…
Reference in New Issue