prepare for absolute cursor refactor

This commit is contained in:
~d6 2022-02-18 00:34:42 -05:00
parent 895c305cbe
commit ee91fc7949
1 changed files with 12 additions and 15 deletions

View File

@ -189,7 +189,7 @@
;draw-statusbar JSR2 ;draw-cursor JSR2
,&skip JMP
&next-line #0000 ;cursor/col STA2
;cursor/row LDA2 INC2 ;cursor/row STA2
;cursor/row LDA2k INC2 SWP2 STA2
;ensure-visible-cursor JSR2
;draw-cursor JSR2
&skip BRK
@ -203,20 +203,20 @@
&skip BRK
@up ( -> )
;cur-line-num JSR2 #0000 EQU2 ,&done JCN
;cursor/row LDA2 #0001 LTH2 ,&screen-up JCN
;cursor/row LDA2 #0001 SUB2 ;cursor/row STA2
;cur-abs-row JSR2 #0000 EQU2 ,&done JCN
;cur-row JSR2 #0001 LTH2 ,&screen-up JCN
;cursor/row LDA2k #0001 SUB2 SWP2 STA2
;draw-statusbar JSR2
;draw-cursor JSR2 BRK
&screen-up
;cur-line-num JSR2 #0001 SUB2
;cur-abs-row JSR2 #0001 SUB2
;jump-to-line JSR2
;draw-all JSR2
&done BRK
@down ( -> )
;cur-abs-row JSR2 ;last-abs-row JSR2 EQU2 ,&done JCN
;cursor/row LDA2 INC2 ;cursor/row STA2
;cursor/row LDA2k INC2 SWP2 STA2
;ensure-visible-cursor JSR2
;draw-statusbar JSR2
;draw-cursor JSR2 BRK
@ -264,7 +264,7 @@
@newline ( c^ -> )
#0a ;cur-pos JSR2 ;shift-right JSR2
#0000 ;cursor/col STA2
;cursor/row LDA2 INC2 ;cursor/row STA2
;cursor/row LDA2k INC2 SWP2 STA2
;buffer/line-count LDA2k INC2 SWP2 STA2
;ensure-visible-cursor JSR2
;draw-all JSR2
@ -290,7 +290,7 @@
;cur-col JSR2 #0001 SUB2 ;cursor/col STA2
,&finish JMP
&prev-line
;cur-line-num JSR2 #0001 SUB2
;cur-abs-row JSR2 #0001 SUB2
;jump-to-line JSR2 ( TODO: fix weird eof behavior )
;cur-len JSR2 ;cursor/col STA2
;buffer/line-count LDA2k #0001 SUB2 SWP2 STA2
@ -358,8 +358,8 @@
JMP2r
@ensure-visible-cursor
;cursor/row LDA2 ;term/rows LDA2 LTH2 ,&noop JCN
;cur-line-num JSR2 ;jump-to-line JSR2
;cur-row JSR2 ;term/rows LDA2 LTH2 ,&noop JCN
;cur-abs-row JSR2 ;jump-to-line JSR2
;draw-all JSR2
&noop JMP2r
@ -549,16 +549,13 @@
&not-found ;rel-line-error ;error! JMP2
@cur-line ( -> s* )
;cursor/row LDA2 ;rel-line JSR2 JMP2r
@cur-line-num ( -> n* )
;cursor/row LDA2 ;buffer/line-offset LDA2 ADD2 JMP2r
;cur-row JSR2 ;rel-line JSR2 JMP2r
@cur-pos ( -> s* )
;cur-line JSR2 ;cur-col JSR2 ADD2 JMP2r
@cur-abs-row ( -> n* )
;buffer/line-offset LDA2 ;cursor/row LDA2 ADD2 JMP2r
;cur-row JSR2 ;buffer/line-offset LDA2 ADD2 JMP2r
@last-abs-row ( -> n* )
;buffer/line-count LDA2 #0001 SUB2 JMP2r