fix a couple bugs

This commit is contained in:
~d6 2023-02-02 22:12:58 -05:00
parent c7ce127aa4
commit 95e9b30810
1 changed files with 22 additions and 20 deletions

View File

@ -561,22 +561,25 @@
@exec-move-row ( c^ -> ) @exec-move-row ( c^ -> )
POP POP
#0001 read-arg-1 #0001 SUB2 ( row ) #0001 read-arg-1 dec-floor ( row )
.cur-x LDZ2 ( col ) .cur-x LDZ2 ( col )
goto BRK goto BRK
@exec-move-col ( c^ -> ) @exec-move-col ( c^ -> )
POP POP
.cur-y LDZ2 ( row ) .cur-y LDZ2 ( row )
#0001 read-arg-2 #0001 SUB2 ( col ) #0001 read-arg-2 dec-floor ( col )
goto BRK goto BRK
@exec-move ( c^ -> ) @exec-move ( c^ -> )
POP POP
#0001 read-arg-1 #0001 SUB2 ( row ) #0001 read-arg-1 dec-floor ( row )
#0001 read-arg-2 #0001 SUB2 ( col ) #0001 read-arg-2 dec-floor ( col )
goto BRK goto BRK
@dec-floor ( x* -> x==0 ? 0* : x-1* )
ORAk ?&sub JMP2r &sub #0001 SUB2 JMP2r
@debug-esc ( c^ -> ) @debug-esc ( c^ -> )
.debug LDZ ?&continue POP JMP2r &continue .debug LDZ ?&continue POP JMP2r &continue
;scratch STH2 ;scratch STH2
@ -667,7 +670,7 @@
POP BRK ( ) POP BRK ( )
@read-cr ( 0d -> ) @read-cr ( 0d -> )
POP clear-cursor #0000 .cur-x STZ2 BRK POP clear-cursor #0000 .cur-x STZ2 draw-cursor BRK
@at-max-y ( -> true? ) @at-max-y ( -> true? )
.cur-y LDZ2 .max-y LDZ2 EQU2 JMP2r .cur-y LDZ2 .max-y LDZ2 EQU2 JMP2r
@ -677,7 +680,6 @@
at-max-y ?scroll down BRK at-max-y ?scroll down BRK
@read-printable ( c -> ) @read-printable ( c -> )
( DUP debug-read )
.tint LDZ SWP DUP2 cur-addr STA2 .tint LDZ SWP DUP2 cur-addr STA2
draw-cell draw-cell
forward BRK forward BRK
@ -723,31 +725,31 @@
@insert-cell ( cell* -> ) @insert-cell ( cell* -> )
.irm LDZ #00 EQU ?&replace ( cell* ) .irm LDZ #00 EQU ?&replace ( cell* )
eol-addr #0001 SUB2 ( cell* last=eol-1* ) eol-addr #0001 SUB2 ( cell* last=eol-1* )
cur-addr ( cell* last* cur* ) cur-addr ( cell* last* cur* )
&loop ( cell* last* pos* ) &loop ( cell* last* pos* )
LDA2k OVR2 INC2 STA2 ( cell* last* pos* ; pos+1<-pos ) LDA2k OVR2 INC2 STA2 ( cell* last* pos* ; pos+1<-pos )
INC2 LTH2k ?&loop ( cell* last pos+1* ) INC2 LTH2k ?&loop ( cell* last pos+1* )
POP2 POP2 ( cell* ) POP2 POP2 ( cell* )
&replace ( cell* ) &replace ( cell* )
cur-addr STA2 JMP2r ( ) cur-addr STA2 JMP2r ( )
@forward-n-tabs ( n* -> ) @forward-n-tabs ( n* -> )
#0001 SUB2 #0008 MUL2 ( i=(n-1)8* ) dec-floor #0008 MUL2 ( i=(n-1)8* )
#0008 .cur-x LDZ2 #0007 AND2 SUB2 ( i* 8-cur%8* ) #0008 .cur-x LDZ2 #0007 AND2 SUB2 ( i* 8-cur%8* )
ADD2 !forward-n ( ) ADD2 !forward-n ( )
@insert-n-lines ( n* -> ) @insert-n-lines ( n* -> )
.col-bytes LDZ2 MUL2 STH2 ( [i*] ) .col-bytes LDZ2 MUL2 STH2 ( [i*] )
bol-addr ( bound* [i*] ) bol-addr ( bound* [i*] )
limit-addr STH2kr ( bound* limit* i* [i*] ) limit-addr STH2kr ( bound* limit* i* [i*] )
INC2 INC2 SUB2 ( bound* start=limit-i-2* [i*] ) INC2 INC2 SUB2 ( bound* start=limit-i-2* [i*] )
&loop ( bound* pos* [i*] ) &loop ( bound* pos* [i*] )
LDA2k OVR2 STH2kr ADD2 ( bound* pos* x* pos+i* [i*] ) LDA2k OVR2 STH2kr ADD2 ( bound* pos* x* pos+i* [i*] )
STA2 ( bound* pos* [i*] ; pos+i<-x ) STA2 ( bound* pos* [i*] ; pos+i<-x )
#0220 OVR2 STA2 ( bound* pos* [i*] ; pos<-4220 ) #0220 OVR2 STA2 ( bound* pos* [i*] ; pos<-4220 )
#0002 SUB2 ( bound* pos-2* [i*] ) #0002 SUB2 ( bound* pos-2* [i*] )
GTH2k #00 EQU ?&loop ( bound* pos-2* [i*] ) GTH2k #00 EQU ?&loop ( bound* pos-2* [i*] )
POP2 POP2 POP2r ( ) POP2 POP2 POP2r ( )
#01 .dirty? STZ JMP2r ( ) #01 .dirty? STZ JMP2r ( )