mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-23 12:58:06 +11:00
Add Grid subsystem
The goal is to offload the SMS VDP driver a little bit.
This commit is contained in:
parent
603ad5d255
commit
b97e761942
@ -1,4 +1,3 @@
|
||||
: XYPOS [ VDP_MEM LITN ] ;
|
||||
CODE _ctl ( a -- sends LSB then MSB )
|
||||
HL POP, chkPS,
|
||||
A L LDrr, VDP_CTLPORT OUTiA,
|
||||
|
@ -1,9 +1,3 @@
|
||||
: _cell! ( tilenum pos )
|
||||
2 * 0x7800 OR _ctl ( tilenum ) _data 1 _zero ;
|
||||
: _lf
|
||||
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 ! ;
|
||||
: CELL! ( tilenum pos )
|
||||
2 * 0x7800 OR _ctl ( tilenum )
|
||||
0x5e MOD _data 1 _zero ;
|
||||
|
@ -1,10 +1,3 @@
|
||||
: (emit)
|
||||
DUP 0x08 = IF DROP _bs EXIT THEN
|
||||
DUP 0x0d = IF DROP _lf EXIT THEN
|
||||
0x20 - DUP 0< IF DROP EXIT THEN
|
||||
DUP 0x5e > IF DROP 0x5e THEN ( 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 )
|
||||
@ -12,5 +5,4 @@
|
||||
( BG ) 1 _zero 0x3f _data 14 _zero
|
||||
( 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 ;
|
||||
|
@ -4,11 +4,11 @@
|
||||
0xddca CONSTANT PS_ADDR
|
||||
RS_ADDR 0x80 - CONSTANT SYSVARS
|
||||
0xc000 CONSTANT HERESTART
|
||||
SYSVARS 0x70 + CONSTANT VDP_MEM
|
||||
0xbf CONSTANT VDP_CTLPORT
|
||||
0xbe CONSTANT VDP_DATAPORT
|
||||
32 CONSTANT VDP_COLS
|
||||
24 CONSTANT VDP_ROWS
|
||||
SYSVARS 0x70 + CONSTANT GRID_MEM
|
||||
32 CONSTANT COLS
|
||||
24 CONSTANT ROWS
|
||||
SYSVARS 0x72 + CONSTANT CPORT_MEM
|
||||
0x3f CONSTANT CPORT_CTL
|
||||
0xdc CONSTANT CPORT_D1
|
||||
@ -30,12 +30,13 @@ CURRENT @ XCURRENT !
|
||||
353 LOAD ( xcomp core low )
|
||||
CREATE ~FNT CPFNT7x7
|
||||
603 608 LOADR ( VDP )
|
||||
402 404 LOADR ( Grid )
|
||||
625 626 LOADR ( SMS ports )
|
||||
612 617 LOADR ( PAD )
|
||||
390 LOAD ( xcomp core high )
|
||||
(entry) _
|
||||
( Update LATEST )
|
||||
PC ORG @ 8 + !
|
||||
," VDP$ PAD$ (im1) " EOT,
|
||||
," VDP$ 0 0 AT-XY PAD$ (im1) " EOT,
|
||||
ORG @ 0x100 - 256 /MOD 2 PC! 2 PC!
|
||||
H@ 256 /MOD 2 PC! 2 PC!
|
||||
|
@ -5,11 +5,11 @@
|
||||
0xddca CONSTANT PS_ADDR
|
||||
RS_ADDR 0x80 - CONSTANT SYSVARS
|
||||
0xc000 CONSTANT HERESTART
|
||||
SYSVARS 0x70 + CONSTANT VDP_MEM
|
||||
0xbf CONSTANT VDP_CTLPORT
|
||||
0xbe CONSTANT VDP_DATAPORT
|
||||
32 CONSTANT VDP_COLS
|
||||
24 CONSTANT VDP_ROWS
|
||||
SYSVARS 0x70 + CONSTANT GRID_MEM
|
||||
32 CONSTANT COLS
|
||||
24 CONSTANT ROWS
|
||||
SYSVARS 0x72 + CONSTANT CPORT_MEM
|
||||
0x3f CONSTANT CPORT_CTL
|
||||
0xdc CONSTANT CPORT_D1
|
||||
@ -31,12 +31,13 @@ CURRENT @ XCURRENT !
|
||||
353 LOAD ( xcomp core low )
|
||||
CREATE ~FNT CPFNT7x7
|
||||
603 608 LOADR ( VDP )
|
||||
402 404 LOADR ( Grid )
|
||||
625 626 LOADR ( SMS ports )
|
||||
620 LOAD ( PAD ) : (ps2kc) (ps2kcA) ; 411 414 LOADR
|
||||
390 LOAD ( xcomp core high )
|
||||
(entry) _
|
||||
( Update LATEST )
|
||||
PC ORG @ 8 + !
|
||||
," VDP$ PS2$ (im1) " EOT,
|
||||
," VDP$ 0 0 AT-XY PS2$ (im1) " EOT,
|
||||
ORG @ 0x100 - 256 /MOD 2 PC! 2 PC!
|
||||
H@ 256 /MOD 2 PC! 2 PC!
|
||||
|
@ -6,11 +6,11 @@
|
||||
0xddca CONSTANT PS_ADDR
|
||||
RS_ADDR 0x80 - CONSTANT SYSVARS
|
||||
0xc000 CONSTANT HERESTART
|
||||
SYSVARS 0x70 + CONSTANT VDP_MEM
|
||||
0xbf CONSTANT VDP_CTLPORT
|
||||
0xbe CONSTANT VDP_DATAPORT
|
||||
32 CONSTANT VDP_COLS
|
||||
24 CONSTANT VDP_ROWS
|
||||
SYSVARS 0x70 + CONSTANT GRID_MEM
|
||||
32 CONSTANT COLS
|
||||
24 CONSTANT ROWS
|
||||
SYSVARS 0x72 + CONSTANT CPORT_MEM
|
||||
0x3f CONSTANT CPORT_CTL
|
||||
0xdc CONSTANT CPORT_D1
|
||||
@ -32,6 +32,7 @@ CURRENT @ XCURRENT !
|
||||
353 LOAD ( xcomp core low )
|
||||
CREATE ~FNT CPFNT7x7
|
||||
603 608 LOADR ( VDP )
|
||||
402 404 LOADR ( Grid )
|
||||
625 626 LOADR ( SMS ports )
|
||||
620 LOAD ( PAD ) : (ps2kc) (ps2kcA) ; 411 414 LOADR
|
||||
622 LOAD ( SPI )
|
||||
@ -40,6 +41,6 @@ CREATE ~FNT CPFNT7x7
|
||||
(entry) _
|
||||
( Update LATEST )
|
||||
PC ORG @ 8 + !
|
||||
," VDP$ PS2$ BLK$ (im1) " EOT,
|
||||
," VDP$ 0 0 AT-XY PS2$ BLK$ (im1) " EOT,
|
||||
ORG @ 0x100 - 256 /MOD 2 PC! 2 PC!
|
||||
H@ 256 /MOD 2 PC! 2 PC!
|
||||
|
2
blk/001
2
blk/001
@ -6,7 +6,7 @@ MASTER INDEX
|
||||
160 AVR SPI programmer
|
||||
170-259 unused 260 Cross compilation
|
||||
280 Z80 boot code 350 Core words
|
||||
400 AT28 EEPROM driver 401-410 unused
|
||||
400 AT28 EEPROM driver 401 Grid subsystem
|
||||
410 PS/2 keyboard subsystem 418 Z80 SPI Relay driver
|
||||
420 SD Card subsystem 440 8086 boot code
|
||||
470-519 unused 520 Fonts
|
||||
|
11
blk/401
Normal file
11
blk/401
Normal file
@ -0,0 +1,11 @@
|
||||
Grid subsystem
|
||||
|
||||
Given a device driver following the Grid protocol, implement
|
||||
AT-XY and (emit). (emit) makes the grid behave like a regular
|
||||
terminal, honoring line feeds and backspaces, wrapping at the
|
||||
end of a line.
|
||||
|
||||
2 bytes of system memory at GRID_MEM are needed for cursor
|
||||
position.
|
||||
|
||||
Load range: B402-B403
|
10
blk/402
Normal file
10
blk/402
Normal file
@ -0,0 +1,10 @@
|
||||
: XYPOS [ GRID_MEM LITN ] ;
|
||||
: AT-XY ( x y -- ) [ ROWS LITN ] * +
|
||||
[ COLS ROWS * LITN ] MOD XYPOS ! ;
|
||||
: _lf
|
||||
XYPOS @ BEGIN ( pos )
|
||||
0 ( blank ) SWAP TUCK CELL!
|
||||
1+ DUP [ COLS LITN ] MOD NOT UNTIL
|
||||
[ COLS ROWS * LITN ] MOD XYPOS ! ;
|
||||
: _bs 0 ( blank ) XYPOS @ TUCK CELL! ( pos ) 1-
|
||||
[ COLS ROWS * LITN ] MOD XYPOS ! ;
|
7
blk/403
Normal file
7
blk/403
Normal file
@ -0,0 +1,7 @@
|
||||
: (emit)
|
||||
DUP 0x08 = IF DROP _bs EXIT THEN
|
||||
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 ! ;
|
@ -37,3 +37,19 @@ previously enabled one.
|
||||
(spix) n -- n Perform SPI exchange (push a number, get a
|
||||
number back)
|
||||
|
||||
# Grid protocol
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
Glyph 0 is always blank.
|
||||
|
Loading…
Reference in New Issue
Block a user