From b90efb0f7fba9f38666d8d50d19009a630e20e02 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 8 May 2020 09:07:44 -0400 Subject: [PATCH] ti84: first glyph on screen! On the emulator of course... --- blk/522 | 8 ++++---- blk/555 | 6 +++--- blk/557 | 5 +++++ blk/558 | 2 +- emul/hw/ti/t6a04.c | 1 + recipes/ti84/xcomp.fs | 4 +++- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/blk/522 b/blk/522 index f6e8c7e..08ea390 100644 --- a/blk/522 +++ b/blk/522 @@ -4,13 +4,13 @@ 2 * OVER J 64 * I + + C@ 'X' = IF 1+ THEN LOOP 32 * C, LOOP DROP ; -: _l ( spit a line of u glyphs ) +: _l ( a u -- a, spit a line of u glyphs ) ( u ) 0 DO ( a ) DUP I 3 * + _g - LOOP DROP ; + LOOP ; : CPFNT3x5 0 , 0 , 0 C, ( space char ) - 530 LOAD BLK( 21 _l 192 + 21 _l 192 + 21 _l ( 63 ) - 531 LOAD BLK( 21 _l 192 + 10 _l ( 94! ) + 530 BLK@ BLK( 21 _l 192 + 21 _l 192 + 21 _l ( 63 ) + 531 BLK@ BLK( 21 _l 192 + 10 _l ( 94! ) ; diff --git a/blk/555 b/blk/555 index 974efa3..a19b126 100644 --- a/blk/555 +++ b/blk/555 @@ -1,15 +1,15 @@ ( Required config: TI_MEM ) : TI_MEM+ [ TI_MEM LITN ] @ + ; +TI_MEM : TI_MEM [ LITN ] ; : LCD_PORT_CMD 0x10 ; : LCD_PORT_DATA 0x11 ; : FNTW 3 ; : FNTH 5 ; ( 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 we have to. ) -: LCDWAIT +CODE LCDWAIT BEGIN, - LCD_PORT_CMD INAn, + 0x10 INAn, RLA, ( When 7th bit is clr, we can send a new cmd ) JRC, AGAIN, ;CODE -: LCD$ H@ TI_MEM ! FNTH 2 * 2+ ALLOT ; diff --git a/blk/557 b/blk/557 index c1808e5..0e64958 100644 --- a/blk/557 +++ b/blk/557 @@ -2,7 +2,12 @@ : _data! LCD_PORT_DATA PC! LCDWAIT ; : _data@ LCD_PORT_DATA PC@ LCDWAIT ; : LCDOFF 0x02 ( CMD_DISABLE ) _cmd ; +: LCDON 0x03 ( CMD_ENABLE ) _cmd ; : _col! ( col -- ) 0x20 ( CMD_COL ) + _cmd ; : _row! ( row -- ) 0x80 ( CMD_ROW ) + _cmd ; +: LCD$ + H@ TI_MEM ! FNTH 2 * 2+ ALLOT + LCDON 0x01 ( 8-bit mode ) _cmd +; diff --git a/blk/558 b/blk/558 index 930cb68..98af667 100644 --- a/blk/558 +++ b/blk/558 @@ -5,7 +5,7 @@ C@+ 2 PICK 8 -^ LSHIFT _data@ 8 LSHIFT OR LCD_BUF I + 2DUP FNTH + C! - SWAP 8 RSHIFT DUP 42 PC! SWAP C! + SWAP 8 RSHIFT SWAP C! LOOP 2DROP LCD_CURY C@ _row! FNTH 0 DO LCD_BUF I + C@ _data! LOOP diff --git a/emul/hw/ti/t6a04.c b/emul/hw/ti/t6a04.c index e93af99..179837a 100644 --- a/emul/hw/ti/t6a04.c +++ b/emul/hw/ti/t6a04.c @@ -10,6 +10,7 @@ void t6a04_init(T6A04 *lcd) lcd->currow = 0; lcd->curcol = 0; lcd->just_moved = true; + lcd->has8bitmode = false; } uint8_t t6a04_cmd_rd(T6A04 *lcd) diff --git a/recipes/ti84/xcomp.fs b/recipes/ti84/xcomp.fs index 1d4c8bc..1590789 100644 --- a/recipes/ti84/xcomp.fs +++ b/recipes/ti84/xcomp.fs @@ -3,6 +3,7 @@ RAMSTART 0x70 + CONSTANT TI_MEM 212 LOAD ( z80 assembler ) 262 LOAD ( xcomp ) +522 LOAD ( font compiler ) : CODE XCODE ; : IMMEDIATE XIMM ; : (entry) (xentry) ; @@ -13,11 +14,12 @@ CURRENT @ XCURRENT ! 282 LOAD ( boot.z80 ) 555 LOAD ( ti.z80 ) 393 LOAD ( icore ) +(entry) ~FNT CPFNT3x5 (entry) _ ( Update LATEST ) PC ORG @ 8 + ! 422 437 XPACKR ( core ) 556 558 XPACKR ( ti ) -," 42 42 PC! LCD$ 43 43 PC! BYE " +," 42 42 PC! LCD$ ' ~FNT 5 + _glyph> 43 43 PC! BYE " ORG @ 256 /MOD 2 PC! 2 PC! H@ 256 /MOD 2 PC! 2 PC!