clean up, use insert-cell

This commit is contained in:
~d6 2023-02-11 22:34:06 -05:00
parent 56200a1c59
commit 675af45ff3
1 changed files with 56 additions and 63 deletions

View File

@ -156,7 +156,7 @@
update-tint
( set initial modes )
#01 .irm STZ ( insert and move right )
#00 .irm STZ ( insert and move right )
#01 .awm STZ ( wrap at margin )
#01 .tcem STZ ( show cursor )
#00 .paste STZ ( bracketed paste is off )
@ -179,7 +179,7 @@
#01 .visual-bell STZ
( set to 01 to enable debug log )
#01 .debug STZ
#00 .debug STZ
.debug LDZ ?&continue BRK &continue
#99 #010e DEO
@ -781,22 +781,22 @@
&skip POP2 POP2 JMP2r ( )
@exec-move-row ( c^ -> BRK )
POP
POP ( )
#0001 read-arg-1 dec-floor ( row )
.cur-x LDZ2 ( col )
goto BRK
goto BRK ( )
@exec-move-col ( c^ -> BRK )
POP
POP ( )
.cur-y LDZ2 ( row )
#0001 read-arg-1 dec-floor ( col )
goto BRK
goto BRK ( )
@exec-move ( c^ -> BRK )
POP
POP ( )
#0001 read-arg-1 dec-floor ( row )
#0001 read-arg-2 dec-floor ( col )
goto BRK
goto BRK ( )
@dec-floor ( x* -> x==0 ? 0* : x-1* )
ORAk ?&sub JMP2r &sub #0001 SUB2 JMP2r
@ -848,8 +848,7 @@
.Console/r DEI
DUP debug-read
DUP ?&ok POP BRK
&ok ( #42 .tint STZ )
!read
&ok !read
@read ( c^ -> BRK )
DUP #20 LTH ?read-ctrl
@ -901,13 +900,10 @@
.cur-y LDZ2 .max-y LDZ2 EQU2 JMP2r
@read-nl ( 0a -> BRK )
POP clear-cursor
at-max-y ?scroll down BRK
POP clear-cursor at-max-y ?scroll down BRK
@read-printable ( c^ -> BRK )
.tint LDZ SWP DUP2 cur-addr STA2
draw-cell
forward BRK
.tint LDZ SWP DUP2 insert-cell draw-cell forward BRK
@goto ( y* x* -> )
clear-cursor
@ -945,16 +941,13 @@
@down ( -> )
#0001 !down-n
@insert ( c^ -> )
.attr LDZ SWP !insert-cell
@insert-cell ( cell* -> )
.irm LDZ #00 EQU ?&replace ( cell* )
eol-addr #0001 SUB2 ( cell* last=eol-1* )
cur-addr ( cell* last* cur* )
&loop ( cell* last* pos* )
LDA2k OVR2 INC2 STA2 ( cell* last* pos* ; pos+1<-pos )
INC2 GTH2k ?&loop ( cell* last pos+1* )
cur-addr ( cell* lim* )
eol-addr #0002 SUB2 ( cell* lim* last=eol-2* )
&loop ( cell* lim* pos* )
STH2k #0002 SUB2 LDA2k ( cell* lim* pos-2* cell* [pos*] )
STH2r STA2 LTH2k ?&loop ( cell* lim* pos-2* )
POP2 POP2 ( cell* )
&replace ( cell* )
cur-addr STA2 JMP2r ( )