set up zero page, start cleaning up

This commit is contained in:
~d6 2022-03-07 12:56:52 -05:00
parent f48bce6be3
commit 37936eda77
1 changed files with 16 additions and 15 deletions

View File

@ -66,6 +66,9 @@
%quit! { #01 .System/halt DEO } %quit! { #01 .System/halt DEO }
( zero page )
|0000
( startup ) ( startup )
|0100 ;startup JMP2 |0100 ;startup JMP2
@ -100,7 +103,7 @@
JMP2r JMP2r
@setup-terminal-size ( -> ) @setup-terminal-size ( -> )
( ;setup-80x24 JSR2 JMP2r ) ( ;setup-80x24 JMP2 )
#03e7 #03e7 ;term-move-cursor JSR2 #03e7 #03e7 ;term-move-cursor JSR2
;term-get-cursor-position JSR2 ;term-get-cursor-position JSR2
;tmp/data ;tmp/pos STA2 ;tmp/data ;tmp/pos STA2
@ -248,9 +251,7 @@
;ensure-visible-cursor JSR2 ;ensure-visible-cursor JSR2
;draw-all JSR2 BRK ;draw-all JSR2 BRK
&near-eof &near-eof
;buffer/line-count LDA2 ;buffer/line-count LDA2 #0001 SUB2 ;set-abs-row JSR2
;buffer/line-offset LDA2 INC2 SUB2
;cursor/row STA2
;cur-len JSR2 ;cursor/col STA2 ;cur-len JSR2 ;cursor/col STA2
;draw-cursor JSR2 BRK ;draw-cursor JSR2 BRK
@ -396,7 +397,7 @@
BRK BRK
@move-to-message-line ( -> ) @move-to-message-line ( -> )
#0002 ;term/rows LDA2 #0002 ADD2 ;term-move-cursor JMP2 ( JSR2 JMP2r ) #0002 ;term/rows LDA2 #0002 ADD2 ;term-move-cursor JMP2
( TODO: filename prmopt ) ( TODO: filename prmopt )
@save ( -> ) @save ( -> )
@ -462,13 +463,11 @@
@draw-cursor ( -> ) @draw-cursor ( -> )
;cur-w-col JSR2 ;term/lmargin LDA2 ADD2 ;cur-w-col JSR2 ;term/lmargin LDA2 ADD2
;cur-rel-row JSR2 ;cur-rel-row JSR2
;term-move-cursor JMP2 ( JSR2 JMP2r ) ;term-move-cursor JMP2
@draw-statusbar ( -> ) @draw-statusbar ( -> )
#0000 ;term/rows LDA2 ;term-move-cursor JSR2 #0000 ;term/rows LDA2 ;term-move-cursor JSR2
;emit-color-reverse JSR2 ;emit-color-reverse JSR2
( ansi ;config/color LDA2 emit emit
LIT2 '7 '; emit emit LIT 'm emit )
LIT2r 2018 LIT2r 2018
;term/cols LDA2 #0000 ;term/cols LDA2 #0000
&loop GTH2k ,&continue JCN ,&done JMP &loop GTH2k ,&continue JCN ,&done JMP
@ -493,7 +492,6 @@
LIT ') emit LIT ') emit
;emit-reset JSR2 ;emit-reset JSR2
( ansi LIT '0 emit LIT 'm emit )
JMP2r JMP2r
@draw-linenum ( n* -> ) @draw-linenum ( n* -> )
@ -579,13 +577,13 @@
&eof POP2 JMP2r &eof POP2 JMP2r
@cur-len ( -> n* ) @cur-len ( -> n* )
;cur-line JSR2 ;line-len JMP2 ( JSR2 JMP2r ) ;cur-line JSR2 ;line-len JMP2
@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 JMP2 ( JSR2 JMP2r ) ;cur-line JSR2 ;line-width JMP2
@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
@ -635,7 +633,7 @@
&not-found ;rel-line-error ;error! JMP2 &not-found ;rel-line-error ;error! JMP2
@cur-line ( -> s* ) @cur-line ( -> s* )
;cur-rel-row JSR2 ;rel-line JMP2 ( JSR2 JMP2r ) ;cur-rel-row JSR2 ;rel-line JMP2
@cur-pos ( -> s* ) @cur-pos ( -> s* )
;cur-line JSR2 ;cur-col JSR2 ADD2 JMP2r ;cur-line JSR2 ;cur-col JSR2 ADD2 JMP2r
@ -675,7 +673,7 @@
JMP2r JMP2r
@cur-col ( -> col* ) @cur-col ( -> col* )
;cursor/col LDA2 ;cur-len JSR2 ;min2 JMP2 ( JSR2 JMP2r ) ;cursor/col LDA2 ;cur-len JSR2 ;min2 JMP2
@cur-w-col ( -> col* ) @cur-w-col ( -> col* )
LIT2r 0000 ( [0] ) LIT2r 0000 ( [0] )
@ -739,7 +737,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 JMP2 ( JSR2 JMP2r ) &do1 ;emit-digit JMP2
@emit-dec2 ( n* -> ) @emit-dec2 ( n* -> )
DUP2 #270f GTH2 ,&do5 JCN DUP2 #270f GTH2 ,&do5 JCN
@ -751,7 +749,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 JMP2 ( JSR2 JMP2r ) &do1 NIP ;emit-digit JMP2
@emit-dec2-pad ( n* -> ) @emit-dec2-pad ( n* -> )
LIT2r 2018 ( preload #20 .Console/write into rst ) LIT2r 2018 ( preload #20 .Console/write into rst )
@ -782,6 +780,9 @@
&rows 0018 &rows 0018
&lmargin 0006 ] &lmargin 0006 ]
@prompt [ &vector $2
&string $40 ]
( COLORS ) ( COLORS )
( ) ( )
( SHORT STRING NAME ) ( SHORT STRING NAME )