fix page up bug

This commit is contained in:
~d6 2022-02-18 00:48:59 -05:00
parent ee91fc7949
commit de85141c84
1 changed files with 16 additions and 7 deletions

View File

@ -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