display line counts and cursor position
This commit is contained in:
parent
28704a9bfc
commit
652dac7830
38
femto.tal
38
femto.tal
|
@ -168,17 +168,20 @@
|
||||||
|
|
||||||
@bol
|
@bol
|
||||||
#00 ;cursor/col STA
|
#00 ;cursor/col STA
|
||||||
|
;draw-statusbar JSR2
|
||||||
;draw-cursor JSR2 BRK
|
;draw-cursor JSR2 BRK
|
||||||
|
|
||||||
( FIXME: handle long lines )
|
( FIXME: handle long lines )
|
||||||
@eol
|
@eol
|
||||||
;cur-line JSR2 ;line-len JSR2 NIP ;cursor/col STA
|
;cur-line JSR2 ;line-len JSR2 NIP ;cursor/col STA
|
||||||
|
;draw-statusbar JSR2
|
||||||
;draw-cursor JSR2 BRK
|
;draw-cursor JSR2 BRK
|
||||||
|
|
||||||
( FIXME: handle long lines )
|
( FIXME: handle long lines )
|
||||||
@forward
|
@forward
|
||||||
;cursor/col LDA pen-col GTH ,&skip JCN
|
;cursor/col LDA pen-col GTH ,&skip JCN
|
||||||
;cursor/col LDA #01 ADD ;cursor/col STA
|
;cursor/col LDA #01 ADD ;cursor/col STA
|
||||||
|
;draw-statusbar JSR2
|
||||||
;draw-cursor JSR2
|
;draw-cursor JSR2
|
||||||
&skip BRK
|
&skip BRK
|
||||||
|
|
||||||
|
@ -186,12 +189,14 @@
|
||||||
@back
|
@back
|
||||||
;cursor/col LDA #01 LTH ,&skip JCN
|
;cursor/col LDA #01 LTH ,&skip JCN
|
||||||
;cursor/col LDA #01 SUB ;cursor/col STA
|
;cursor/col LDA #01 SUB ;cursor/col STA
|
||||||
|
;draw-statusbar JSR2
|
||||||
;draw-cursor JSR2
|
;draw-cursor JSR2
|
||||||
&skip BRK
|
&skip BRK
|
||||||
|
|
||||||
@up
|
@up
|
||||||
;cursor/row LDA #01 LTH ,&screen-up JCN
|
;cursor/row LDA #01 LTH ,&screen-up JCN
|
||||||
;cursor/row LDA #01 SUB ;cursor/row STA
|
;cursor/row LDA #01 SUB ;cursor/row STA
|
||||||
|
;draw-statusbar JSR2
|
||||||
;draw-cursor JSR2 BRK
|
;draw-cursor JSR2 BRK
|
||||||
&screen-up
|
&screen-up
|
||||||
;buffer/offset LDA2 DUP2 ;buffer/data EQU2 ,&done JCN
|
;buffer/offset LDA2 DUP2 ;buffer/data EQU2 ,&done JCN
|
||||||
|
@ -199,18 +204,21 @@
|
||||||
&loop DUP2 ;buffer/data EQU2 ,&complete JCN
|
&loop DUP2 ;buffer/data EQU2 ,&complete JCN
|
||||||
#0001 SUB2 LDAk #0a NEQ ,&loop JCN
|
#0001 SUB2 LDAk #0a NEQ ,&loop JCN
|
||||||
INC2
|
INC2
|
||||||
&complete ;buffer/offset STA2 ;draw-all JSR2 BRK
|
&complete ;buffer/offset STA2
|
||||||
|
;buffer/line-offset LDA2k #0001 SUB2 SWP2 STA2
|
||||||
|
;draw-all JSR2 BRK
|
||||||
&done POP2 BRK
|
&done POP2 BRK
|
||||||
|
|
||||||
( FIXME: need to handle 'end of buffer' stuff )
|
( FIXME: need to handle 'end of buffer' stuff )
|
||||||
@down
|
@down
|
||||||
;cursor/row LDA pen-line GTH ,&screen-down JCN
|
;cursor/row LDA pen-line GTH ,&screen-down JCN
|
||||||
;cursor/row LDA #01 ADD ;cursor/row STA
|
;cursor/row LDA INC ;cursor/row STA
|
||||||
|
;draw-statusbar JSR2
|
||||||
;draw-cursor JSR2 BRK
|
;draw-cursor JSR2 BRK
|
||||||
&screen-down
|
&screen-down
|
||||||
#00 ;rel-line JSR2 ;line-len JSR2 INC2 ( add 1 for line ending )
|
#00 ;rel-line JSR2 ;line-len JSR2 INC2 ( add 1 for line ending )
|
||||||
;buffer/offset LDA2 ADD2
|
;buffer/offset LDA2 ADD2 ;buffer/offset STA2
|
||||||
;buffer/offset STA2
|
;buffer/line-offset LDA2k INC2 SWP2 STA2
|
||||||
;draw-all JSR2
|
;draw-all JSR2
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
@ -234,6 +242,7 @@
|
||||||
;draw-all JSR2
|
;draw-all JSR2
|
||||||
&skip BRK
|
&skip BRK
|
||||||
|
|
||||||
|
( TODO: handle last line )
|
||||||
@newline ( c^ -> )
|
@newline ( c^ -> )
|
||||||
#0a ;cur-pos JSR2 ;shift-right JSR2
|
#0a ;cur-pos JSR2 ;shift-right JSR2
|
||||||
#00 ;cursor/col STA
|
#00 ;cursor/col STA
|
||||||
|
@ -242,6 +251,7 @@
|
||||||
;draw-all JSR2
|
;draw-all JSR2
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
( TODO: handle first line )
|
||||||
@backspace ( -> )
|
@backspace ( -> )
|
||||||
;cur-pos JSR2 ;buffer/data EQU2 ,&skip JCN
|
;cur-pos JSR2 ;buffer/data EQU2 ,&skip JCN
|
||||||
;cursor/col LDA #00 EQU ,&prev-line JCN
|
;cursor/col LDA #00 EQU ,&prev-line JCN
|
||||||
|
@ -273,6 +283,7 @@
|
||||||
@goto-end ( FIXME )
|
@goto-end ( FIXME )
|
||||||
@goto-start ( -> )
|
@goto-start ( -> )
|
||||||
;buffer/data ;buffer/offset STA2
|
;buffer/data ;buffer/offset STA2
|
||||||
|
#0000 ;buffer/line-offset STA2
|
||||||
#00 ;cursor/col STA
|
#00 ;cursor/col STA
|
||||||
#00 ;cursor/row STA
|
#00 ;cursor/row STA
|
||||||
;draw-all JSR2
|
;draw-all JSR2
|
||||||
|
@ -295,7 +306,8 @@
|
||||||
&late ( n n-rows/2 lines-rows )
|
&late ( n n-rows/2 lines-rows )
|
||||||
NIP2 ,&finish JCN
|
NIP2 ,&finish JCN
|
||||||
&finish ( n o )
|
&finish ( n o )
|
||||||
SUB2k STH2
|
SUB2k STH2 DUP2
|
||||||
|
;buffer/line-offset STA2
|
||||||
;abs-line JSR2 ;buffer/offset STA2
|
;abs-line JSR2 ;buffer/offset STA2
|
||||||
#00 ;cursor/col STA
|
#00 ;cursor/col STA
|
||||||
POP2 STH2r NIP ;cursor/row STA
|
POP2 STH2r NIP ;cursor/row STA
|
||||||
|
@ -366,11 +378,18 @@
|
||||||
;messages/saved ;print JSR2
|
;messages/saved ;print JSR2
|
||||||
;filename ;print JSR2
|
;filename ;print JSR2
|
||||||
#20 emit
|
#20 emit
|
||||||
|
LIT '[ emit
|
||||||
;buffer/limit LDA2 ;buffer/data SUB2 ;emit-dec2 JSR2
|
;buffer/limit LDA2 ;buffer/data SUB2 ;emit-dec2 JSR2
|
||||||
;messages/bytes ;print JSR2
|
;messages/bytes ;print JSR2
|
||||||
#20 emit
|
#20 emit
|
||||||
;buffer/line-count LDA2 ;emit-dec2 JSR2
|
;buffer/line-count LDA2 ;emit-dec2 JSR2
|
||||||
;messages/lines ;print JSR2
|
;messages/lines ;print JSR2
|
||||||
|
#20 emit
|
||||||
|
LIT '( emit
|
||||||
|
;cursor/col LDA ;emit-dec JSR2
|
||||||
|
LIT ', emit
|
||||||
|
;cur-abs-row JSR2 ;emit-dec2 JSR2
|
||||||
|
LIT ') emit
|
||||||
|
|
||||||
ansi LIT '0 emit LIT 'm emit
|
ansi LIT '0 emit LIT 'm emit
|
||||||
JMP2r
|
JMP2r
|
||||||
|
@ -383,7 +402,6 @@
|
||||||
|
|
||||||
@draw-all
|
@draw-all
|
||||||
;term-erase-all JSR2
|
;term-erase-all JSR2
|
||||||
;draw-statusbar JSR2
|
|
||||||
#00 #00 ;term-move-cursor JSR2
|
#00 #00 ;term-move-cursor JSR2
|
||||||
#00 STH
|
#00 STH
|
||||||
;buffer/offset LDA2
|
;buffer/offset LDA2
|
||||||
|
@ -394,6 +412,7 @@
|
||||||
&eol INCr STHkr last-line ( #17 ) GTH ,&eof JCN
|
&eol INCr STHkr last-line ( #17 ) GTH ,&eof JCN
|
||||||
cr nl INC2 ,&loop JMP
|
cr nl INC2 ,&loop JMP
|
||||||
&eof POP2 POPr
|
&eof POP2 POPr
|
||||||
|
;draw-statusbar JSR2
|
||||||
;draw-cursor JSR2
|
;draw-cursor JSR2
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
|
@ -453,6 +472,9 @@
|
||||||
@cur-pos ( -> s* )
|
@cur-pos ( -> s* )
|
||||||
;cur-line JSR2 #00 ;get-col JSR2 ADD2 JMP2r
|
;cur-line JSR2 #00 ;get-col JSR2 ADD2 JMP2r
|
||||||
|
|
||||||
|
@cur-abs-row ( -> n* )
|
||||||
|
;buffer/line-offset LDA2 #00 ;cursor/row LDA ADD2 JMP2r
|
||||||
|
|
||||||
@shift-right ( c^ addr* -> )
|
@shift-right ( c^ addr* -> )
|
||||||
ROT STH ( addr [prev^] )
|
ROT STH ( addr [prev^] )
|
||||||
;buffer/limit LDA2 ( addr limit [prev^] )
|
;buffer/limit LDA2 ( addr limit [prev^] )
|
||||||
|
@ -539,8 +561,8 @@
|
||||||
&do1 NIP ;emit-digit JSR2 JMP2r
|
&do1 NIP ;emit-digit JSR2 JMP2r
|
||||||
|
|
||||||
@messages [ &input-error "input 20 "error 00
|
@messages [ &input-error "input 20 "error 00
|
||||||
&bytes 20 "bytes 00
|
&bytes 20 "bytes, 00
|
||||||
&lines 20 "lines 00
|
&lines 20 "lines] 00
|
||||||
&saved "-- 20 00
|
&saved "-- 20 00
|
||||||
&unsaved "** 20 00 ]
|
&unsaved "** 20 00 ]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue