瀏覽代碼

ti84: use Grid subsystem

Also, rename CLRLN to NEWLN and make it clear that it's only called
on entering a new line. This way, we can set Z offset in there for
the TI-84+ LCD driver.
master
Virgil Dupras 3 年之前
父節點
當前提交
c7d8de25b2
共有 11 個文件被更改,包括 39 次插入35 次删除
  1. +1
    -0
      arch/z80/ti84/blk/605
  2. +1
    -5
      arch/z80/ti84/blk/606
  3. +1
    -1
      arch/z80/ti84/blk/607
  4. +3
    -6
      arch/z80/ti84/blk/608
  5. +10
    -9
      arch/z80/ti84/blk/609
  6. +0
    -4
      arch/z80/ti84/blk/610
  7. +4
    -2
      arch/z80/ti84/xcomp.fs
  8. +2
    -1
      blk/263
  9. +1
    -0
      blk/270
  10. +4
    -4
      blk/402
  11. +12
    -3
      doc/protocol.txt

+ 1
- 0
arch/z80/ti84/blk/605 查看文件

@@ -1,6 +1,7 @@
( Required config: LCD_MEM )
: _mem+ [ LCD_MEM LITN ] @ + ;
: FNTW 3 ; : FNTH 5 ;
: COLS 96 FNTW 1+ / ; : LINES 64 FNTH 1+ / ;
( Wait until the lcd is ready to receive a command. It's a bit
weird to implement a waiting routine in asm, but the forth
version is a bit heavy and we don't want to wait longer than


+ 1
- 5
arch/z80/ti84/blk/606 查看文件

@@ -1,11 +1,7 @@
( Current Y position on the LCD, that is, where we're going to
spit our next glyph. )
: LCD_CURY 0 _mem+ ;
: LCD_CURX 1 _mem+ ;
( two pixel buffers that are 8 pixels wide (1b) by FNTH
pixels high. This is where we compose our resulting pixels
blocks when spitting a glyph. )
: LCD_BUF 2 _mem+ ;
: LCD_BUF 0 _mem+ ;
: _cmd 0x10 ( CMD ) PC! _wait ;
: _data! 0x11 ( DATA ) PC! _wait ;
: _data@ 0x11 ( DATA ) PC@ _wait ;


+ 1
- 1
arch/z80/ti84/blk/607 查看文件

@@ -3,7 +3,7 @@
: _col! ( col -- ) 0x20 + _cmd ;
: _row! ( row -- ) 0x80 + _cmd ;
: LCD$
H@ [ LCD_MEM LITN ] ! FNTH 2 * 2+ ALLOT
H@ [ LCD_MEM LITN ] ! FNTH 2 * ALLOT
LCDON 0x01 ( 8-bit mode ) _cmd
FNTH 1+ _zoff!
;

+ 3
- 6
arch/z80/ti84/blk/608 查看文件

@@ -5,10 +5,7 @@
11 0 DO 0 _data! LOOP
_xinc 0 _data!
LOOP ;
: _clrln ( n ) FNTH 1+ _clrrows ;
: NEWLN ( ln -- )
DUP 1+ FNTH 1+ * _zoff!
FNTH 1+ * FNTH 1+ _clrrows ;
: LCDCLR 0 64 _clrrows ;
( Changes the current line and go back to leftmost column )
: _lf
LCD_CURY C@ FNTH 1+ + DUP 63 > IF DROP 0 THEN
DUP _clrln DUP FNTH 1+ + _zoff!
LCD_CURY C! 0 LCD_CURX C! ;

+ 10
- 9
arch/z80/ti84/blk/609 查看文件

@@ -1,15 +1,16 @@
: _glyph> ( a -- )
LCD_CURY C@ _row! LCD_CURX C@ 8 /MOD _col! ( a coff )
_xinc _data@ DROP SWAP
FNTH 0 DO ( coff a )
: _atrow! ( pos -- ) COLS / FNTH 1+ * _row! ;
: _tocol ( pos -- col off ) COLS MOD FNTW 1+ * 8 /MOD ;
: CELL! ( g pos -- )
DUP _atrow! DUP _tocol _col! ROT ( pos coff g )
FNTH * ~FNT + ( pos coff a )
_xinc _data@ DROP
FNTH 0 DO ( pos coff a )
C@+ 2 PICK 8 -^ LSHIFT
_data@ 8 LSHIFT OR
LCD_BUF I + 2DUP FNTH + C!
SWAP 8 RSHIFT SWAP C!
LOOP 2DROP
LCD_CURY C@ _row!
DUP _atrow!
FNTH 0 DO LCD_BUF I + C@ _data! LOOP
LCD_CURY C@ _row! LCD_CURX C@ 8 / 1+ _col!
FNTH 0 DO LCD_BUF FNTH + I + C@ _data! LOOP
LCD_CURX C@ FNTW + 1+ DUP LCD_CURX C! ( x )
96 FNTW - > IF _lf THEN ;
DUP _atrow! _tocol NIP 1+ _col!
FNTH 0 DO LCD_BUF FNTH + I + C@ _data! LOOP ;

+ 0
- 4
arch/z80/ti84/blk/610 查看文件

@@ -1,4 +0,0 @@
: (emit)
DUP 0xd = IF DROP _lf EXIT THEN
DUP 0x20 0x7e =><= NOT IF DROP EXIT THEN
0x20 - FNTH * ~FNT + _glyph> ;

+ 4
- 2
arch/z80/ti84/xcomp.fs 查看文件

@@ -3,7 +3,8 @@
RS_ADDR 0x80 - CONSTANT SYSVARS
0x8000 CONSTANT HERESTART
SYSVARS 0x70 + CONSTANT LCD_MEM
SYSVARS 0x72 + CONSTANT KBD_MEM
SYSVARS 0x72 + CONSTANT GRID_MEM
SYSVARS 0x74 + CONSTANT KBD_MEM
0x01 CONSTANT KBD_PORT
5 LOAD ( z80 assembler )
: ZFILL, ( u ) 0 DO 0 A, LOOP ;
@@ -64,7 +65,8 @@ CURRENT @ XCURRENT !
283 335 LOADR ( boot.z80 )
353 LOAD ( xcomp core low )
CREATE ~FNT CPFNT3x5
605 610 LOADR ( LCD low )
605 609 LOADR ( LCD low )
402 403 LOADR ( Grid )
616 620 LOADR ( KBD low )
390 LOAD ( xcomp core high )
(entry) _


+ 2
- 1
blk/263 查看文件

@@ -7,7 +7,8 @@ CREATE XCURRENT 0 ,
DUP ORG @ > IF ORG @ - BIN( @ + THEN ;
: XFIND XCURRENT @ SWAP _find DROP _xapply ;
: XLITN LIT" (n)" XFIND , , ;
: X' XCON ' XCOFF ; : X['] XCON ' _xapply XLITN XCOFF ;
: X' XCON ' XCOFF ; : X'? XCON '? XCOFF ;
: X['] XCON ' _xapply XLITN XCOFF ;
: XCOMPILE XCON ' _xapply XLITN
LIT" ," FIND DROP _xapply , XCOFF ;
: X[COMPILE] XCON ' _xapply , XCOFF ;

+ 1
- 0
blk/270 查看文件

@@ -1,4 +1,5 @@
: CODE XCODE ;
: '? X'? ;
: ['] X['] ; IMMEDIATE
: COMPILE XCOMPILE ; IMMEDIATE
: [COMPILE] X[COMPILE] ; IMMEDIATE


+ 4
- 4
blk/402 查看文件

@@ -1,11 +1,11 @@
: XYPOS [ GRID_MEM LITN ] ;
: _cl* COLS LINES * ;
: AT-XY ( x y -- ) LINES * + _cl* MOD XYPOS ! ;
'? CLRLN NIP NOT [IF]
: CLRLN ( ln -- ) COLS * DUP COLS + SWAP DO 0 I CELL! LOOP ;
'? NEWLN NIP NOT [IF]
: NEWLN ( ln -- ) COLS * DUP COLS + SWAP DO 0 I CELL! LOOP ;
[THEN]
: _lf
XYPOS @ COLS / 1+ DUP CLRLN
COLS * _cl* MOD XYPOS ! ;
XYPOS @ COLS / 1+ LINES MOD DUP NEWLN
COLS * XYPOS ! ;
: _bs 0 ( blank ) XYPOS @ TUCK CELL! ( pos ) 1-
_cl* MOD XYPOS ! ;

+ 12
- 3
doc/protocol.txt 查看文件

@@ -47,7 +47,7 @@ LINES -- n Number of lines in the device
CELL! g pos -- Set glyph at pos

Optional:
CLRLN ln -- Clear line number ln.
NEWLN ln -- "Enter" line ln

"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.
@@ -57,6 +57,15 @@ number of glyphs in the font, it's up to CELL! to ignore it.

Glyph 0 is always blank.

If CLRLN is not defined, the grid system uses multiple CELL!
NEWLN is called when we "enter" a new line, that is, when we
overflow from previous line or when 0x0d ( ASCII CR ) is emit-
ted.

When this is called, the line being entered should be cleared
of its contents. On some systems, some kinf of screen offset
might be have to be set to give a "scrolling" effect. Now's the
time.

If it's not defined, the grid system uses multiple CELL!
calls to clear it. On some devices, this is highly inefficient.
Drivers for those devices should define CLRLN.
Drivers for those devices should define NEWLINE.

Loading…
取消
儲存