more work on c02 and lcd drivers.

This commit is contained in:
Martin Preuss
2025-11-07 17:04:08 +01:00
parent 660f2502c1
commit 9300e515e7
7 changed files with 279 additions and 72 deletions

View File

@@ -41,8 +41,7 @@ Window_Clear:
; @param R5:R4 X (dest)
; @param R7:R6 Y (dest)
; @return R5:R4 X pos behind string
; @return R7:R6 Y pos behind string
; @clobbers any, !Y
; @clobbers any, !Y, !R6, !R7
Window_DrawTextFlash:
rcall winCalcAbsPosAndBorders ; (R18, R19)
@@ -74,7 +73,7 @@ Window_DrawTextFlash_loopEnd:
; @param R5:R4 X (dest)
; @param R7:R6 Y (dest)
; @return R5:R4 X pos behind char
; @clobbers any, !Y, !R6, !R7
; @clobbers any, !Y
Window_DrawCharAt:
rcall winCalcAbsPosAndBorders
@@ -182,6 +181,89 @@ winDrawChar_ret:
; ---------------------------------------------------------------------------
; @routine Window_WriteHexWordAt @global
;
; @param Y pointer to screen object in SDRAM
; @param R17:R16 word to write
; @param R5:R4 X (dest)
; @param R7:R6 Y (dest)
; @return R5:R4 X pos behind string
; @clobbers any, !Y
Window_WriteHexWordAt:
push r16
mov r16, r17
rcall Window_WriteHexByteAt
pop r16
rcall Window_WriteHexByteAt
ret
; @end
; ---------------------------------------------------------------------------
; @routine Window_WriteHexByteAt @global
;
; @param Y pointer to screen object in SDRAM
; @param R16 byte to write
; @param R5:R4 X (dest)
; @param R7:R6 Y (dest)
; @return R5:R4 X pos behind string
; @clobbers any, !Y
Window_WriteHexByteAt:
push r16
swap r16
rcall winWriteNibble
pop r16
rcall winWriteNibble
ret
; @end
winWriteNibble:
push r4
push r5
push r6
push r7
rcall winNibbleToAscii ; write high nibble (r16, r17)
rcall Window_DrawCharAt ; draw
pop r7
pop r6
pop r5
pop r4
clr r17
add r4, r18
adc r5, r17
ret
; @end
; ---------------------------------------------------------------------------
; @routine winNibbleToAscii
;
; Convert a nibble to an ASCII char.
; @return R16 ASCII representation of that nibble (e.g. '0' for 0)
; @param R16 byte (in bits 0-3)
; @clobbers r16, r17
winNibbleToAscii:
andi r16, 0xf
cpi r16, 10
brcs winNibbleToAscii_l1
ldi r17, 7
add r16, r17
winNibbleToAscii_l1:
ldi r17, '0'
add r16, r17
ret
; @end