wip erase

This commit is contained in:
~d6 2023-01-23 11:14:45 -05:00
parent 9c60bcde34
commit 64a24f36e0
1 changed files with 53 additions and 11 deletions

View File

@ -67,6 +67,15 @@
( return ) ( return )
BRK BRK
@bol-addr ( -> addr* )
.cols LDZ2 .cur-y LDZ2 MUL2 JMP2r
@cur-addr ( -> addr* )
;bol-addr JSR2 .cur-x LDZ2 ADD2 JMP2r
@eol-addr ( -> addr* )
.cols LDZ2 .cur-y LDZ2 INC2 MUL2 JMP2r
@min ( x* y* -> min* ) @min ( x* y* -> min* )
LTH2k JMP SWP2 POP2 JMP2r LTH2k JMP SWP2 POP2 JMP2r
@ -161,17 +170,17 @@
@end-arg ( c^ -> ) @end-arg ( c^ -> )
;on-read .Console/vect DEO2 ;on-read .Console/vect DEO2
DUP LIT "h EQU ;exec-noop JCN2 ( enable line wrap ) DUP LIT "h EQU ;exec-noop JCN2 ( enable line wrap )
DUP LIT "l EQU ;exec-noop JCN2 ( disable line wrap ) DUP LIT "l EQU ;exec-noop JCN2 ( disable line wrap )
DUP LIT "m EQU ;exec-noop JCN2 ( set attr ) DUP LIT "m EQU ;exec-noop JCN2 ( set attr )
DUP LIT "n EQU ;exec-noop JCN2 ( get status ) DUP LIT "n EQU ;exec-status JCN2 ( get status )
DUP LIT "H EQU ;exec-move JCN2 ( move cursor ) DUP LIT "H EQU ;exec-move JCN2 ( move cursor )
DUP LIT "A EQU ;exec-up JCN2 ( up ) DUP LIT "A EQU ;exec-up JCN2 ( up )
DUP LIT "B EQU ;exec-down JCN2 ( down ) DUP LIT "B EQU ;exec-down JCN2 ( down )
DUP LIT "C EQU ;exec-forward JCN2 ( forward ) DUP LIT "C EQU ;exec-forward JCN2 ( forward )
DUP LIT "D EQU ;exec-back JCN2 ( back ) DUP LIT "D EQU ;exec-back JCN2 ( back )
DUP LIT "J EQU ;exec-noop JCN2 ( erase line ) DUP LIT "J EQU ;exec-erase-line JCN2 ( erase line )
DUP LIT "K EQU ;exec-noop JCN2 ( erase screen ) DUP LIT "K EQU ;exec-noop JCN2 ( erase screen )
POP BRK POP BRK
@exec-noop ( c^ -> ) @exec-noop ( c^ -> )
@ -180,11 +189,44 @@
@exec1 ( addr* -> ) @exec1 ( addr* -> )
STH2 #0001 ;read-arg-1 JSR2 STH2r JSR2 BRK STH2 #0001 ;read-arg-1 JSR2 STH2r JSR2 BRK
@exec-status
POP #0000 ;read-arg-1 JSR2 #0006 NEQ2 ,&done
#1b .Console/w DEO
LIT "[ .Console/w DEO
LIT "4 .Console/w DEO
LIT "0 .Console/w DEO
LIT "; .Console/w DEO
LIT "7 .Console/w DEO
LIT "9 .Console/w DEO
LIT "R .Console/w DEO
&done BRK
@exec-up POP ;up-n ;exec1 JMP2 @exec-up POP ;up-n ;exec1 JMP2
@exec-down POP ;down-n ;exec1 JMP2 @exec-down POP ;down-n ;exec1 JMP2
@exec-forward POP ;forward-n ;exec1 JMP2 @exec-forward POP ;forward-n ;exec1 JMP2
@exec-back POP ;back-n ;exec1 JMP2 @exec-back POP ;back-n ;exec1 JMP2
@exec-erase-line
POP #0000 ;read-arg-1 JSR2
DUP2 #0000 ,&erase-to-end JCN
DUP2 #0001 ,&erase-from-start JCN
;bol-addr JSR2 ;eol-addr JSR2 ;erase JSR2 BRK
&erase-to-end
;cur-addr JSR2 INC2 ;eol-addr JSR2 ;erase JSR2 BRK
&erase-from-start
;bol-addr JSR2 ;cur-addr JSR2 INC2 ;erase JSR2 BRK
( TODO: needs to be smarter -- need to redraw tiles and keep x/y coords )
@erase ( start* end* -> )
OVR2 SWP2 SUB2 STH2 ( start* [count*] )
#20 ROT ROT ( 20 start* [count*] )
&loop
STAk INC2r
STH2kr ORA ,&loop JCN
POP2r POP2 POP JMP2r
@exec-move ( c^ -> ) @exec-move ( c^ -> )
POP LIT2r ffff POP LIT2r ffff
#0001 ;read-arg-1 JSR2 STH2kr ADD2 ( row ) #0001 ;read-arg-1 JSR2 STH2kr ADD2 ( row )