more generalisation of font code.
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
; @param r7:r6 Y
|
||||
; @param r1:r0 background color
|
||||
; @param r3:r2 foreground color
|
||||
; @param Z pointer to font
|
||||
; @param Z pointer to font (word address!)
|
||||
; @param X pointer to RAM to store data to
|
||||
; @return r5:r4 new X (advanced by character width)
|
||||
; @clobbers r16 (r17, r20, r21, r22, r23, r24, r25, X)
|
||||
@@ -31,10 +31,9 @@
|
||||
ili9341_WriteCharacterX1At:
|
||||
rcall ili9341PrepareCharFromFont ; (r16, r17, r24, r25, z)
|
||||
rcall ili9341BitBlit ; (r16, r17, r20, r21, r22, r23, r24, r25, X)
|
||||
ldi r16, 8
|
||||
add r4, r16
|
||||
adc r5, r16
|
||||
sub r5, r16
|
||||
; advance X (add char width to X)
|
||||
add r4, r8
|
||||
adc r5, r9
|
||||
ret
|
||||
; @end
|
||||
|
||||
@@ -49,7 +48,7 @@ ili9341_WriteCharacterX1At:
|
||||
; @param r7:r6 Y
|
||||
; @param r1:r0 background color
|
||||
; @param r3:r2 foreground color
|
||||
; @param Z pointer to font
|
||||
; @param Z pointer to font (word address!)
|
||||
; @param X pointer to RAM to store data to
|
||||
; @return r5:r4 new X (advanced by character width)
|
||||
; @clobbers r16 (r17, r18, r19, r20, r21, r22, r23, r24, r25, X)
|
||||
@@ -57,10 +56,11 @@ ili9341_WriteCharacterX1At:
|
||||
ili9341_WriteCharacterX2At:
|
||||
rcall ili9341PrepareCharFromFont ; (r16, r17, r24, r25, z)
|
||||
rcall ili9341BitBlitStretch2 ; (r16, r17, r18, r19, r20, r21, r22, r23, r24, r25, X)
|
||||
ldi r16, 16
|
||||
add r4, r16
|
||||
adc r5, r16
|
||||
sub r5, r16
|
||||
; advance X (add double char width to X)
|
||||
lsl r8 ; Wx2
|
||||
rol r9
|
||||
add r4, r8 ; add to X
|
||||
adc r5, r9
|
||||
ret
|
||||
; @end
|
||||
|
||||
@@ -74,18 +74,21 @@ ili9341_WriteCharacterX2At:
|
||||
; @param r7:r6 Y
|
||||
; @param r1:r0 background color
|
||||
; @param r3:r2 foreground color
|
||||
; @param Z pointer to font
|
||||
; @param Z pointer to font (word address!)
|
||||
; @param X pointer to RAM to store data to
|
||||
; @return r5:r4 new X (advanced by character width)
|
||||
; @clobbers r16, r17, r18, r19, r24, r25, x, z
|
||||
|
||||
ili9341_WriteCharacterX4At:
|
||||
rcall ili9341PrepareCharFromFont ; (r16, r17, r24, r25, z)
|
||||
rcall ili9341BitBlitStretch4
|
||||
ldi r16, 32
|
||||
add r4, r16
|
||||
adc r5, r16
|
||||
sub r5, r16
|
||||
rcall ili9341BitBlitStretch4 ; (r16, r17, r20, r21, r22, r23, r24, r25, X)
|
||||
; advance X (add quad char width to X)
|
||||
lsl r8 ; Wx2
|
||||
rol r9
|
||||
lsl r8 ; Wx4
|
||||
rol r9
|
||||
add r4, r8 ; add to X
|
||||
adc r5, r9
|
||||
ret
|
||||
; @end
|
||||
|
||||
@@ -99,27 +102,37 @@ ili9341_WriteCharacterX4At:
|
||||
; @param R16 character to write
|
||||
; @param Z pointer to font
|
||||
; @param X pointer to RAM to store data to
|
||||
; @param r9:r8 character width in points
|
||||
; @param r11:r10 character height in points
|
||||
; @return r9:r8 character width in points
|
||||
; @return r11:r10 character height in points
|
||||
; @clobbers r16 (r17, r24, r25, z)
|
||||
|
||||
ili9341PrepareCharFromFont:
|
||||
; render character
|
||||
push xl
|
||||
push xh
|
||||
rcall ili9341WriteCharacterFromFont8x8 ; (r17, r24, r25, x, z)
|
||||
; call render function of the selected font (first word of font is jmp to render function)
|
||||
rcall ili9341JumpToFontRenderFn ; (r17, r24, r25, x, z)
|
||||
pop xh
|
||||
pop xl
|
||||
|
||||
; set width and height
|
||||
ldi r16, 8
|
||||
mov r8, r16
|
||||
; set src width and height
|
||||
mov r8, r18
|
||||
clr r9
|
||||
mov r10, r16
|
||||
mov r10, r19
|
||||
clr r11
|
||||
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine ili9341JumpToFontRenderFn
|
||||
;
|
||||
; helper function to call function at the beginning of the given font
|
||||
|
||||
ili9341JumpToFontRenderFn:
|
||||
ijmp
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user