1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-02 10:20:55 +11:00

Compare commits

..

3 Commits

Author SHA1 Message Date
Virgil Dupras
b90efb0f7f ti84: first glyph on screen!
On the emulator of course...
2020-05-08 09:07:44 -04:00
Virgil Dupras
58ec54fc97 ti84: wip
Gave more priority to CPU in the emulator because initialization would
otherwise be horrendously slow.
2020-05-08 07:56:34 -04:00
Virgil Dupras
114e753b64 ti84: WIP 2020-05-08 06:50:34 -04:00
9 changed files with 87 additions and 47 deletions

View File

@ -4,13 +4,13 @@
2 * 2 *
OVER J 64 * I + + C@ 'X' = IF 1+ THEN OVER J 64 * I + + C@ 'X' = IF 1+ THEN
LOOP 32 * C, LOOP DROP ; 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 ) ( u ) 0 DO ( a )
DUP I 3 * + _g DUP I 3 * + _g
LOOP DROP ; LOOP ;
: CPFNT3x5 : CPFNT3x5
0 , 0 , 0 C, ( space char ) 0 , 0 , 0 C, ( space char )
530 LOAD BLK( 21 _l 192 + 21 _l 192 + 21 _l ( 63 ) 530 BLK@ BLK( 21 _l 192 + 21 _l 192 + 21 _l ( 63 )
531 LOAD BLK( 21 _l 192 + 10 _l ( 94! ) 531 BLK@ BLK( 21 _l 192 + 10 _l ( 94! )
; ;

29
blk/555
View File

@ -1,16 +1,15 @@
( Required config: TI_MEM ) ( Required config: TI_MEM )
: TI_MEM+ [ TI_MEM LITN ] + ; : TI_MEM+ [ TI_MEM LITN ] @ + ;
: LCD_PORT_CMD 0x10 ; TI_MEM : TI_MEM [ LITN ] ;
: LCD_PORT_DATA 0x11 ; : LCD_PORT_CMD 0x10 ; : LCD_PORT_DATA 0x11 ;
: FNT_WIDTH 3 ; : FNTW 3 ; : FNTH 5 ;
: FNT_HEIGHT 5 ; ( Wait until the lcd is ready to receive a command. It's a bit
( Current Y position on the LCD, that is, where we're going to weird to implement a waiting routine in asm, but the forth
spit our next glyph. ) version is a bit heavy and we don't want to wait longer than
: LCD_CURY 0 TI_MEM+ ; we have to. )
: LCD_CURX 1 TI_MEM+ ; CODE LCDWAIT
( two pixel buffers that are 8 pixels wide (1b) by FNT_HEIGHT BEGIN,
pixels high. This is where we compose our resulting pixels 0x10 INAn,
blocks when spitting a glyph. ) RLA, ( When 7th bit is clr, we can send a new cmd )
: LCD_BUF 2 TI_MEM+ ; JRC, AGAIN,
;CODE
1 2 LOADR+

19
blk/556
View File

@ -1,11 +1,8 @@
: _wait ( Wait until the lcd is ready to receive a command ) ( Current Y position on the LCD, that is, where we're going to
( When 7th bit is cleared, we can send a new command ) spit our next glyph. )
BEGIN LCD_PORT_CMD PC@ 0x80 AND NOT UNTIL ; : LCD_CURY 0 TI_MEM+ ;
: _cmd LCD_PORT_CMD PC! _wait ; : LCD_CURX 1 TI_MEM+ ;
: _data! LCD_PORT_DATA PC! _wait ; ( two pixel buffers that are 8 pixels wide (1b) by FNT_HEIGHT
: _data@ LCD_PORT_DATA PC@ _wait ; pixels high. This is where we compose our resulting pixels
: LCDOFF 0x02 ( CMD_DISABLE ) _cmd ; blocks when spitting a glyph. )
: _col! ( col -- ) : LCD_BUF 2 TI_MEM+ ;
0x20 ( CMD_COL ) + _cmd ;
: _row! ( row -- )
0x80 ( CMD_ROW ) + _cmd ;

16
blk/557
View File

@ -1,3 +1,13 @@
( Load a "glyph line" from buffer, left part being in MSB and : _cmd LCD_PORT_CMD PC! LCDWAIT ;
right part being in LSB. ) : _data! LCD_PORT_DATA PC! LCDWAIT ;
: _gl@ : _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
;

17
blk/558
View File

@ -1,5 +1,16 @@
: _glyph> ( a -- ) : _glyph> ( a -- )
LCD_CURY C@ _row! LCD_CURX C@ 8 /MOD _col! ( a coff ) LCD_CURY C@ _row! LCD_CURX C@ 8 /MOD _col! ( a coff )
0x05 ( XINC ) _cmd _data@ DROP 0x05 ( XINC ) _cmd _data@ DROP SWAP
FNT_HEIGHT 0 DO LOOP FNTH 0 DO ( 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!
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 [ 96 FNTW - LITN ] > IF DROP 0 THEN
LCD_CURX C! ;

View File

@ -10,6 +10,7 @@ void t6a04_init(T6A04 *lcd)
lcd->currow = 0; lcd->currow = 0;
lcd->curcol = 0; lcd->curcol = 0;
lcd->just_moved = true; lcd->just_moved = true;
lcd->has8bitmode = false;
} }
uint8_t t6a04_cmd_rd(T6A04 *lcd) uint8_t t6a04_cmd_rd(T6A04 *lcd)

View File

@ -225,11 +225,8 @@ void draw_pixels()
void event_loop() void event_loop()
{ {
while (1) { while (1) {
emul_step(); emul_steps(100);
if (lcd_changed) { if (lcd_changed) {
// To avoid overdrawing, we'll let the CPU run a bit to finish its
// drawing operation.
emul_steps(100);
draw_pixels(); draw_pixels();
} }
// A low tech way of checking when the window was closed. The proper way // A low tech way of checking when the window was closed. The proper way

View File

@ -1,15 +1,15 @@
TARGET = os.bin TARGET = stage1.bin
BASEDIR = ../.. BASEDIR = ../..
ZASM = $(BASEDIR)/emul/zasm/zasm FDIR = $(BASEDIR)/forth
KERNEL = $(BASEDIR)/kernel EDIR = $(BASEDIR)/emul
APPS = $(BASEDIR)/apps STAGE2 = $(EDIR)/stage2
EMUL = $(BASEDIR)/emul/hw/ti/ti84 EMUL = $(BASEDIR)/emul/hw/ti/ti84
MKTIUPGRADE = mktiupgrade MKTIUPGRADE = mktiupgrade
.PHONY: all .PHONY: all
all: $(TARGET) all: $(TARGET)
$(TARGET): glue.asm $(TARGET): xcomp.fs $(STAGE2)
$(ZASM) $(KERNEL) $(APPS) < glue.asm > $@ cat xcomp.fs | $(STAGE2) > $@
$(EMUL): $(EMUL):
$(MAKE) -C ${@:%/ti84=%} $(MAKE) -C ${@:%/ti84=%}

25
recipes/ti84/xcomp.fs Normal file
View File

@ -0,0 +1,25 @@
0x8000 CONSTANT RAMSTART
0xb000 CONSTANT RS_ADDR
RAMSTART 0x70 + CONSTANT TI_MEM
212 LOAD ( z80 assembler )
262 LOAD ( xcomp )
522 LOAD ( font compiler )
: CODE XCODE ;
: IMMEDIATE XIMM ;
: (entry) (xentry) ;
: : [ ' X: , ] ;
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$ ' ~FNT 5 + _glyph> 43 43 PC! BYE "
ORG @ 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC!