134 lines
3.5 KiB
NASM
134 lines
3.5 KiB
NASM
; ***************************************************************************
|
|
; 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_W_MAINMENU_ASM
|
|
#define AQH_AVR_W_MAINMENU_ASM
|
|
|
|
|
|
; ***************************************************************************
|
|
; defines
|
|
|
|
.equ MAINMENU_OFFS_BEGIN = WIDGET_SIZE
|
|
.equ MAINMENU_SIZE = MAINMENU_OFFS_BEGIN+0
|
|
|
|
.equ MAINMENU_SIGNAL_CLIMATE = WIDGET_SIGNAL_NEXTFREE+0
|
|
.equ MAINMENU_SIGNAL_LIGHT = WIDGET_SIGNAL_NEXTFREE+1
|
|
.equ MAINMENU_SIGNAL_WINDOWS = WIDGET_SIGNAL_NEXTFREE+2
|
|
.equ MAINMENU_SIGNAL_DEBUG = WIDGET_SIGNAL_NEXTFREE+3
|
|
.equ MAINMENU_SIGNAL_NEXTFREE = WIDGET_SIGNAL_NEXTFREE+4
|
|
|
|
|
|
.equ MAINMENU_SEL_CLIMATE = 1
|
|
.equ MAINMENU_SEL_LIGHT = 2
|
|
.equ MAINMENU_SEL_WINDOWS = 3
|
|
.equ MAINMENU_SEL_DEBUG = 4
|
|
|
|
|
|
; ***************************************************************************
|
|
; code
|
|
|
|
.cseg
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; @routine MainMenu_new
|
|
;
|
|
; @param X pointer to parent window
|
|
; @return CFLAG set of okay, cleared otherwise
|
|
; @return Y address of newly created object
|
|
|
|
|
|
MainMenu_new:
|
|
; create HLayout
|
|
ldi r16, 0 ; OPTS
|
|
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
|
ldi r20, HLAYOUT_MODE_EXPAND
|
|
bigcall HLayout_new
|
|
brcc MainMenu_new_ret
|
|
|
|
ldi r20, LOW(RESSSOURCE_IMG_TEMP)
|
|
ldi r21, HIGH(RESSSOURCE_IMG_TEMP)
|
|
ldi r22, MAINMENU_SEL_CLIMATE
|
|
rcall mainMenuCreateButton
|
|
brcc MainMenu_new_ret
|
|
|
|
ldi r20, LOW(RESSSOURCE_IMG_LIGHT)
|
|
ldi r21, HIGH(RESSSOURCE_IMG_LIGHT)
|
|
ldi r22, MAINMENU_SEL_LIGHT
|
|
rcall mainMenuCreateButton
|
|
brcc MainMenu_new_ret
|
|
|
|
ldi r20, LOW(RESSSOURCE_IMG_DEBUGEEPROM)
|
|
ldi r21, HIGH(RESSSOURCE_IMG_DEBUGEEPROM)
|
|
ldi r22, MAINMENU_SEL_DEUG
|
|
rcall mainMenuCreateButton
|
|
brcc MainMenu_new_ret
|
|
|
|
mov yl, xl
|
|
mov yh, xh
|
|
sec
|
|
MainMenu_new_ret:
|
|
ret
|
|
; @end
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; @param X parent
|
|
; @param r21:r20 img ressource
|
|
; @param r22 selector
|
|
; @return CFLAG set if new object created, cleared on error
|
|
; @return Y button created
|
|
; @clobbers any, !X
|
|
|
|
mainMenuCreateButton:
|
|
push xl
|
|
push xh
|
|
push r20
|
|
push r21
|
|
push r22
|
|
ldi r16, 0
|
|
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
|
ldi r20, BUTTON_MODE_NORMAL
|
|
rcall Button_new
|
|
pop r22
|
|
pop r21
|
|
pop r20
|
|
brcc mainMenuCreateButton_done
|
|
mov xl, yl
|
|
mov xh, yh
|
|
push xl ; Button
|
|
push xh
|
|
ldi r16, 0
|
|
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
|
bigcall ImageView_new
|
|
pop xh
|
|
pop xl
|
|
brcc mainMenuCreateButton_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 mainMenuCreateButton_ret
|
|
|
|
mainMenuCreateButton_done:
|
|
pop xh
|
|
pop xl
|
|
mainMenuCreateButton_ret:
|
|
ret
|
|
; @end
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|