diff --git a/arch/z80/sms/blk/608 b/arch/z80/sms/blk/608 index e04cde5..f3913e1 100644 --- a/arch/z80/sms/blk/608 +++ b/arch/z80/sms/blk/608 @@ -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 ; diff --git a/arch/z80/sms/xcomp.fs b/arch/z80/sms/xcomp.fs index 822e36d..1768b6c 100644 --- a/arch/z80/sms/xcomp.fs +++ b/arch/z80/sms/xcomp.fs @@ -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 diff --git a/arch/z80/sms/xcompkbd.fs b/arch/z80/sms/xcompkbd.fs index f99e09f..467d36b 100644 --- a/arch/z80/sms/xcompkbd.fs +++ b/arch/z80/sms/xcompkbd.fs @@ -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 diff --git a/arch/z80/sms/xcompsdc.fs b/arch/z80/sms/xcompsdc.fs index 63bccbb..f4b3337 100644 --- a/arch/z80/sms/xcompsdc.fs +++ b/arch/z80/sms/xcompsdc.fs @@ -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 diff --git a/blk/402 b/blk/402 index 753a778..ac94de5 100644 --- a/blk/402 +++ b/blk/402 @@ -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 ! ; diff --git a/blk/403 b/blk/403 index 92413cb..284a357 100644 --- a/blk/403 +++ b/blk/403 @@ -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 ! ; diff --git a/doc/protocol.txt b/doc/protocol.txt index b8cafef..f9caf31 100644 --- a/doc/protocol.txt +++ b/doc/protocol.txt @@ -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.