瀏覽代碼

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.
master
Virgil Dupras 3 年之前
父節點
當前提交
cf79ceefea
共有 4 個檔案被更改,包括 19 行新增14 行删除
  1. +7
    -3
      arch/z80/sms/blk.fs
  2. +4
    -4
      blk.fs
  3. +3
    -2
      cvm/forth.fs
  4. +5
    -5
      doc/protocol.txt

+ 7
- 3
arch/z80/sms/blk.fs 查看文件

@@ -29,8 +29,13 @@ always stay zero. )
( blank row ) 4 _zero ; ( blank row ) 4 _zero ;
: CELL! ( c pos ) : CELL! ( c pos )
2 * 0x7800 OR _ctl ( c ) 2 * 0x7800 OR _ctl ( c )
0x20 - ( glyph ) 0x5e MOD _data 0 _data ;
0x20 - ( glyph ) 0x5e MOD _data ;
( ----- 604 ) ( ----- 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$ : VDP$
9 0 DO _idat I 2 * + @ _ctl LOOP _blank 9 0 DO _idat I 2 * + @ _ctl LOOP _blank
( palettes ) ( palettes )
@@ -40,8 +45,7 @@ always stay 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 ;
: COLS 32 ; : LINES 24 ;
( ----- 610 ) ( ----- 610 )
Pad driver - read input from MD controller Pad driver - read input from MD controller




+ 4
- 4
blk.fs 查看文件

@@ -2214,8 +2214,8 @@ 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+ ;
'? 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! ; : AT-XY ( x y -- ) COLS * + XYPOS! ;
'? NEWLN NIP NOT [IF] '? NEWLN NIP NOT [IF]
: NEWLN ( ln -- ) COLS * DUP COLS + SWAP DO 0x20 I CELL! LOOP ; : 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 : _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- XYPOS! ;
: _bs 0x20 ( blank ) XYPOS @ TUCK CELL! ( pos ) 1- XYPOS! ;
( ----- 403 ) ( ----- 403 )
: (emit) : (emit)
DUP 0x08 = IF DROP _bs EXIT THEN DUP 0x08 = IF DROP _bs EXIT THEN
@@ -2231,7 +2231,7 @@ Load range: B402-B403
DUP 0x20 < IF DROP EXIT THEN DUP 0x20 < 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




+ 3
- 2
cvm/forth.fs 查看文件

@@ -1,6 +1,7 @@
: COLS 80 ; : LINES 32 ; : 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! ; : NEWLN ( ln -- ) DROP 0xa 0 PC! ;


SYSVARS 0x70 + CONSTANT GRID_MEM SYSVARS 0x70 + CONSTANT GRID_MEM


+ 5
- 5
doc/protocol.txt 查看文件

@@ -42,13 +42,13 @@ previously enabled one.
A grid is a device that shows as a grid of ASCII characters and 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
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: 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 "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.


Loading…
取消
儲存