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:
parent
b97e761942
commit
e0bcf3473e
@ -6,3 +6,6 @@
|
|||||||
( sprite, inverted colors ) 0x3f _data 15 _zero
|
( sprite, inverted colors ) 0x3f _data 15 _zero
|
||||||
0x4000 _ctl 0x5e 0 DO ~FNT I 7 * + _sfont LOOP
|
0x4000 _ctl 0x5e 0 DO ~FNT I 7 * + _sfont LOOP
|
||||||
( bit 6, enable display, bit 7, ?? ) 0x81c0 _ctl ;
|
( bit 6, enable display, bit 7, ?? ) 0x81c0 _ctl ;
|
||||||
|
|
||||||
|
: COLS 32 ;
|
||||||
|
: LINES 24 ;
|
||||||
|
@ -7,8 +7,6 @@ RS_ADDR 0x80 - CONSTANT SYSVARS
|
|||||||
0xbf CONSTANT VDP_CTLPORT
|
0xbf CONSTANT VDP_CTLPORT
|
||||||
0xbe CONSTANT VDP_DATAPORT
|
0xbe CONSTANT VDP_DATAPORT
|
||||||
SYSVARS 0x70 + CONSTANT GRID_MEM
|
SYSVARS 0x70 + CONSTANT GRID_MEM
|
||||||
32 CONSTANT COLS
|
|
||||||
24 CONSTANT ROWS
|
|
||||||
SYSVARS 0x72 + CONSTANT CPORT_MEM
|
SYSVARS 0x72 + CONSTANT CPORT_MEM
|
||||||
0x3f CONSTANT CPORT_CTL
|
0x3f CONSTANT CPORT_CTL
|
||||||
0xdc CONSTANT CPORT_D1
|
0xdc CONSTANT CPORT_D1
|
||||||
|
@ -8,8 +8,6 @@ RS_ADDR 0x80 - CONSTANT SYSVARS
|
|||||||
0xbf CONSTANT VDP_CTLPORT
|
0xbf CONSTANT VDP_CTLPORT
|
||||||
0xbe CONSTANT VDP_DATAPORT
|
0xbe CONSTANT VDP_DATAPORT
|
||||||
SYSVARS 0x70 + CONSTANT GRID_MEM
|
SYSVARS 0x70 + CONSTANT GRID_MEM
|
||||||
32 CONSTANT COLS
|
|
||||||
24 CONSTANT ROWS
|
|
||||||
SYSVARS 0x72 + CONSTANT CPORT_MEM
|
SYSVARS 0x72 + CONSTANT CPORT_MEM
|
||||||
0x3f CONSTANT CPORT_CTL
|
0x3f CONSTANT CPORT_CTL
|
||||||
0xdc CONSTANT CPORT_D1
|
0xdc CONSTANT CPORT_D1
|
||||||
|
@ -9,8 +9,6 @@ RS_ADDR 0x80 - CONSTANT SYSVARS
|
|||||||
0xbf CONSTANT VDP_CTLPORT
|
0xbf CONSTANT VDP_CTLPORT
|
||||||
0xbe CONSTANT VDP_DATAPORT
|
0xbe CONSTANT VDP_DATAPORT
|
||||||
SYSVARS 0x70 + CONSTANT GRID_MEM
|
SYSVARS 0x70 + CONSTANT GRID_MEM
|
||||||
32 CONSTANT COLS
|
|
||||||
24 CONSTANT ROWS
|
|
||||||
SYSVARS 0x72 + CONSTANT CPORT_MEM
|
SYSVARS 0x72 + CONSTANT CPORT_MEM
|
||||||
0x3f CONSTANT CPORT_CTL
|
0x3f CONSTANT CPORT_CTL
|
||||||
0xdc CONSTANT CPORT_D1
|
0xdc CONSTANT CPORT_D1
|
||||||
|
10
blk/402
10
blk/402
@ -1,10 +1,10 @@
|
|||||||
: XYPOS [ GRID_MEM LITN ] ;
|
: XYPOS [ GRID_MEM LITN ] ;
|
||||||
: AT-XY ( x y -- ) [ ROWS LITN ] * +
|
: _cl* COLS LINES * ;
|
||||||
[ COLS ROWS * LITN ] MOD XYPOS ! ;
|
: AT-XY ( x y -- ) LINES * + _cl* MOD XYPOS ! ;
|
||||||
: _lf
|
: _lf
|
||||||
XYPOS @ BEGIN ( pos )
|
XYPOS @ BEGIN ( pos )
|
||||||
0 ( blank ) SWAP TUCK CELL!
|
0 ( blank ) SWAP TUCK CELL!
|
||||||
1+ DUP [ COLS LITN ] MOD NOT UNTIL
|
1+ DUP COLS MOD NOT UNTIL
|
||||||
[ COLS ROWS * LITN ] MOD XYPOS ! ;
|
_cl* MOD XYPOS ! ;
|
||||||
: _bs 0 ( blank ) XYPOS @ TUCK CELL! ( pos ) 1-
|
: _bs 0 ( blank ) XYPOS @ TUCK CELL! ( pos ) 1-
|
||||||
[ COLS ROWS * LITN ] MOD XYPOS ! ;
|
_cl* MOD XYPOS ! ;
|
||||||
|
3
blk/403
3
blk/403
@ -3,5 +3,4 @@
|
|||||||
DUP 0x0d = IF DROP _lf EXIT THEN
|
DUP 0x0d = IF DROP _lf EXIT THEN
|
||||||
0x20 - DUP 0< IF DROP EXIT THEN
|
0x20 - DUP 0< IF DROP EXIT THEN
|
||||||
XYPOS @ CELL!
|
XYPOS @ CELL!
|
||||||
XYPOS @ 1+ DUP [ COLS ROWS * LITN ]
|
XYPOS @ 1+ _cl* MOD XYPOS ! ;
|
||||||
= IF DROP 0 THEN XYPOS ! ;
|
|
||||||
|
@ -43,11 +43,11 @@ A grid is a device that shows as a grid of ASCII characters and
|
|||||||
allows random access to it.
|
allows random access to it.
|
||||||
|
|
||||||
COLS -- n Number of columns in the device
|
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
|
CELL! g pos -- Set glyph at pos
|
||||||
|
|
||||||
"pos" is a simple number (y * cols) + x. For example, if we
|
"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
|
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.
|
number of glyphs in the font, it's up to CELL! to ignore it.
|
||||||
|
Loading…
Reference in New Issue
Block a user