long line support 50% working

This commit is contained in:
~d6 2022-03-04 01:47:11 -05:00
parent 52965adb5f
commit 3fc2c9f16a
1 changed files with 31 additions and 13 deletions

View File

@ -400,7 +400,7 @@
BRK BRK
@move-to-message-line ( -> ) @move-to-message-line ( -> )
#0002 ;term/rows LDA2 #0002 ADD2 ;term-move-cursor JSR2 JMP2r #0002 ;term/rows LDA2 #0002 ADD2 ;term-move-cursor JMP2 ( JSR2 JMP2r )
( TODO: filename prmopt ) ( TODO: filename prmopt )
@save ( -> ) @save ( -> )
@ -466,7 +466,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-row JSR2
;term-move-cursor JSR2 JMP2r ;term-move-cursor JMP2 ( JSR2 JMP2r )
@draw-statusbar ( -> ) @draw-statusbar ( -> )
#0000 ;term/rows LDA2 ;term-move-cursor JSR2 #0000 ;term/rows LDA2 ;term-move-cursor JSR2
@ -510,24 +510,42 @@
&loop ORAk ,&next JCN POP2 POP2r JMP2r &loop ORAk ,&next JCN POP2 POP2r JMP2r
&next DEOkr INC2 ,&loop JMP &next DEOkr INC2 ,&loop JMP
@emit-red ( -> )
ansi LIT '3 emit LIT '1 emit LIT 'm emit JMP2r
@emit-reset ( -> )
ansi LIT '0 emit LIT 'm emit JMP2r
@emit-red-dollar ( -> )
;emit-red JSR2 LIT '$ emit ;emit-reset JMP2
@draw-all ( -> ) @draw-all ( -> )
;term-erase-all JSR2 ;term-erase-all JSR2
#0000 #0000 ;term-move-cursor JSR2 #0000 #0000 ;term-move-cursor JSR2
;buffer/line-offset LDA2 STH2 LIT2r 0001 ( [k line-offset] ) ;buffer/line-offset LDA2 STH2 LIT2r 0001 ( [k line-offset] )
ADD2kr STH2r ;draw-linenum JSR2 ADD2kr STH2r ;draw-linenum JSR2
;buffer/offset LDA2 ;buffer/offset LDA2
&loop ;term/lmargin LDA2 INC2 ,&x STR2
&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
,&x LDR2 ;term/cols LDA2
LTH2k ,&ok JCN
GTH2 ,&skip JCN
;emit-red-dollar JSR2 ,&x LDR2 INC2 ,&x STR2
&skip INC2 ,&loop JMP
&ok POP2 POP2
LDAk #09 EQU ,&do-tab JCN LDAk #09 EQU ,&do-tab JCN
LDAk emit INC2 ,&loop JMP LDAk emit INC2 ,&x LDR2 INC2 ,&x STR2 ,&loop JMP
&do-tab ;emit-tab JSR2 INC2 ,&loop JMP &do-tab ;emit-tab JSR2 INC2 ;config/tab-width LDA2 ,&x LDR2 ADD2 ,&x STR2 ,&loop JMP
[ &x $2 ]
&eol INC2r STH2kr ;term/rows LDA2 GTH2 ,&done JCN &eol INC2r STH2kr ;term/rows LDA2 GTH2 ,&done JCN
cr nl INC2 cr nl INC2
ADD2kr STH2r ;draw-linenum JSR2 ADD2kr STH2r ;draw-linenum JSR2
;term/lmargin LDA2 INC2 ,&x STR2
,&loop JMP ,&loop JMP
&eof &eof
ansi LIT '3 emit LIT '1 emit LIT 'm emit ;emit-red JSR2
&eof-loop &eof-loop
STH2kr ;term/rows LDA2 GTH2 ,&done JCN STH2kr ;term/rows LDA2 GTH2 ,&done JCN
cr nl cr nl
@ -535,7 +553,7 @@
LIT '~ emit INC2r LIT '~ emit INC2r
,&eof-loop JMP ,&eof-loop JMP
&done POP2 POP2r POP2r &done POP2 POP2r POP2r
ansi LIT '0 emit LIT 'm emit ;emit-reset JSR2
;draw-statusbar JSR2 ;draw-statusbar JSR2
;draw-cursor JSR2 ;draw-cursor JSR2
JMP2r JMP2r
@ -554,13 +572,13 @@
&eof POP2 JMP2r &eof POP2 JMP2r
@cur-len ( -> n* ) @cur-len ( -> n* )
;cur-line JSR2 ;line-len JSR2 JMP2r ;cur-line JSR2 ;line-len JMP2 ( JSR2 JMP2r )
@cur-last ( -> n* ) @cur-last ( -> n* )
;cur-line JSR2 ;line-len JSR2 #0001 SUB2 JMP2r ;cur-line JSR2 ;line-len JSR2 #0001 SUB2 JMP2r
@cur-width ( -> n* ) @cur-width ( -> n* )
;cur-line JSR2 ;line-width JSR2 JMP2r ;cur-line JSR2 ;line-width JMP2 ( JSR2 JMP2r )
@cur-w-last ( -> n* ) @cur-w-last ( -> n* )
;cur-line JSR2 ;line-width JSR2 #0001 SUB2 JMP2r ;cur-line JSR2 ;line-width JSR2 #0001 SUB2 JMP2r
@ -610,7 +628,7 @@
&not-found ;rel-line-error ;error! JMP2 &not-found ;rel-line-error ;error! JMP2
@cur-line ( -> s* ) @cur-line ( -> s* )
;cur-row JSR2 ;rel-line JSR2 JMP2r ;cur-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
@ -650,7 +668,7 @@
JMP2r JMP2r
@cur-col ( -> col* ) @cur-col ( -> col* )
;cursor/col LDA2 ;cur-len JSR2 ;min2 JSR2 JMP2r ;cursor/col LDA2 ;cur-len JSR2 ;min2 JMP2 ( JSR2 JMP2r )
@cur-w-col ( -> col* ) @cur-w-col ( -> col* )
LIT2r 0000 ( [0] ) LIT2r 0000 ( [0] )
@ -696,7 +714,7 @@
,&do1 JMP ,&do1 JMP
&do3 #64 ;mod-div JSR2 ;emit-digit JSR2 &do3 #64 ;mod-div JSR2 ;emit-digit JSR2
&do2 #0a ;mod-div JSR2 ;emit-digit JSR2 &do2 #0a ;mod-div JSR2 ;emit-digit JSR2
&do1 ;emit-digit JSR2 JMP2r &do1 ;emit-digit JMP2 ( JSR2 JMP2r )
@emit-dec2 ( n* -> ) @emit-dec2 ( n* -> )
DUP2 #270f GTH2 ,&do5 JCN DUP2 #270f GTH2 ,&do5 JCN
@ -708,7 +726,7 @@
&do4 #03e8 ;mod-div2 JSR2 NIP ;emit-digit JSR2 &do4 #03e8 ;mod-div2 JSR2 NIP ;emit-digit JSR2
&do3 #0064 ;mod-div2 JSR2 NIP ;emit-digit JSR2 &do3 #0064 ;mod-div2 JSR2 NIP ;emit-digit JSR2
&do2 #000a ;mod-div2 JSR2 NIP ;emit-digit JSR2 &do2 #000a ;mod-div2 JSR2 NIP ;emit-digit JSR2
&do1 NIP ;emit-digit JSR2 JMP2r &do1 NIP ;emit-digit JMP2 ( JSR2 JMP2r )
@emit-dec2-pad ( n* -> ) @emit-dec2-pad ( n* -> )
LIT2r 2018 ( preload #20 .Console/write into rst ) LIT2r 2018 ( preload #20 .Console/write into rst )