From de85141c8449e5cc5921b6647268cc9ff354eeaf Mon Sep 17 00:00:00 2001 From: d6 Date: Fri, 18 Feb 2022 00:48:59 -0500 Subject: [PATCH] fix page up bug --- femto.tal | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/femto.tal b/femto.tal index b015384..cffc433 100644 --- a/femto.tal +++ b/femto.tal @@ -100,7 +100,7 @@ JMP2r @setup-terminal-size ( -> ) - ( ;setup-80x24 JSR2 ) + ( ;setup-80x24 JSR2 JMP2r ) #03e7 #03e7 ;term-move-cursor JSR2 ;term-get-cursor-position JSR2 ;tmp/data ;tmp/pos STA2 @@ -167,7 +167,6 @@ ;filename ;open-file JSR2 ( open file ) ;setup-linecount JSR2 ( determine # of lines ) ;setup-terminal-size JSR2 ( detect terminal dimensions ) - ( ;setup-80x24 JSR2 ( hardcoded terminal size ) ) BRK @bol ( -> ) @@ -223,14 +222,21 @@ &done BRK @page-up ( -> ) - ;bof-is-visible JSR2 ,&near-eof JCN + ;bof-is-visible JSR2 ,&at-bof JCN ;buffer/line-offset LDA2 - ;term/rows LDA2 SUB2 #0003 ADD2 - DUP2 ;abs-line JSR2 ;buffer/offset STA2 - ;buffer/line-offset STA2 + ;term/rows LDA2 #0003 SUB2 + LTH2k ,&near-bof JCN + SUB2 DUP2 ;abs-line JSR2 ;buffer/offset STA2 + ;buffer/line-offset STA2 ;ensure-visible-cursor JSR2 ;draw-all JSR2 BRK - &near-eof + &near-bof POP2 POP2 &xyz + ;buffer/data ;buffer/offset STA2 + #0000 ;buffer/line-offset STA2 + #0000 ;cursor/row STA2 + #0000 ;cursor/col STA2 + ;draw-all JSR2 BRK + &at-bof #0000 ;cursor/row STA2 #0000 ;cursor/col STA2 ;draw-cursor JSR2 BRK @@ -426,6 +432,9 @@ @min2 ( x* y* -> min* ) LTH2k JMP SWP2 POP2 JMP2r +@max2 ( x* y* -> min* ) + GTH2k JMP SWP2 POP2 JMP2r + @term-move-cursor ( col* row* -> ) ansi INC2 ( row+1 ) ;emit-dec2 JSR2 LIT '; emit INC2 ( col+1 ) ;emit-dec2 JSR2