mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-28 08:28:06 +11:00
ti-84+: wip
I need RSHIFT and LSHIFT first...
This commit is contained in:
parent
f2f3474698
commit
4e98ef11bd
2
blk/001
2
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
|
||||
|
||||
|
||||
|
||||
|
6
blk/550
Normal file
6
blk/550
Normal file
@ -0,0 +1,6 @@
|
||||
TI-84+ Recipe
|
||||
|
||||
Support code for the TI-84+ recipe. Contains drivers for the
|
||||
keyboard and LCD.
|
||||
|
||||
551 LCD
|
16
blk/551
Normal file
16
blk/551
Normal file
@ -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.)
|
16
blk/552
Normal file
16
blk/552
Normal file
@ -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.)
|
16
blk/553
Normal file
16
blk/553
Normal file
@ -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.)
|
3
blk/554
Normal file
3
blk/554
Normal file
@ -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.
|
16
blk/555
Normal file
16
blk/555
Normal file
@ -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+
|
11
blk/556
Normal file
11
blk/556
Normal file
@ -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 ;
|
3
blk/557
Normal file
3
blk/557
Normal file
@ -0,0 +1,3 @@
|
||||
( Load a "glyph line" from buffer, left part being in MSB and
|
||||
right part being in LSB. )
|
||||
: _gl@
|
Loading…
Reference in New Issue
Block a user