avr: more work on c03 and gui.
This commit is contained in:
75
avr/modules/lcd2/gui/base/imagebutton.asm
Normal file
75
avr/modules/lcd2/gui/base/imagebutton.asm
Normal file
@@ -0,0 +1,75 @@
|
||||
; ***************************************************************************
|
||||
; copyright : (C) 2026 by Martin Preuss
|
||||
; email : martin@libchipcard.de
|
||||
;
|
||||
; ***************************************************************************
|
||||
; * This file is part of the project "AqHome". *
|
||||
; * Please see toplevel file COPYING of that project for license details. *
|
||||
; ***************************************************************************
|
||||
|
||||
#ifndef AQH_AVR_GUI2_IMAGEBUTTON_ASM
|
||||
#define AQH_AVR_GUI2_IMAGEBUTTON_ASM
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine ImageButton_new
|
||||
;
|
||||
; @param X parent
|
||||
; @param r16 value for OBJECT_OFFS_OPTS
|
||||
; @param r17 value for WIDGET_OFFS_PACK
|
||||
; @param r21:r20 img ressource
|
||||
; @param r22 selector (target will be parent, can be overridden later)
|
||||
; @return CFLAG set if new object created, cleared on error
|
||||
; @return Y button created
|
||||
; @clobbers any, !X
|
||||
|
||||
ImageButton_new:
|
||||
push xl
|
||||
push xh
|
||||
push r20
|
||||
push r21
|
||||
push r22
|
||||
ldi r20, BUTTON_MODE_NORMAL
|
||||
bigcall Button_new
|
||||
pop r22
|
||||
pop r21
|
||||
pop r20
|
||||
brcc ImageButton_new_done
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
push xl ; Button
|
||||
push xh
|
||||
push r22
|
||||
ldi r16, 0
|
||||
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
bigcall ImageView_new
|
||||
pop r22
|
||||
pop yh ; pop button into Y
|
||||
pop yl
|
||||
brcc ImageButton_new_done
|
||||
pop xh
|
||||
pop xl
|
||||
std Y+OBJECT_OFFS_TARGET_LO, xl
|
||||
std Y+OBJECT_OFFS_TARGET_HI, xh
|
||||
std Y+OBJECT_OFFS_SELECTOR, r22
|
||||
rjmp ImageButton_new_ret
|
||||
ImageButton_new_done:
|
||||
pop xh
|
||||
pop xl
|
||||
ImageButton_new_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user