; *************************************************************************** ; 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_A_C03_ASM #define AQH_AVR_A_C03_ASM ; *************************************************************************** ; defines .equ C03APP_OFFS_BEGIN = GUIAPP_SIZE .equ C03APP_OFFS_WMENU_LO = C03APP_OFFS_BEGIN+0 .equ C03APP_OFFS_WMENU_HI = C03APP_OFFS_BEGIN+1 .equ C03APP_OFFS_WCLIMATE_LO = C03APP_OFFS_BEGIN+2 .equ C03APP_OFFS_WCLIMATE_HI = C03APP_OFFS_BEGIN+3 .equ C03APP_OFFS_WLIGHT_LO = C03APP_OFFS_BEGIN+4 .equ C03APP_OFFS_WLIGHT_HI = C03APP_OFFS_BEGIN+5 .equ C03APP_OFFS_WWINDOWS_LO = C03APP_OFFS_BEGIN+6 .equ C03APP_OFFS_WWINDOWS_HI = C03APP_OFFS_BEGIN+7 .equ C03APP_OFFS_WDEBUG_LO = C03APP_OFFS_BEGIN+8 .equ C03APP_OFFS_WDEBUG_HI = C03APP_OFFS_BEGIN+9 .equ C03APP_OFFS_WNETSTATS_LO = C03APP_OFFS_BEGIN+10 .equ C03APP_OFFS_WNETSTATS_HI = C03APP_OFFS_BEGIN+11 .equ C03APP_SIZE = C03APP_OFFS_BEGIN+12 ; selectors for main windows .equ C03APP_SEL_BACK = 1 .equ C03APP_SEL_MENU = 2 .equ C03APP_SEL_CLIMATE = 3 .equ C03APP_SEL_LIGHT = 4 .equ C03APP_SEL_WINDOWS = 5 .equ C03APP_SEL_DEBUG = 6 .equ C03APP_SEL_NETSTATS = 7 ; *************************************************************************** ; data .dseg ; *************************************************************************** ; code .cseg ; --------------------------------------------------------------------------- ; @routine C03App_new @global ; ; @return CFLAG set of okay, cleared otherwise ; @return Y address of newly created object ; @param r16 value for OBJECT_OFFS_OPTS ; @clobbers any C03App_new: ldi r24, LOW(C03APP_SIZE) ldi r25, HIGH(C03APP_SIZE) bigcall Object_Alloc ; (!r16, !r17) brcc C03App_new_ret rcall C03App_Init ; (r16, r17, X) sec C03App_new_ret: ret ; @end ; --------------------------------------------------------------------------- ; @routine C03App_Init @global ; ; @param Y address of object in SDRAM ; @param r16 value for OBJECT_OFFS_OPTS C03App_Init: ; call base class bigcall GuiApp_Init ; (r16, r17, X) ; set default signal map ldi r16, LOW(C03App_DefaultSignalmap*2) std Y+OBJECT_OFFS_SIGNALMAP_LO, r16 ldi r16, HIGH(C03App_DefaultSignalmap*2) std Y+OBJECT_OFFS_SIGNALMAP_HI, r16 ; create main windows rcall c03AppCreateWinMenu ; (any, !Y) rcall c03AppCreateWinClimate ; (any, !Y) rcall c03AppCreateWinNetStats ; (any, !Y) rcall c03AppCreateScreenSaver ; (any, !Y) ; enter menu window rcall C03App_EnterMenuWin sec ret ; @end ; --------------------------------------------------------------------------- ; @routine c03AppCreateWinMenu ; ; @clobbers !X c03AppCreateWinMenu: push yl push yh bigcall MenuWin_new mov xl, yl mov xh, yh pop yh pop yl brcc c03AppCreateWinMenu_ret std Y+C03APP_OFFS_WMENU_LO, xl std Y+C03APP_OFFS_WMENU_HI, xh ldi r16, C03APP_SEL_MENU rcall c03AppSetTargetAndSelector sec c03AppCreateWinMenu_ret: ret ; @end ; --------------------------------------------------------------------------- ; @routine c03AppCreateWinClimate ; ; @clobbers !X c03AppCreateWinClimate: push yl push yh bigcall ClimateWin_new mov xl, yl mov xh, yh pop yh pop yl brcc c03AppCreateWinClimate_ret std Y+C03APP_OFFS_WCLIMATE_LO, xl std Y+C03APP_OFFS_WCLIMATE_HI, xh ldi r16, C03APP_SEL_CLIMATE rcall c03AppSetTargetAndSelector sec c03AppCreateWinClimate_ret: ret ; @end ; --------------------------------------------------------------------------- ; @routine c03AppCreateWinNetStats ; ; @clobbers !X c03AppCreateWinNetStats: push yl push yh bigcall NetStatWin_new mov xl, yl mov xh, yh pop yh pop yl brcc c03AppCreateWinNetStats_ret std Y+C03APP_OFFS_WNETSTATS_LO, xl std Y+C03APP_OFFS_WNETSTATS_HI, xh ldi r16, C03APP_SEL_NETSTATS rcall c03AppSetTargetAndSelector sec c03AppCreateWinNetStats_ret: ret ; @end ; --------------------------------------------------------------------------- ; @routine c03AppCreateScreenSaver ; ; @clobbers !Y c03AppCreateScreenSaver: bigcall GuiApp_GetRootWindow brcc c03AppCreateScreenSaver_ret push yl push yh mov xl, r18 ; use root window as parent for main window mov xh, r19 ldi r16, (1<