sms/vdp: clear rest of line on line feed

This allows us (in the following commit), to stop unvariably
spitting 64 chars by line in LIST. This way, short lines don't use
3 rows per line (the line number uses 3 chars, which brings us to
67 chars per line).

If we don't do that, we end up with the old contents of the line
being kept at the right of the printed line.
This commit is contained in:
Virgil Dupras 2020-11-08 16:43:37 -05:00
parent 11ebaaaa0b
commit f09950a12a
2 changed files with 13 additions and 13 deletions

View File

@ -1,15 +1,9 @@
: _cell! ( tilenum pos )
2 * 0x7800 OR _ctl ( tilenum ) _data 1 _zero ;
: _spc! 0 ( blank ) XYPOS @ _cell! ;
: _lf
_spc! XYPOS @ [ VDP_COLS LITN ] / 1+ [ VDP_ROWS LITN ] MOD
[ VDP_COLS LITN ] * XYPOS ! ;
: _bs _spc! XYPOS @ 1-
XYPOS @ BEGIN ( pos )
0 ( blank ) SWAP TUCK _cell!
1+ DUP [ VDP_COLS LITN ] MOD NOT UNTIL
[ VDP_COLS VDP_ROWS * LITN ] MOD XYPOS ! ;
: _bs 0 ( blank ) XYPOS @ TUCK _cell! ( pos ) 1-
[ VDP_COLS VDP_ROWS * LITN ] MOD XYPOS ! ;
: (emit)
DUP 0x08 = IF DROP _bs EXIT THEN
DUP 0x0d = IF DROP _lf EXIT THEN
0x20 - DUP 0< IF DROP EXIT THEN
0x5e MIN ( tilenum ) XYPOS @ _cell!
XYPOS @ 1+ DUP [ VDP_COLS VDP_ROWS * LITN ]
= IF DROP 0 THEN XYPOS ! ;

View File

@ -1,3 +1,10 @@
: (emit)
DUP 0x08 = IF DROP _bs EXIT THEN
DUP 0x0d = IF DROP _lf EXIT THEN
0x20 - DUP 0< IF DROP EXIT THEN
0x5e MIN ( tilenum ) XYPOS @ _cell!
XYPOS @ 1+ DUP [ VDP_COLS VDP_ROWS * LITN ]
= IF DROP 0 THEN XYPOS ! ;
: VDP$
9 0 DO _idat I 2 * + @ _ctl LOOP _blank
( palettes )
@ -6,5 +13,4 @@
( sprite, inverted colors ) 0x3f _data 15 _zero
0x4000 _ctl 0x5e 0 DO ~FNT I 7 * + _sfont LOOP
0 XYPOS !
( bit 6, enable display, bit 7, ?? ) 0x81c0 _ctl
;
( bit 6, enable display, bit 7, ?? ) 0x81c0 _ctl ;