cursor/row refactors: prepare for absolute row addressing
This commit is contained in:
parent
27e5d42652
commit
f48bce6be3
59
femto.tal
59
femto.tal
|
@ -69,6 +69,7 @@
|
||||||
( startup )
|
( startup )
|
||||||
|0100 ;startup JMP2
|
|0100 ;startup JMP2
|
||||||
|
|
||||||
|
( code to run on startup )
|
||||||
@startup ;read-filename .Console/vector DEO2 BRK
|
@startup ;read-filename .Console/vector DEO2 BRK
|
||||||
|
|
||||||
( ERROR HANDLING )
|
( ERROR HANDLING )
|
||||||
|
@ -187,7 +188,7 @@
|
||||||
;draw-statusbar JSR2 ;draw-cursor JSR2
|
;draw-statusbar JSR2 ;draw-cursor JSR2
|
||||||
,&skip JMP
|
,&skip JMP
|
||||||
&next-line #0000 ;cursor/col STA2
|
&next-line #0000 ;cursor/col STA2
|
||||||
;cursor/row LDA2k INC2 SWP2 STA2
|
;inc-row JSR2
|
||||||
;ensure-visible-cursor JSR2
|
;ensure-visible-cursor JSR2
|
||||||
;draw-cursor JSR2
|
;draw-cursor JSR2
|
||||||
&skip BRK
|
&skip BRK
|
||||||
|
@ -202,8 +203,8 @@
|
||||||
|
|
||||||
@up ( -> )
|
@up ( -> )
|
||||||
;cur-abs-row JSR2 #0000 EQU2 ,&done JCN
|
;cur-abs-row JSR2 #0000 EQU2 ,&done JCN
|
||||||
;cur-row JSR2 #0001 LTH2 ,&screen-up JCN
|
;cur-rel-row JSR2 #0001 LTH2 ,&screen-up JCN
|
||||||
;cursor/row LDA2k #0001 SUB2 SWP2 STA2
|
;dec-row JSR2
|
||||||
;draw-statusbar JSR2
|
;draw-statusbar JSR2
|
||||||
;draw-cursor JSR2 BRK
|
;draw-cursor JSR2 BRK
|
||||||
&screen-up
|
&screen-up
|
||||||
|
@ -214,7 +215,7 @@
|
||||||
|
|
||||||
@down ( -> )
|
@down ( -> )
|
||||||
;cur-abs-row JSR2 ;last-abs-row JSR2 EQU2 ,&done JCN
|
;cur-abs-row JSR2 ;last-abs-row JSR2 EQU2 ,&done JCN
|
||||||
;cursor/row LDA2k INC2 SWP2 STA2
|
;inc-row JSR2
|
||||||
;ensure-visible-cursor JSR2
|
;ensure-visible-cursor JSR2
|
||||||
;draw-statusbar JSR2
|
;draw-statusbar JSR2
|
||||||
;draw-cursor JSR2 BRK
|
;draw-cursor JSR2 BRK
|
||||||
|
@ -229,14 +230,12 @@
|
||||||
;buffer/line-offset STA2
|
;buffer/line-offset STA2
|
||||||
;ensure-visible-cursor JSR2
|
;ensure-visible-cursor JSR2
|
||||||
;draw-all JSR2 BRK
|
;draw-all JSR2 BRK
|
||||||
&near-bof POP2 POP2 &xyz
|
&near-bof POP2 POP2
|
||||||
;buffer/data ;buffer/offset STA2
|
;zero-row JSR2
|
||||||
#0000 ;buffer/line-offset STA2
|
#0000 ;cursor/col STA2
|
||||||
#0000 ;cursor/row STA2
|
|
||||||
#0000 ;cursor/col STA2
|
|
||||||
;draw-all JSR2 BRK
|
;draw-all JSR2 BRK
|
||||||
&at-bof
|
&at-bof
|
||||||
#0000 ;cursor/row STA2
|
;zero-row JSR2
|
||||||
#0000 ;cursor/col STA2
|
#0000 ;cursor/col STA2
|
||||||
;draw-cursor JSR2 BRK
|
;draw-cursor JSR2 BRK
|
||||||
|
|
||||||
|
@ -250,8 +249,8 @@
|
||||||
;draw-all JSR2 BRK
|
;draw-all JSR2 BRK
|
||||||
&near-eof
|
&near-eof
|
||||||
;buffer/line-count LDA2
|
;buffer/line-count LDA2
|
||||||
;buffer/line-offset LDA2 INC2
|
;buffer/line-offset LDA2 INC2 SUB2
|
||||||
SUB2 ;cursor/row STA2
|
;cursor/row STA2
|
||||||
;cur-len JSR2 ;cursor/col STA2
|
;cur-len JSR2 ;cursor/col STA2
|
||||||
;draw-cursor JSR2 BRK
|
;draw-cursor JSR2 BRK
|
||||||
|
|
||||||
|
@ -282,7 +281,7 @@
|
||||||
@newline ( c^ -> )
|
@newline ( c^ -> )
|
||||||
#0a ;cur-pos JSR2 ;shift-right JSR2
|
#0a ;cur-pos JSR2 ;shift-right JSR2
|
||||||
#0000 ;cursor/col STA2
|
#0000 ;cursor/col STA2
|
||||||
;cursor/row LDA2k INC2 SWP2 STA2
|
;inc-row JSR2
|
||||||
;buffer/line-count LDA2k INC2 SWP2 STA2
|
;buffer/line-count LDA2k INC2 SWP2 STA2
|
||||||
;ensure-visible-cursor JSR2
|
;ensure-visible-cursor JSR2
|
||||||
;draw-all JSR2
|
;draw-all JSR2
|
||||||
|
@ -344,10 +343,8 @@
|
||||||
;draw-all JSR2 BRK
|
;draw-all JSR2 BRK
|
||||||
|
|
||||||
@goto-start ( -> )
|
@goto-start ( -> )
|
||||||
;buffer/data ;buffer/offset STA2
|
;zero-row JSR2
|
||||||
#0000 ;buffer/line-offset STA2
|
|
||||||
#0000 ;cursor/col STA2
|
#0000 ;cursor/col STA2
|
||||||
#0000 ;cursor/row STA2
|
|
||||||
;draw-all JSR2
|
;draw-all JSR2
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
@ -376,7 +373,7 @@
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
@ensure-visible-cursor
|
@ensure-visible-cursor
|
||||||
;cur-row JSR2 ;term/rows LDA2 LTH2 ,&noop JCN
|
;cur-rel-row JSR2 ;term/rows LDA2 LTH2 ,&noop JCN
|
||||||
;cur-abs-row JSR2 ;jump-to-line JSR2
|
;cur-abs-row JSR2 ;jump-to-line JSR2
|
||||||
;draw-all JSR2
|
;draw-all JSR2
|
||||||
&noop JMP2r
|
&noop JMP2r
|
||||||
|
@ -464,7 +461,7 @@
|
||||||
|
|
||||||
@draw-cursor ( -> )
|
@draw-cursor ( -> )
|
||||||
;cur-w-col JSR2 ;term/lmargin LDA2 ADD2
|
;cur-w-col JSR2 ;term/lmargin LDA2 ADD2
|
||||||
;cur-row JSR2
|
;cur-rel-row JSR2
|
||||||
;term-move-cursor JMP2 ( JSR2 JMP2r )
|
;term-move-cursor JMP2 ( JSR2 JMP2r )
|
||||||
|
|
||||||
@draw-statusbar ( -> )
|
@draw-statusbar ( -> )
|
||||||
|
@ -533,7 +530,7 @@
|
||||||
;term/lmargin LDA2 INC2 ,&x STR2
|
;term/lmargin LDA2 INC2 ,&x STR2
|
||||||
( TODO: use this for cursor-line highlighting and long line support )
|
( TODO: use this for cursor-line highlighting and long line support )
|
||||||
( STH2kr ;cursor/row LDA2 INC2 NEQ2 ,&loop JCN
|
( STH2kr ;cursor/row LDA2 INC2 NEQ2 ,&loop JCN
|
||||||
;emit-color-reverse JSR2 )
|
;emit-color-reverse JSR2 )
|
||||||
&loop ( offset [k line-offset] )
|
&loop ( offset [k line-offset] )
|
||||||
LDAk #00 EQU ,&eof JCN
|
LDAk #00 EQU ,&eof JCN
|
||||||
LDAk #0a EQU ,&eol JCN
|
LDAk #0a EQU ,&eol JCN
|
||||||
|
@ -638,13 +635,13 @@
|
||||||
¬-found ;rel-line-error ;error! JMP2
|
¬-found ;rel-line-error ;error! JMP2
|
||||||
|
|
||||||
@cur-line ( -> s* )
|
@cur-line ( -> s* )
|
||||||
;cur-row JSR2 ;rel-line JMP2 ( JSR2 JMP2r )
|
;cur-rel-row JSR2 ;rel-line JMP2 ( JSR2 JMP2r )
|
||||||
|
|
||||||
@cur-pos ( -> s* )
|
@cur-pos ( -> s* )
|
||||||
;cur-line JSR2 ;cur-col JSR2 ADD2 JMP2r
|
;cur-line JSR2 ;cur-col JSR2 ADD2 JMP2r
|
||||||
|
|
||||||
@cur-abs-row ( -> n* )
|
@cur-abs-row ( -> n* )
|
||||||
;cur-row JSR2 ;buffer/line-offset LDA2 ADD2 JMP2r
|
;cur-rel-row JSR2 ;buffer/line-offset LDA2 ADD2 JMP2r
|
||||||
|
|
||||||
@last-abs-row ( -> n* )
|
@last-abs-row ( -> n* )
|
||||||
;buffer/line-count LDA2 #0001 SUB2 JMP2r
|
;buffer/line-count LDA2 #0001 SUB2 JMP2r
|
||||||
|
@ -688,9 +685,27 @@
|
||||||
&next LDAk #09 EQU ,&tabs JCN INC2 INC2r ,&loop JMP
|
&next LDAk #09 EQU ,&tabs JCN INC2 INC2r ,&loop JMP
|
||||||
&tabs INC2 ;config/tab-width LDA2 STH2 ADD2r ,&loop JMP
|
&tabs INC2 ;config/tab-width LDA2 STH2 ADD2r ,&loop JMP
|
||||||
|
|
||||||
@cur-row ( -> row* )
|
@cur-rel-row ( -> row* )
|
||||||
;cursor/row LDA2 JMP2r
|
;cursor/row LDA2 JMP2r
|
||||||
|
|
||||||
|
@set-abs-row ( n* -> )
|
||||||
|
;buffer/line-offset LDA2 SUB2 ;cursor/row STA2 JMP2r
|
||||||
|
|
||||||
|
@set-rel-row ( n* -> )
|
||||||
|
;cursor/row STA2 JMP2r
|
||||||
|
|
||||||
|
@zero-row ( -> )
|
||||||
|
;buffer/data ;buffer/offset STA2
|
||||||
|
#0000 ;buffer/line-offset STA2
|
||||||
|
#0000 ;cursor/row STA2
|
||||||
|
JMP2r
|
||||||
|
|
||||||
|
@inc-row ( -> )
|
||||||
|
;cursor/row LDA2k INC2 SWP2 STA2 JMP2r
|
||||||
|
|
||||||
|
@dec-row ( -> )
|
||||||
|
;cursor/row LDA2k #0001 SUB2 SWP2 STA2
|
||||||
|
|
||||||
@last-pos ( -> addr* )
|
@last-pos ( -> addr* )
|
||||||
;buffer/limit LDA2 #0001 SUB2 JMP2r
|
;buffer/limit LDA2 #0001 SUB2 JMP2r
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue