From 58ec54fc979f72b0a77efe356551d2c0761825cf Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 8 May 2020 07:56:34 -0400 Subject: [PATCH] ti84: wip Gave more priority to CPU in the emulator because initialization would otherwise be horrendously slow. --- blk/555 | 16 +++++++++++++++- blk/556 | 6 ------ blk/557 | 11 +++-------- emul/hw/ti/ti84.c | 5 +---- recipes/ti84/xcomp.fs | 5 ++++- 5 files changed, 23 insertions(+), 20 deletions(-) diff --git a/blk/555 b/blk/555 index 2a492bf..974efa3 100644 --- a/blk/555 +++ b/blk/555 @@ -1 +1,15 @@ -1 3 LOADR+ +( Required config: TI_MEM ) +: 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 + BEGIN, + LCD_PORT_CMD 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/556 b/blk/556 index cfb2ce1..ca268ae 100644 --- a/blk/556 +++ b/blk/556 @@ -1,9 +1,3 @@ -( Required config: TI_MEM ) -: TI_MEM+ [ TI_MEM LITN ] @ + ; -: LCD_PORT_CMD 0x10 ; -: LCD_PORT_DATA 0x11 ; -: FNTW 3 ; -: FNTH 5 ; ( Current Y position on the LCD, that is, where we're going to spit our next glyph. ) : LCD_CURY 0 TI_MEM+ ; diff --git a/blk/557 b/blk/557 index df01a7a..c1808e5 100644 --- a/blk/557 +++ b/blk/557 @@ -1,13 +1,8 @@ - -: _wait ( Wait until the lcd is ready to receive a command ) - ( When 7th bit is cleared, we can send a new command ) - BEGIN LCD_PORT_CMD PC@ 0x80 AND NOT UNTIL ; -: _cmd LCD_PORT_CMD PC! _wait ; -: _data! LCD_PORT_DATA PC! _wait ; -: _data@ LCD_PORT_DATA PC@ _wait ; +: _cmd LCD_PORT_CMD PC! LCDWAIT ; +: _data! LCD_PORT_DATA PC! LCDWAIT ; +: _data@ LCD_PORT_DATA PC@ LCDWAIT ; : LCDOFF 0x02 ( CMD_DISABLE ) _cmd ; : _col! ( col -- ) 0x20 ( CMD_COL ) + _cmd ; : _row! ( row -- ) 0x80 ( CMD_ROW ) + _cmd ; -: LCD$ H@ TI_MEM ! FNTH 2 * 2+ ALLOT ; diff --git a/emul/hw/ti/ti84.c b/emul/hw/ti/ti84.c index f747f93..ffe1d08 100644 --- a/emul/hw/ti/ti84.c +++ b/emul/hw/ti/ti84.c @@ -225,11 +225,8 @@ void draw_pixels() void event_loop() { while (1) { - emul_step(); + emul_steps(100); if (lcd_changed) { - // To avoid overdrawing, we'll let the CPU run a bit to finish its - // drawing operation. - emul_steps(100); draw_pixels(); } // A low tech way of checking when the window was closed. The proper way diff --git a/recipes/ti84/xcomp.fs b/recipes/ti84/xcomp.fs index 83eadb1..1d4c8bc 100644 --- a/recipes/ti84/xcomp.fs +++ b/recipes/ti84/xcomp.fs @@ -11,10 +11,13 @@ RAMSTART 0x70 + CONSTANT TI_MEM CURRENT @ XCURRENT ! 282 LOAD ( boot.z80 ) +555 LOAD ( ti.z80 ) 393 LOAD ( icore ) (entry) _ ( Update LATEST ) PC ORG @ 8 + ! -," 42 42 PC! BYE " +422 437 XPACKR ( core ) +556 558 XPACKR ( ti ) +," 42 42 PC! LCD$ 43 43 PC! BYE " ORG @ 256 /MOD 2 PC! 2 PC! H@ 256 /MOD 2 PC! 2 PC!