From 37936eda778067b51567df58b62d733ec2944d22 Mon Sep 17 00:00:00 2001 From: d6 Date: Mon, 7 Mar 2022 12:56:52 -0500 Subject: [PATCH] set up zero page, start cleaning up --- femto.tal | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/femto.tal b/femto.tal index 152f26b..25c1995 100644 --- a/femto.tal +++ b/femto.tal @@ -66,6 +66,9 @@ %quit! { #01 .System/halt DEO } +( zero page ) +|0000 + ( startup ) |0100 ;startup JMP2 @@ -100,7 +103,7 @@ JMP2r @setup-terminal-size ( -> ) - ( ;setup-80x24 JSR2 JMP2r ) + ( ;setup-80x24 JMP2 ) #03e7 #03e7 ;term-move-cursor JSR2 ;term-get-cursor-position JSR2 ;tmp/data ;tmp/pos STA2 @@ -248,9 +251,7 @@ ;ensure-visible-cursor JSR2 ;draw-all JSR2 BRK &near-eof - ;buffer/line-count LDA2 - ;buffer/line-offset LDA2 INC2 SUB2 - ;cursor/row STA2 + ;buffer/line-count LDA2 #0001 SUB2 ;set-abs-row JSR2 ;cur-len JSR2 ;cursor/col STA2 ;draw-cursor JSR2 BRK @@ -396,7 +397,7 @@ BRK @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 ) @save ( -> ) @@ -462,13 +463,11 @@ @draw-cursor ( -> ) ;cur-w-col JSR2 ;term/lmargin LDA2 ADD2 ;cur-rel-row JSR2 - ;term-move-cursor JMP2 ( JSR2 JMP2r ) + ;term-move-cursor JMP2 @draw-statusbar ( -> ) #0000 ;term/rows LDA2 ;term-move-cursor JSR2 ;emit-color-reverse JSR2 -( ansi ;config/color LDA2 emit emit - LIT2 '7 '; emit emit LIT 'm emit ) LIT2r 2018 ;term/cols LDA2 #0000 &loop GTH2k ,&continue JCN ,&done JMP @@ -493,7 +492,6 @@ LIT ') emit ;emit-reset JSR2 - ( ansi LIT '0 emit LIT 'm emit ) JMP2r @draw-linenum ( n* -> ) @@ -579,13 +577,13 @@ &eof POP2 JMP2r @cur-len ( -> n* ) - ;cur-line JSR2 ;line-len JMP2 ( JSR2 JMP2r ) + ;cur-line JSR2 ;line-len JMP2 @cur-last ( -> n* ) ;cur-line JSR2 ;line-len JSR2 #0001 SUB2 JMP2r @cur-width ( -> n* ) - ;cur-line JSR2 ;line-width JMP2 ( JSR2 JMP2r ) + ;cur-line JSR2 ;line-width JMP2 @cur-w-last ( -> n* ) ;cur-line JSR2 ;line-width JSR2 #0001 SUB2 JMP2r @@ -635,7 +633,7 @@ ¬-found ;rel-line-error ;error! JMP2 @cur-line ( -> s* ) - ;cur-rel-row JSR2 ;rel-line JMP2 ( JSR2 JMP2r ) + ;cur-rel-row JSR2 ;rel-line JMP2 @cur-pos ( -> s* ) ;cur-line JSR2 ;cur-col JSR2 ADD2 JMP2r @@ -675,7 +673,7 @@ JMP2r @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* ) LIT2r 0000 ( [0] ) @@ -739,7 +737,7 @@ ,&do1 JMP &do3 #64 ;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* -> ) DUP2 #270f GTH2 ,&do5 JCN @@ -751,7 +749,7 @@ &do4 #03e8 ;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 - &do1 NIP ;emit-digit JMP2 ( JSR2 JMP2r ) + &do1 NIP ;emit-digit JMP2 @emit-dec2-pad ( n* -> ) LIT2r 2018 ( preload #20 .Console/write into rst ) @@ -782,6 +780,9 @@ &rows 0018 &lmargin 0006 ] +@prompt [ &vector $2 + &string $40 ] + ( COLORS ) ( ) ( SHORT STRING NAME )