mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-23 15:58:05 +11:00
grid: Add CURSOR! to the grid protocol
With the move of CVM's forth to the grid protocol, we've lost the cursor's visual indication. Now, we have it back. The challenge now is in implementing it in SMS' text mode. In mode 4, it's easy to mark a cell as inverted, but in text mode, that's not possible.
This commit is contained in:
parent
d3049b2404
commit
7bfec5d9e9
14
blk.fs
14
blk.fs
@ -2214,24 +2214,24 @@ See doc/grid.txt.
|
|||||||
Load range: B402-B403
|
Load range: B402-B403
|
||||||
( ----- 402 )
|
( ----- 402 )
|
||||||
: XYPOS [ GRID_MEM LITN ] ; : XYMODE [ GRID_MEM LITN ] 2+ ;
|
: XYPOS [ GRID_MEM LITN ] ; : XYMODE [ GRID_MEM LITN ] 2+ ;
|
||||||
: _cl* COLS LINES * ;
|
'? CURSOR! NIP NOT [IF] : CURSOR! DROP ; [THEN]
|
||||||
: AT-XY ( x y -- ) COLS * + _cl* MOD XYPOS ! ;
|
: XYPOS! COLS LINES * MOD DUP CURSOR! XYPOS ! ;
|
||||||
|
: AT-XY ( x y -- ) COLS * + XYPOS! ;
|
||||||
'? NEWLN NIP NOT [IF]
|
'? NEWLN NIP NOT [IF]
|
||||||
: NEWLN ( ln -- ) COLS * DUP COLS + SWAP DO 0 I CELL! LOOP ;
|
: NEWLN ( ln -- ) COLS * DUP COLS + SWAP DO 0 I CELL! LOOP ;
|
||||||
[THEN]
|
[THEN]
|
||||||
: _lf XYMODE C@ IF EXIT THEN
|
: _lf XYMODE C@ IF EXIT THEN
|
||||||
XYPOS @ COLS / 1+ LINES MOD DUP NEWLN
|
XYPOS @ COLS / 1+ LINES MOD DUP NEWLN
|
||||||
COLS * XYPOS ! ;
|
COLS * XYPOS! ;
|
||||||
: _bs 0 ( blank ) XYPOS @ TUCK CELL! ( pos ) 1-
|
: _bs 0 ( blank ) XYPOS @ TUCK CELL! ( pos ) 1- XYPOS! ;
|
||||||
_cl* MOD XYPOS ! ;
|
|
||||||
( ----- 403 )
|
( ----- 403 )
|
||||||
: (emit)
|
: (emit)
|
||||||
DUP 0x08 = IF DROP _bs EXIT THEN
|
DUP 0x08 = IF DROP _bs EXIT THEN
|
||||||
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 MOD IF XYPOS ! ELSE _lf THEN ;
|
XYPOS @ 1+ DUP COLS MOD IF XYPOS! ELSE _lf THEN ;
|
||||||
: GRID$ 0 XYPOS ! 0 XYMODE C! ;
|
: GRID$ 0 XYPOS! 0 XYMODE C! ;
|
||||||
( ----- 410 )
|
( ----- 410 )
|
||||||
PS/2 keyboard subsystem
|
PS/2 keyboard subsystem
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
: COLS 80 ; : LINES 32 ;
|
: COLS 80 ; : LINES 32 ;
|
||||||
: CELL! ( g pos -- )
|
: CURSOR! ( pos -- ) COLS /MOD 6 PC! ( y ) 5 PC! ( x ) ;
|
||||||
COLS /MOD 6 PC! ( y ) 5 PC! ( x ) 0x20 + 0 PC! ;
|
: CELL! ( g pos -- ) CURSOR! 0x20 + 0 PC! ;
|
||||||
: NEWLN ( ln -- ) DROP 0xa 0 PC! ;
|
: NEWLN ( ln -- ) DROP 0xa 0 PC! ;
|
||||||
|
|
||||||
SYSVARS 0x70 + CONSTANT GRID_MEM
|
SYSVARS 0x70 + CONSTANT GRID_MEM
|
||||||
|
@ -48,6 +48,7 @@ CELL! g pos -- Set glyph at pos
|
|||||||
|
|
||||||
Optional:
|
Optional:
|
||||||
NEWLN ln -- "Enter" line ln
|
NEWLN ln -- "Enter" line ln
|
||||||
|
CURSOR! pos -- Set cursor's position
|
||||||
|
|
||||||
"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 line, the position (x, y) (12, 10) is 412.
|
have 40 columns per line, the position (x, y) (12, 10) is 412.
|
||||||
@ -69,3 +70,7 @@ time.
|
|||||||
If it's not defined, the grid system uses multiple CELL!
|
If it's not defined, the grid system uses multiple CELL!
|
||||||
calls to clear it. On some devices, this is highly inefficient.
|
calls to clear it. On some devices, this is highly inefficient.
|
||||||
Drivers for those devices should define NEWLINE.
|
Drivers for those devices should define NEWLINE.
|
||||||
|
|
||||||
|
CURSOR! is called whenever we change the cursor's position. If
|
||||||
|
not implemented, it will be a noop. It is never called with an
|
||||||
|
out of range "pos" (greater than COLS*LINES).
|
||||||
|
Loading…
Reference in New Issue
Block a user