Adjust Grid subsystem

Rename ROWS to LINES (it's what VE uses). Also, don't use COLS and
LINES as immediates in the Grid subsystem: we expect those words to
be available at runtime.
This commit is contained in:
Virgil Dupras 2020-11-10 19:06:39 -05:00
parent b97e761942
commit e0bcf3473e
7 changed files with 11 additions and 15 deletions

View File

@ -6,3 +6,6 @@
( sprite, inverted colors ) 0x3f _data 15 _zero
0x4000 _ctl 0x5e 0 DO ~FNT I 7 * + _sfont LOOP
( bit 6, enable display, bit 7, ?? ) 0x81c0 _ctl ;
: COLS 32 ;
: LINES 24 ;

View File

@ -7,8 +7,6 @@ RS_ADDR 0x80 - CONSTANT SYSVARS
0xbf CONSTANT VDP_CTLPORT
0xbe CONSTANT VDP_DATAPORT
SYSVARS 0x70 + CONSTANT GRID_MEM
32 CONSTANT COLS
24 CONSTANT ROWS
SYSVARS 0x72 + CONSTANT CPORT_MEM
0x3f CONSTANT CPORT_CTL
0xdc CONSTANT CPORT_D1

View File

@ -8,8 +8,6 @@ RS_ADDR 0x80 - CONSTANT SYSVARS
0xbf CONSTANT VDP_CTLPORT
0xbe CONSTANT VDP_DATAPORT
SYSVARS 0x70 + CONSTANT GRID_MEM
32 CONSTANT COLS
24 CONSTANT ROWS
SYSVARS 0x72 + CONSTANT CPORT_MEM
0x3f CONSTANT CPORT_CTL
0xdc CONSTANT CPORT_D1

View File

@ -9,8 +9,6 @@ RS_ADDR 0x80 - CONSTANT SYSVARS
0xbf CONSTANT VDP_CTLPORT
0xbe CONSTANT VDP_DATAPORT
SYSVARS 0x70 + CONSTANT GRID_MEM
32 CONSTANT COLS
24 CONSTANT ROWS
SYSVARS 0x72 + CONSTANT CPORT_MEM
0x3f CONSTANT CPORT_CTL
0xdc CONSTANT CPORT_D1

10
blk/402
View File

@ -1,10 +1,10 @@
: XYPOS [ GRID_MEM LITN ] ;
: AT-XY ( x y -- ) [ ROWS LITN ] * +
[ COLS ROWS * LITN ] MOD XYPOS ! ;
: _cl* COLS LINES * ;
: AT-XY ( x y -- ) LINES * + _cl* MOD XYPOS ! ;
: _lf
XYPOS @ BEGIN ( pos )
0 ( blank ) SWAP TUCK CELL!
1+ DUP [ COLS LITN ] MOD NOT UNTIL
[ COLS ROWS * LITN ] MOD XYPOS ! ;
1+ DUP COLS MOD NOT UNTIL
_cl* MOD XYPOS ! ;
: _bs 0 ( blank ) XYPOS @ TUCK CELL! ( pos ) 1-
[ COLS ROWS * LITN ] MOD XYPOS ! ;
_cl* MOD XYPOS ! ;

View File

@ -3,5 +3,4 @@
DUP 0x0d = IF DROP _lf EXIT THEN
0x20 - DUP 0< IF DROP EXIT THEN
XYPOS @ CELL!
XYPOS @ 1+ DUP [ COLS ROWS * LITN ]
= IF DROP 0 THEN XYPOS ! ;
XYPOS @ 1+ _cl* MOD XYPOS ! ;

View File

@ -43,11 +43,11 @@ A grid is a device that shows as a grid of ASCII characters and
allows random access to it.
COLS -- n Number of columns in the device
ROWS -- n Number of rows in the device
LINES -- n Number of lines in the device
CELL! g pos -- Set glyph at pos
"pos" is a simple number (y * cols) + x. For example, if we
have 40 columns per row, the position (x, y) (12, 10) is 412.
have 40 columns per line, the position (x, y) (12, 10) is 412.
A glyph is ASCII-0x20. If the resulting glyph number exceeds the
number of glyphs in the font, it's up to CELL! to ignore it.