From 20f686d026e75d9f1d6f3b725dd5fce9171cb6ea Mon Sep 17 00:00:00 2001 From: d6 Date: Tue, 15 Feb 2022 21:58:12 -0500 Subject: [PATCH] get page-down working --- femto.tal | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/femto.tal b/femto.tal index 8a6aed7..436d928 100644 --- a/femto.tal +++ b/femto.tal @@ -232,6 +232,24 @@ ;draw-cursor JSR2 BRK &done BRK +@page-up + BRK + +@page-down + ;eof-is-visible JSR2 ,&near-eof JCN + ;buffer/line-offset LDA2 ;term/rows LDA2 ADD2 #0003 SUB2 + ;buffer/line-count LDA2 ;min2 JSR2 + DUP2 ;abs-line JSR2 ;buffer/offset STA2 + ;buffer/line-offset STA2 + ;ensure-visible-cursor JSR2 + ;draw-all JSR2 BRK + &near-eof + ;buffer/line-count LDA2 + ;buffer/line-offset LDA2 INC2 + SUB2 NIP ;cursor/row STA + ;cur-len JSR2 ;cursor/col STA + ;draw-cursor JSR2 BRK + @quit quit! @ignore BRK @@ -258,6 +276,11 @@ @at-line-start ( -> bool^ ) ;cursor/col LDA #00 EQU JMP2r +@eof-is-visible ( -> bool^ ) + ;buffer/line-offset LDA2 ;term/rows LDA2 ADD2 INC2 + ;buffer/line-count LDA2 + GTH2 JMP2r + @backspace ( -> ) ;at-buffer-start JSR2 ,&skip JCN ;at-line-start JSR2 ,&prev-line JCN @@ -353,6 +376,7 @@ .Console/read DEI LIT '< EQU ( M-< ) ;goto-start JCN2 .Console/read DEI LIT '> EQU ( M-> ) ;goto-end JCN2 .Console/read DEI LIT 'g EQU ( M-g ) ;goto-line JCN2 + .Console/read DEI LIT 'v EQU ( M-v ) ;page-up JCN2 BRK @move-to-message-line ( -> ) @@ -390,6 +414,7 @@ .Console/read DEI #0e EQU ( C-n ) ;down JCN2 .Console/read DEI #0f EQU ( C-o ) ;save JCN2 .Console/read DEI #10 EQU ( C-p ) ;up JCN2 + .Console/read DEI #16 EQU ( C-v ) ;page-down JCN2 .Console/read DEI #18 EQU ( C-x ) ;quit JCN2 .Console/read DEI #1a EQU ( C-z ) ;debug JCN2 .Console/read DEI #1b EQU ( ESC ) ;escape JCN2 @@ -402,6 +427,9 @@ @min ( x^ y^ -> min^ ) LTHk JMP SWP POP JMP2r +@min2 ( x* y* -> min* ) + LTH2k JMP SWP2 POP2 JMP2r + @term-move-cursor ( col^ row^ -> ) ansi INC ( row+1 ) ;emit-dec JSR2 LIT '; emit INC ( col+1 ) ;emit-dec JSR2