From 73f92730147e3d98c7aa748ae609df42a0cb2d9b Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sun, 18 Jan 2026 14:26:46 +0100 Subject: [PATCH] avr: added routines to write text from SDRAM --- avr/modules/lcd2/gui2/widget.asm | 50 +++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/avr/modules/lcd2/gui2/widget.asm b/avr/modules/lcd2/gui2/widget.asm index a57ab3d..b71ab5b 100644 --- a/avr/modules/lcd2/gui2/widget.asm +++ b/avr/modules/lcd2/gui2/widget.asm @@ -461,7 +461,7 @@ Widget_SubFlags_ret: Widget_Clear: rcall Widget_LoadDisplayRegs - rcall Widget_MakeAbsPos ; (R16, R17) + rcall Widget_MakeAbsPos ; (R16, R17) rcall Widget_GetSdramPtr ; (none) adiw zh:zl, WIDGET_OFFS_OPTS_LO ; get OPTS low lpm r14, Z @@ -671,6 +671,54 @@ Widget_DrawColoredTextFlash_loopEnd: +; --------------------------------------------------------------------------- +; @routine Widget_DrawTextSDRAM @global +; +; @param Z byte address of widget object (for LPM!) +; @param R5:R4 X relative to widget +; @param R7:R6 Y relative to widget +; @param X pointer to text in SDRAM +; @clobbers any, !Z + +Widget_DrawTextSDRAM: + rcall Widget_GetSdramPtr ; (none) + rcall Widget_SelectColors ; (R16) + rjmp Widget_DrawColoredTextSDRAM +; @end + + + +; --------------------------------------------------------------------------- +; @routine Widget_DrawColoredTextSDRAM @global +; +; @param Z byte address of widget object (for LPM!) +; @param R1:R0 background color +; @param R3:R2 foreground color +; @param R5:R4 X relative to widget +; @param R7:R6 Y relative to widget +; @param X pointer to text in SDRAM +; @clobbers any, !Z + +Widget_DrawColoredTextSDRAM: + rcall widgetCalcAbsPosAndBorders ; (R16, R17) +Widget_DrawColoredTextSDRAM_loop: + ld r16, X + tst r16 + breq Widget_DrawColoredTextSDRAM_loopEnd + push xl + push xh + rcall widgetDrawChar ; (any, !Y, !R6, !R7, !R8, !R9, !R10, !R11) + pop xh + pop xl + brcc Widget_DrawColoredTextSDRAM_loopEnd + adiw xh:xl, 1 + rjmp Widget_DrawColoredTextSDRAM_loop +Widget_DrawColoredTextSDRAM_loopEnd: + ret +; @end + + + ; --------------------------------------------------------------------------- ; @routine widgetCalcAbsPosAndBorders ;