1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-24 02:38:05 +11:00

ti/lcd: wrap rows on overflow

This commit is contained in:
Virgil Dupras 2019-11-09 08:01:42 -05:00
parent b27a71cb88
commit 6a70a0e5e6

View File

@ -2,9 +2,14 @@
; ;
; Implement PutC on TI-84+ (for now)'s LCD screen. ; 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 ; 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. ; most people expect. Y moves left and right, X moves up and down.
; ;
; *** Requirements *** ; *** Requirements ***
; fnt/mgm ; fnt/mgm
; ;
@ -45,7 +50,7 @@ lcdInit:
ld a, LCD_CMD_ENABLE ld a, LCD_CMD_ENABLE
call lcdCmd 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 ; sends these, but it sends it, and it is required to make the LCD
; work. So... ; work. So...
ld a, 0x17 ld a, 0x17
@ -82,7 +87,7 @@ lcdWait:
lcdCmd: lcdCmd:
out (LCD_PORT_CMD), a out (LCD_PORT_CMD), a
jr lcdWait jr lcdWait
; Send data A to LCD ; Send data A to LCD
lcdData: lcdData:
out (LCD_PORT_DATA), a out (LCD_PORT_DATA), a
@ -127,7 +132,7 @@ lcdSendGlyph:
call lcdSetRow call lcdSetRow
ld a, (LCD_CURCOL) ld a, (LCD_CURCOL)
call lcdSetCol call lcdSetCol
; let's increase (and wrap) col now ; let's increase (and wrap) col now
inc a inc a
ld (LCD_CURCOL), a ld (LCD_CURCOL), a
@ -152,14 +157,19 @@ lcdLinefeed:
push af push af
ld a, (LCD_CURROW) ld a, (LCD_CURROW)
add a, FNT_HEIGHT+1 add a, FNT_HEIGHT+1
cp 64
jr c, .nowrap ; A < 96? no wrap
; we have to wrap around to the top row
xor a
.nowrap:
ld (LCD_CURROW), a ld (LCD_CURROW), a
call lcdClrLn
xor a xor a
ld (LCD_CURCOL), a ld (LCD_CURCOL), a
pop af pop af
ret ret
; Clears B rows starting at row A ; 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 ; B is not preserved by this routine
lcdClrX: lcdClrX:
push af push af