sms/vdp: handle CR and LF

This commit is contained in:
Virgil Dupras 2019-07-02 11:14:16 -04:00
parent 767db17252
commit 404dbd0ddd

View File

@ -79,6 +79,11 @@ vdpPutC:
; First, let's place our cursor. We need to first send our LSB, whose ; First, let's place our cursor. We need to first send our LSB, whose
; 6 low bits contain our row*2 (each tile is 2 bytes wide) and high ; 6 low bits contain our row*2 (each tile is 2 bytes wide) and high
; 2 bits are the two low bits of our line ; 2 bits are the two low bits of our line
; special case: line feed, carriage return
cp ASCII_LF
jr z, vdpLF
cp ASCII_CR
jr z, vdpCR
; ... but first, let's convert it. ; ... but first, let's convert it.
call vdpConv call vdpConv
; ... and store it away ; ... and store it away
@ -121,8 +126,19 @@ vdpPutC:
ret ret
.incline: .incline:
; increase line and start anew ; increase line and start anew
ex af, af' ; bring back orig A
call vdpCR
jr vdpLF
vdpCR:
push af
xor a xor a
ld (VDP_ROW), a ld (VDP_ROW), a
pop af
ret
vdpLF:
push af
ld a, (VDP_LINE) ld a, (VDP_LINE)
inc a inc a
cp 24 cp 24
@ -131,7 +147,7 @@ vdpPutC:
xor a xor a
.norollover: .norollover:
ld (VDP_LINE), a ld (VDP_LINE), a
ex af, af' ; bring back orig A pop af
ret ret
; Convert ASCII char in A into a tile index corresponding to that character. ; Convert ASCII char in A into a tile index corresponding to that character.