mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-23 15:48:05 +11:00
sms: add cursor visual indicator in VDP mode 4
This required the change of CURSOR! signature: we now supply it with both old and new cursor positions. Also, fix broken _bs in Grid subsystem.
This commit is contained in:
parent
74d2a5d722
commit
cf79ceefea
@ -29,8 +29,13 @@ always stay zero. )
|
||||
( blank row ) 4 _zero ;
|
||||
: CELL! ( c pos )
|
||||
2 * 0x7800 OR _ctl ( c )
|
||||
0x20 - ( glyph ) 0x5e MOD _data 0 _data ;
|
||||
0x20 - ( glyph ) 0x5e MOD _data ;
|
||||
( ----- 604 )
|
||||
: CURSOR! ( new old -- )
|
||||
( unset palette bit in old tile )
|
||||
2 * 1+ 0x7800 OR _ctl 0 _data
|
||||
( set palette bit for at specified pos )
|
||||
2 * 1+ 0x7800 OR _ctl 0x8 _data ;
|
||||
: VDP$
|
||||
9 0 DO _idat I 2 * + @ _ctl LOOP _blank
|
||||
( palettes )
|
||||
@ -40,8 +45,7 @@ always stay zero. )
|
||||
0x4000 _ctl 0x5e 0 DO ~FNT I 7 * + _sfont LOOP
|
||||
( bit 6, enable display, bit 7, ?? ) 0x81c0 _ctl ;
|
||||
|
||||
: COLS 32 ;
|
||||
: LINES 24 ;
|
||||
: COLS 32 ; : LINES 24 ;
|
||||
( ----- 610 )
|
||||
Pad driver - read input from MD controller
|
||||
|
||||
|
8
blk.fs
8
blk.fs
@ -2214,8 +2214,8 @@ See doc/grid.txt.
|
||||
Load range: B402-B403
|
||||
( ----- 402 )
|
||||
: XYPOS [ GRID_MEM LITN ] ; : XYMODE [ GRID_MEM LITN ] 2+ ;
|
||||
'? CURSOR! NIP NOT [IF] : CURSOR! DROP ; [THEN]
|
||||
: XYPOS! COLS LINES * MOD DUP CURSOR! XYPOS ! ;
|
||||
'? CURSOR! NIP NOT [IF] : CURSOR! 2DROP ; [THEN]
|
||||
: XYPOS! COLS LINES * MOD DUP XYPOS @ CURSOR! XYPOS ! ;
|
||||
: AT-XY ( x y -- ) COLS * + XYPOS! ;
|
||||
'? NEWLN NIP NOT [IF]
|
||||
: NEWLN ( ln -- ) COLS * DUP COLS + SWAP DO 0x20 I CELL! LOOP ;
|
||||
@ -2223,7 +2223,7 @@ Load range: B402-B403
|
||||
: _lf XYMODE C@ IF EXIT THEN
|
||||
XYPOS @ COLS / 1+ LINES MOD DUP NEWLN
|
||||
COLS * XYPOS! ;
|
||||
: _bs 0 ( blank ) XYPOS @ TUCK CELL! ( pos ) 1- XYPOS! ;
|
||||
: _bs 0x20 ( blank ) XYPOS @ TUCK CELL! ( pos ) 1- XYPOS! ;
|
||||
( ----- 403 )
|
||||
: (emit)
|
||||
DUP 0x08 = IF DROP _bs EXIT THEN
|
||||
@ -2231,7 +2231,7 @@ Load range: B402-B403
|
||||
DUP 0x20 < IF DROP EXIT THEN
|
||||
XYPOS @ CELL!
|
||||
XYPOS @ 1+ DUP COLS MOD IF XYPOS! ELSE _lf THEN ;
|
||||
: GRID$ 0 XYPOS! 0 XYMODE C! ;
|
||||
: GRID$ 0 XYPOS ! 0 XYMODE C! ;
|
||||
( ----- 410 )
|
||||
PS/2 keyboard subsystem
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
: COLS 80 ; : LINES 32 ;
|
||||
: CURSOR! ( pos -- ) COLS /MOD 6 PC! ( y ) 5 PC! ( x ) ;
|
||||
: CELL! ( c pos -- ) CURSOR! 0 PC! ;
|
||||
: CURSOR! ( new old -- )
|
||||
DROP COLS /MOD 6 PC! ( y ) 5 PC! ( x ) ;
|
||||
: CELL! ( c pos -- ) 0 CURSOR! 0 PC! ;
|
||||
: NEWLN ( ln -- ) DROP 0xa 0 PC! ;
|
||||
|
||||
SYSVARS 0x70 + CONSTANT GRID_MEM
|
||||
|
@ -42,13 +42,13 @@ previously enabled one.
|
||||
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
|
||||
LINES -- n Number of lines in the device
|
||||
CELL! c pos -- Set character at pos
|
||||
COLS -- n Number of columns in the device
|
||||
LINES -- n Number of lines in the device
|
||||
CELL! c pos -- Set character at pos
|
||||
|
||||
Optional:
|
||||
NEWLN ln -- "Enter" line ln
|
||||
CURSOR! pos -- Set cursor's position
|
||||
NEWLN ln -- "Enter" line ln
|
||||
CURSOR! new old -- Move cursor from old pos to new pos
|
||||
|
||||
"pos" is a simple number (y * cols) + x. For example, if we
|
||||
have 40 columns per line, the position (x, y) (12, 10) is 412.
|
||||
|
Loading…
Reference in New Issue
Block a user