diff --git a/blk/001 b/blk/001 index e84934b..e60eec1 100644 --- a/blk/001 +++ b/blk/001 @@ -9,7 +9,7 @@ MASTER INDEX 370 SD Card driver 390 Inner core 420 Core words 480 AT28 Driver 490 TRS-80 Recipe 520 Fonts - +550 TI-84+ Recipe diff --git a/blk/550 b/blk/550 new file mode 100644 index 0000000..1792232 --- /dev/null +++ b/blk/550 @@ -0,0 +1,6 @@ +TI-84+ Recipe + +Support code for the TI-84+ recipe. Contains drivers for the +keyboard and LCD. + +551 LCD diff --git a/blk/551 b/blk/551 new file mode 100644 index 0000000..aa9b242 --- /dev/null +++ b/blk/551 @@ -0,0 +1,16 @@ +TI-84+ LCD driver + +Implement (emit) on TI-84+ (for now)'s LCD screen. Load with +"555 LOAD". + +The screen is 96x64 pixels. The 64 rows are addressed directly +with CMD_ROW but columns are addressed in chunks of 6 or 8 bits +(there are two modes). + +In 6-bit mode, there are 16 visible columns. In 8-bit mode, +there are 12. + +Note that "X-increment" and "Y-increment" work in the opposite +way than what most people expect. Y moves left and right, X +moves up and down. + (cont.) diff --git a/blk/552 b/blk/552 new file mode 100644 index 0000000..e26906a --- /dev/null +++ b/blk/552 @@ -0,0 +1,16 @@ +# Z-Offset + +This LCD has a "Z-Offset" parameter, allowing to offset rows on +the screen however we wish. This is handy because it allows us +to scroll more efficiently. Instead of having to copy the LCD +ram around at each linefeed (or instead of having to maintain +an in-memory buffer), we can use this feature. + +The Z-Offet goes upwards, with wrapping. For example, if we +have an 8 pixels high line at row 0 and if our offset is 8, +that line will go up 8 pixels, wrapping itself to the bottom of +the screen. + +The principle is this: The active line is always the bottom +one. Therefore, when active row is 0, Z is FNT_HEIGHT+1, when +row is 1, Z is (FNT_HEIGHT+1)*2, When row is 8, Z is 0. (cont.) diff --git a/blk/553 b/blk/553 new file mode 100644 index 0000000..3e1e8f7 --- /dev/null +++ b/blk/553 @@ -0,0 +1,16 @@ +# 6/8 bit columns and smaller fonts + +If your glyphs, including padding, are 6 or 8 pixels wide, +you're in luck because pushing them to the LCD can be done in a +very efficient manner. Unfortunately, this makes the LCD +unsuitable for a Collapse OS shell: 6 pixels per glyph gives us +only 16 characters per line, which is hardly usable. + +This is why we have this buffering system. How it works is that +we're always in 8-bit mode and we hold the whole area (8 pixels +wide by FNT_HEIGHT high) in memory. When we want to put a glyph +to screen, we first read the contents of that area, then add +our new glyph, offsetted and masked, to that buffer, then push +the buffer back to the LCD. If the glyph is split, move to the +next area and finish the job. + (cont.) diff --git a/blk/554 b/blk/554 new file mode 100644 index 0000000..3d65dbc --- /dev/null +++ b/blk/554 @@ -0,0 +1,3 @@ +That being said, it's important to define clearly what CURX and +CURY variable mean. Those variable keep track of the current +position *in pixels*, in both axes. diff --git a/blk/555 b/blk/555 new file mode 100644 index 0000000..6415987 --- /dev/null +++ b/blk/555 @@ -0,0 +1,16 @@ +( Required config: TI_MEM ) +: TI_MEM+ [ TI_MEM LITN ] + ; +: LCD_PORT_CMD 0x10 ; +: LCD_PORT_DATA 0x11 ; +: FNT_WIDTH 3 ; +: FNT_HEIGHT 5 ; +( Current Y position on the LCD, that is, where we're going to + spit our next glyph. ) +: LCD_CURY 0 TI_MEM+ ; +: LCD_CURX 1 TI_MEM+ ; +( two pixel buffers that are 8 pixels wide (1b) by FNT_HEIGHT + pixels high. This is where we compose our resulting pixels + blocks when spitting a glyph. ) +: LCD_BUF 2 TI_MEM+ ; + +1 2 LOADR+ diff --git a/blk/556 b/blk/556 new file mode 100644 index 0000000..028716e --- /dev/null +++ b/blk/556 @@ -0,0 +1,11 @@ +: _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 ; +: LCDOFF 0x02 ( CMD_DISABLE ) _cmd ; +: _col! ( col -- ) + 0x20 ( CMD_COL ) + _cmd ; +: _row! ( row -- ) + 0x80 ( CMD_ROW ) + _cmd ; diff --git a/blk/557 b/blk/557 new file mode 100644 index 0000000..743d2b7 --- /dev/null +++ b/blk/557 @@ -0,0 +1,3 @@ +( Load a "glyph line" from buffer, left part being in MSB and + right part being in LSB. ) +: _gl@ diff --git a/blk/558 b/blk/558 new file mode 100644 index 0000000..2af8a16 --- /dev/null +++ b/blk/558 @@ -0,0 +1,5 @@ +: _glyph> ( a -- ) + LCD_CURY C@ _row! LCD_CURX C@ 8 /MOD _col! ( a coff ) + 0x05 ( XINC ) _cmd _data@ DROP + FNT_HEIGHT 0 DO LOOP +