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

Compare commits

...

3 Commits

Author SHA1 Message Date
Virgil Dupras
67f689260f ti/lcd: Add scrolling through z-offset 2019-11-09 08:25:10 -05:00
Virgil Dupras
6a70a0e5e6 ti/lcd: wrap rows on overflow 2019-11-09 08:09:01 -05:00
Virgil Dupras
b27a71cb88 ti/kbd: fix space character 2019-11-09 08:01:03 -05:00
2 changed files with 43 additions and 7 deletions

View File

@ -147,6 +147,6 @@ kbdGetC:
.db 0xfd, 0x0d, '"' ,'W' ,'R', 'M', 'H', 0, 0
.db 0xfb, '?', 0, 'V', 'Q', 'L', 'G', 0, 0
.db 0xf7, ':', 'Z', 'U', 'P', 'K', 'F', 'C', 0
.db 0xef, '_', 'Y', 'T', 'O', 'J', 'E', 'B', 0
.db 0xef, ' ', 'Y', 'T', 'O', 'J', 'E', 'B', 0
.db 0xdf, 0, 'X', 'S', 'N', 'I', 'D', 'A', KBD_KEY_ALPHA
.db 0xbf, 0, 0, 0, 0, 0, KBD_KEY_2ND, 0, 0x7f

View File

@ -2,9 +2,30 @@
;
; Implement PutC on TI-84+ (for now)'s LCD screen.
;
; 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.
;
;
; *** 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.
;
; *** Requirements ***
; fnt/mgm
;
@ -41,11 +62,15 @@ lcdInit:
; Clear screen
call lcdClrScr
; We begin with a Z offset of FNT_HEIGHT+1
ld a, LCD_CMD_ZOFFSET+FNT_HEIGHT+1
call lcdCmd
; Enable the LCD
ld a, LCD_CMD_ENABLE
call lcdCmd
; Hack to get LCD to work. According to WikiTI, we're to sure why TIOS
; Hack to get LCD to work. According to WikiTI, we're not sure why TIOS
; sends these, but it sends it, and it is required to make the LCD
; work. So...
ld a, 0x17
@ -82,7 +107,7 @@ lcdWait:
lcdCmd:
out (LCD_PORT_CMD), a
jr lcdWait
; Send data A to LCD
lcdData:
out (LCD_PORT_DATA), a
@ -127,7 +152,7 @@ lcdSendGlyph:
call lcdSetRow
ld a, (LCD_CURCOL)
call lcdSetCol
; let's increase (and wrap) col now
inc a
ld (LCD_CURCOL), a
@ -151,15 +176,26 @@ lcdSendGlyph:
lcdLinefeed:
push af
ld a, (LCD_CURROW)
add a, FNT_HEIGHT+1
call .addFntH
ld (LCD_CURROW), a
call lcdClrLn
; Now, lets set Z offset which is CURROW+FNT_HEIGHT+1
call .addFntH
add a, LCD_CMD_ZOFFSET
call lcdCmd
xor a
ld (LCD_CURCOL), a
pop af
ret
.addFntH:
add a, FNT_HEIGHT+1
cp 64
ret c ; A < 64? no wrap
; we have to wrap around
xor a
ret
; Clears B rows starting at row A
; The LCD will then be set back at row A, column 0
; B is not preserved by this routine
lcdClrX:
push af