avr: more work on gui2
- decreased complexitiy by removing guicntl - changed fonts to allow for storing bitmaps in ressource segment - add fonts to ressources for display node c03 - added some safety features (check pointers, add magic field to objects etc) - moved style.asm to device folder
This commit is contained in:
@@ -15,35 +15,43 @@
|
||||
; defines
|
||||
|
||||
; GuiApp in flash
|
||||
.equ GUIAPP_OFFS_GUIAPP = OBJECT_SIZE
|
||||
.equ GUIAPP_OFFS_SDRAM_LO = GUIAPP_OFFS_GUIAPP+0
|
||||
.equ GUIAPP_OFFS_SDRAM_HI = GUIAPP_OFFS_GUIAPP+1
|
||||
.equ GUIAPP_OFFS_ROOTWIDGET_LO = GUIAPP_OFFS_GUIAPP+2
|
||||
.equ GUIAPP_OFFS_ROOTWIDGET_HI = GUIAPP_OFFS_GUIAPP+3
|
||||
.equ GUIAPP_OFFS_ROOTTIMER_LO = GUIAPP_OFFS_GUIAPP+4
|
||||
.equ GUIAPP_OFFS_ROOTTIMER_HI = GUIAPP_OFFS_GUIAPP+5
|
||||
.equ GUIAPP_SIZE = GUIAPP_OFFS_GUIAPP+6
|
||||
.equ GUIAPP_OFFS_GUIAPP = OBJECT_SIZE
|
||||
.equ GUIAPP_OFFS_SDRAM_LO = GUIAPP_OFFS_GUIAPP+0
|
||||
.equ GUIAPP_OFFS_SDRAM_HI = GUIAPP_OFFS_GUIAPP+1
|
||||
.equ GUIAPP_OFFS_ROOTWIDGET_LO = GUIAPP_OFFS_GUIAPP+2
|
||||
.equ GUIAPP_OFFS_ROOTWIDGET_HI = GUIAPP_OFFS_GUIAPP+3
|
||||
.equ GUIAPP_SIZE = GUIAPP_OFFS_GUIAPP+4
|
||||
|
||||
; signals
|
||||
.equ GUIAPP_SIGNAL_RAISE = OBJECT_SIGNAL_NEXTFREE+0 ; app->cntrl: X=GUIAPP to raise
|
||||
.equ GUIAPP_SIGNAL_RAISE = OBJECT_SIGNAL_NEXTFREE+0 ; app->cntrl: X=WIDGET to raise
|
||||
.equ GUIAPP_SIGNAL_SHOW = OBJECT_SIGNAL_NEXTFREE+1 ; cntrl->app
|
||||
.equ GUIAPP_SIGNAL_HIDE = OBJECT_SIGNAL_NEXTFREE+2 ; cntrl->app
|
||||
.equ GUIAPP_SIGNAL_NEXTFREE = OBJECT_SIGNAL_NEXTFREE+3
|
||||
|
||||
; SDRAM data for guiapp
|
||||
.equ GUIAPP_SD_OFFS_FLAGS = 0
|
||||
.equ GUIAPP_SD_OFFS_DRAWTIMER = 1
|
||||
.equ GUIAPP_SD_SIZE = 2
|
||||
|
||||
|
||||
; guiapp flags
|
||||
.equ GUIAPP_FLAGS_ACTIVE_BIT = 7
|
||||
.equ GUIAPP_SD_OFFS_FLAGS = 0
|
||||
.equ GUIAPP_SD_OFFS_DRAWTIMER = 1
|
||||
.equ GUIAPP_SD_OFFS_CURRENTWIDGET_LO = 2
|
||||
.equ GUIAPP_SD_OFFS_CURRENTWIDGET_HI = 3
|
||||
.equ GUIAPP_SD_OFFS_TOUCHWIDGET_LO = 4
|
||||
.equ GUIAPP_SD_OFFS_TOUCHWIDGET_HI = 5
|
||||
.equ GUIAPP_SD_SIZE = 6
|
||||
|
||||
|
||||
.equ GUIAPP_DRAWTIMER = 3
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; data
|
||||
|
||||
.dseg
|
||||
|
||||
guiapp_touch_event:
|
||||
.byte WIDGET_DATA_TOUCH_SIZE
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
@@ -57,128 +65,38 @@
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
GuiApp_Init:
|
||||
; init sdram data
|
||||
rcall GuiApp_GetSdramPtr
|
||||
clr r16
|
||||
std Y+GUIAPP_SD_OFFS_FLAGS, r16
|
||||
ldi r16, GUIAPP_DRAWTIMER
|
||||
std Y+GUIAPP_SD_OFFS_DRAWTIMER, r16
|
||||
|
||||
rcall guiAppInitWidgets
|
||||
rcall guiAppInitTimers
|
||||
|
||||
ldi r16, OBJECT_SIGNAL_CREATE
|
||||
clr r17
|
||||
bigcall OBJ_HandleSignal
|
||||
rcall GuiApp_ShowFirstView
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine guiAppInitWidgets
|
||||
; @routine GuiApp_Every100ms
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
guiAppInitWidgets:
|
||||
; init widgets
|
||||
push zl
|
||||
push zh
|
||||
adiw zh:zl, GUIAPP_OFFS_ROOTWIDGET_LO
|
||||
lpm r16, Z+
|
||||
lpm zh, Z
|
||||
mov zl, r16
|
||||
or r16, zh
|
||||
breq guiAppInitWidgets_done
|
||||
ldi r16, OBJECT_SIGNAL_CREATE
|
||||
clr r17
|
||||
bigcall OBJ_TreeAllHandleSignal
|
||||
guiAppInitWidgets_done:
|
||||
pop zh
|
||||
pop zl
|
||||
GuiApp_Every100ms:
|
||||
ldi r16, OBJECT_SIGNAL_TIMER
|
||||
clr r17
|
||||
bigcall OBJ_HandleSignal
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine guiAppInitTimers
|
||||
; @routine GuiApp_Every100ms
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
guiAppInitTimers:
|
||||
; init timers
|
||||
push zl
|
||||
push zh
|
||||
adiw zh:zl, GUIAPP_OFFS_ROOTTIMER_LO
|
||||
lpm r16, Z+
|
||||
lpm zh, Z
|
||||
mov zl, r16
|
||||
or r17, zh
|
||||
breq guiAppInitTimers_done
|
||||
ldi r16, OBJECT_SIGNAL_CREATE
|
||||
clr r17
|
||||
bigcall OBJ_TreeAllHandleSignal
|
||||
guiAppInitTimers_done:
|
||||
pop zh
|
||||
pop zl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiApp_OnShow
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
GuiApp_OnShow:
|
||||
push zl
|
||||
push zh
|
||||
adiw zh:zl, GUIAPP_OFFS_ROOTWIDGET_LO
|
||||
lpm r16, Z+
|
||||
lpm zh, Z
|
||||
mov zl, r16
|
||||
or r17, zh
|
||||
breq GuiApp_OnShow_done
|
||||
ldi r16, (1<<WIDGET_FLAGS_ACTIVE_BIT) | (1<<WIDGET_FLAGS_DIRTY_BIT)
|
||||
rcall Widget_AddFlagsDown
|
||||
GuiApp_OnShow_done:
|
||||
pop zh
|
||||
pop zl
|
||||
|
||||
rcall GuiApp_GetSdramPtr
|
||||
ldd r16, Y+GUIAPP_SD_OFFS_FLAGS
|
||||
sbr r16, (1<<GUIAPP_FLAGS_ACTIVE_BIT)
|
||||
std Y+GUIAPP_SD_OFFS_FLAGS, r16
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiApp_OnHide
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
GuiApp_OnHide:
|
||||
push zl
|
||||
push zh
|
||||
adiw zh:zl, GUIAPP_OFFS_ROOTWIDGET_LO
|
||||
lpm r16, Z+
|
||||
lpm zh, Z
|
||||
mov zl, r16
|
||||
or r17, zh
|
||||
breq GuiApp_OnHide_done
|
||||
ldi r16, (1<<WIDGET_FLAGS_ACTIVE_BIT) | (1<<WIDGET_FLAGS_DIRTY_BIT)
|
||||
rcall Widget_SubFlagsDown
|
||||
GuiApp_OnHide_done:
|
||||
pop zh
|
||||
pop zl
|
||||
|
||||
rcall GuiApp_GetSdramPtr
|
||||
ldd r16, Y+GUIAPP_SD_OFFS_FLAGS
|
||||
cbr r16, (1<<GUIAPP_FLAGS_ACTIVE_BIT)
|
||||
std Y+GUIAPP_SD_OFFS_FLAGS, r16
|
||||
sec
|
||||
GuiApp_MsgReceived:
|
||||
ldi r16, OBJECT_SIGNAL_RECVMSG
|
||||
clr r17
|
||||
bigcall OBJ_HandleSignal
|
||||
ret
|
||||
; @end
|
||||
|
||||
@@ -190,24 +108,35 @@ GuiApp_OnHide_done:
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
GuiApp_OnTimer:
|
||||
; generate timer event for all app timers
|
||||
; check for touch event
|
||||
; rcall guiAppCheckTouch
|
||||
|
||||
; send timer signal to all accepting widgets
|
||||
push zl
|
||||
push zh
|
||||
; TODO: send timer event to all widgets
|
||||
adiw zh:zl, GUIAPP_OFFS_ROOTWIDGET_LO
|
||||
lpm r16, Z+
|
||||
lpm zh, Z
|
||||
mov zl, r16
|
||||
or r17, zh
|
||||
breq GuiApp_OnTimer_l1
|
||||
; bigcall Widget_Tree_SendTimerSignal
|
||||
GuiApp_OnTimer_l1:
|
||||
pop zh
|
||||
pop zl
|
||||
|
||||
; draw widgets
|
||||
; possibly draw widgets
|
||||
rcall GuiApp_GetSdramPtr
|
||||
ldd r16, Y+GUIAPP_SD_OFFS_FLAGS
|
||||
sbrs r16, GUIAPP_FLAGS_ACTIVE_BIT
|
||||
rjmp GuiApp_OnTimer_ret
|
||||
ldd r16, Y+GUIAPP_SD_OFFS_DRAWTIMER
|
||||
tst r16
|
||||
breq GuiApp_OnTimer_ret
|
||||
dec r16
|
||||
brne GuiApp_OnTimer_writeDrawTimer
|
||||
rcall guiAppDrawWidgets
|
||||
push yl
|
||||
push yh
|
||||
rcall guiAppDrawWidgets
|
||||
pop yh
|
||||
pop yl
|
||||
ldi r16, GUIAPP_DRAWTIMER
|
||||
GuiApp_OnTimer_writeDrawTimer:
|
||||
std Y+GUIAPP_SD_OFFS_DRAWTIMER, r16
|
||||
@@ -233,9 +162,8 @@ GuiApp_OnTouch:
|
||||
mov zl, r18
|
||||
or r18, zh
|
||||
breq GuiApp_OnTouch_done
|
||||
ldi r16, WIDGET_SIGNAL_TOUCH
|
||||
clr r17
|
||||
rcall OBJ_TreeHandleSignal ; TODO: let function only send TOUCH signal for widget with matching OPTS
|
||||
; send touch signal (TODO: check for grabbed touch)
|
||||
bigcall Widget_Tree_SendTouchSignal
|
||||
GuiApp_OnTouch_done:
|
||||
pop zh
|
||||
pop zl
|
||||
@@ -249,9 +177,21 @@ GuiApp_OnTouch_done:
|
||||
; @routine GuiApp_OnMsgReceived @global
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
; @param X pointer to touch event in SDRAM
|
||||
; @param X pointer to message received in SDRAM
|
||||
|
||||
GuiApp_OnMsgReceived:
|
||||
push zl
|
||||
push zh
|
||||
adiw zh:zl, GUIAPP_OFFS_ROOTWIDGET_LO
|
||||
lpm r18, Z+
|
||||
lpm zh, Z
|
||||
mov zl, r18
|
||||
or r18, zh
|
||||
breq GuiApp_OnMsgReceived_done
|
||||
bigcall Widget_Tree_SendMsgRecvSignal
|
||||
GuiApp_OnMsgReceived_done:
|
||||
pop zh
|
||||
pop zl
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
@@ -266,37 +206,26 @@ GuiApp_OnMsgReceived:
|
||||
; @clobbers any, !Z
|
||||
|
||||
GuiApp_OnCreate:
|
||||
rcall GuiApp_Init
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine guiAppDrawWidgets
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
guiAppDrawWidgets:
|
||||
; init sdram data
|
||||
rcall GuiApp_GetSdramPtr
|
||||
ldd r16, Y+GUIAPP_SD_OFFS_FLAGS
|
||||
sbrs r16, GUIAPP_FLAGS_ACTIVE_BIT
|
||||
rjmp guiAppDrawWidgets_ret
|
||||
ldi r17, GUIAPP_SD_SIZE
|
||||
clr r16
|
||||
push yl
|
||||
push yh
|
||||
GuiApp_OnCreate_loop:
|
||||
st Y+, r16
|
||||
dec r17
|
||||
brne GuiApp_OnCreate_loop
|
||||
pop yh
|
||||
pop yl
|
||||
clr r16
|
||||
std Y+GUIAPP_SD_OFFS_FLAGS, r16
|
||||
ldi r16, GUIAPP_DRAWTIMER
|
||||
std Y+GUIAPP_SD_OFFS_DRAWTIMER, r16
|
||||
|
||||
push zl
|
||||
push zh
|
||||
adiw zh:zl, GUIAPP_OFFS_ROOTWIDGET_LO
|
||||
lpm r16, Z+
|
||||
lpm zh, Z
|
||||
mov zl, r16
|
||||
or r17, zh
|
||||
breq guiAppDrawWidgets_done
|
||||
bigcall Widget_Tree_Draw
|
||||
guiAppDrawWidgets_done:
|
||||
pop zh
|
||||
pop zl
|
||||
guiAppDrawWidgets_ret:
|
||||
rcall guiAppInitWidgets
|
||||
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
@@ -318,4 +247,231 @@ GuiApp_GetSdramPtr:
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiApp_GetRootWidgetToZ @global
|
||||
;
|
||||
; @param Z byte address of object (for LPM!)
|
||||
; @return CFLAG set if there is a root widget, cleared otherwise
|
||||
; @return Z byte address pointer to root widget (for LPM!), if CFLAG set, garbage otherwise
|
||||
; @clobbers none
|
||||
|
||||
GuiApp_GetRootWidgetToZ:
|
||||
rcall OBJ_IsObject
|
||||
brcc GuiApp_GetRootWidgetToZ_ret
|
||||
adiw zh:zl, GUIAPP_OFFS_ROOTWIDGET_LO
|
||||
lpm r16, Z+
|
||||
lpm zh, Z
|
||||
mov zl, r16
|
||||
rcall OBJ_IsObject
|
||||
GuiApp_GetRootWidgetToZ_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiApp_ShowFirstView @global
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
GuiApp_ShowFirstView:
|
||||
push zl
|
||||
push zh
|
||||
rcall GuiApp_GetRootWidgetToZ
|
||||
brcc GuiApp_ShowFirstView_error
|
||||
|
||||
bigcall OBJ_GetFirstChild
|
||||
brcc GuiApp_ShowFirstView_error
|
||||
mov xl, r18
|
||||
mov xh, r19
|
||||
pop zh
|
||||
pop zl
|
||||
rcall GuiApp_ShowView
|
||||
rjmp GuiApp_ShowFirstView_ret
|
||||
GuiApp_ShowFirstView_error:
|
||||
pop zh
|
||||
pop zl
|
||||
GuiApp_ShowFirstView_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiApp_ShowView @global
|
||||
;
|
||||
; @param Z byte address of object (for LPM!)
|
||||
; @param X byte address of object to show (for LPM!)
|
||||
; @return CFLAG set if signal handled
|
||||
; @clobbers any, !Z
|
||||
|
||||
GuiApp_ShowView:
|
||||
rcall GuiApp_GetSdramPtr ; Y=SDRAM
|
||||
ldd r18, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_LO
|
||||
ldd r19, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_HI
|
||||
eor r18, xl ; 0 if same
|
||||
eor r19, xh ; 0 if same
|
||||
or r18, r19 ; 0 if r19:r18==X
|
||||
breq GuiApp_ShowView_ret ; same, no change
|
||||
|
||||
rcall guiAppHideCurrent
|
||||
|
||||
; store new view
|
||||
std Y+GUIAPP_SD_OFFS_CURRENTWIDGET_LO, xl
|
||||
std Y+GUIAPP_SD_OFFS_CURRENTWIDGET_HI, xh
|
||||
|
||||
; show new (if any)
|
||||
rcall guiAppShowCurrent
|
||||
|
||||
GuiApp_ShowView_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine guiAppHideCurrent
|
||||
;
|
||||
; @param Z byte address of gui app object (for LPM!)
|
||||
; @clobbers any, !X, !Y. !Z
|
||||
|
||||
guiAppHideCurrent:
|
||||
push zl
|
||||
push zh
|
||||
rcall GuiApp_GetSdramPtr ; Y=SDRAM
|
||||
ldd zl, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_LO
|
||||
ldd zh, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_HI
|
||||
mov r16, zl
|
||||
or r16, zh
|
||||
breq guiAppHideCurrent_done
|
||||
ldi r16, WIDGET_SIGNAL_HIDE
|
||||
clr r17
|
||||
bigcall OBJ_HandleSignal ; (any, !X, !Y. !Z)
|
||||
ldi r16, (1<<WIDGET_FLAGS_ACTIVE_BIT)
|
||||
bigcall Widget_SubFlagsDown ; (R17, R18, R19, R22, R23)
|
||||
guiAppHideCurrent_done:
|
||||
pop zh
|
||||
pop zl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine guiAppShowCurrent
|
||||
;
|
||||
; @param Z byte address of gui app object (for LPM!)
|
||||
; @clobbers any, !X, !Y. !Z
|
||||
|
||||
guiAppShowCurrent:
|
||||
push zl
|
||||
push zh
|
||||
rcall GuiApp_GetSdramPtr ; Y=SDRAM
|
||||
ldd zl, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_LO
|
||||
ldd zh, Y+GUIAPP_SD_OFFS_CURRENTWIDGET_HI
|
||||
mov r16, zl
|
||||
or r16, zh
|
||||
breq guiAppShowCurrent_done
|
||||
ldi r16, WIDGET_SIGNAL_SHOW
|
||||
clr r17
|
||||
bigcall OBJ_HandleSignal
|
||||
ldi r16, (1<<WIDGET_FLAGS_ACTIVE_BIT)
|
||||
bigcall Widget_AddFlagsDown
|
||||
guiAppShowCurrent_done:
|
||||
pop zh
|
||||
pop zl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine guiAppInitWidgets
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
guiAppInitWidgets:
|
||||
; init widgets
|
||||
push zl
|
||||
push zh
|
||||
rcall GuiApp_GetRootWidgetToZ
|
||||
brcc guiAppInitWidgets_done
|
||||
ldi r16, OBJECT_SIGNAL_CREATE
|
||||
clr r17
|
||||
bigcall OBJ_TreeAllHandleSignal
|
||||
ldi r16, (1<<WIDGET_FLAGS_ACTIVE_BIT) | (1<<WIDGET_FLAGS_DIRTY_BIT) ; root window is always active
|
||||
rcall Widget_AddFlags
|
||||
guiAppInitWidgets_done:
|
||||
pop zh
|
||||
pop zl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine guiAppDrawWidgets
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
guiAppDrawWidgets:
|
||||
push zl
|
||||
push zh
|
||||
adiw zh:zl, GUIAPP_OFFS_ROOTWIDGET_LO
|
||||
lpm r16, Z+
|
||||
lpm zh, Z
|
||||
mov zl, r16
|
||||
or r16, zh
|
||||
breq guiAppDrawWidgets_done
|
||||
bigcall Widget_Tree_SendDrawSignal
|
||||
guiAppDrawWidgets_done:
|
||||
pop zh
|
||||
pop zl
|
||||
guiAppDrawWidgets_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine guiAppCheckTouch
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
guiAppCheckTouch:
|
||||
bigcall Display_InputGetState ; r16=flags, r5:r4=x, r7:r6=y
|
||||
mov r17, r16
|
||||
andi r17, (1<<DISPLAY_IFLAGS_CHGCOORD_BIT) | (1<<DISPLAY_IFLAGS_CHGPRESS_BIT)
|
||||
breq guiAppCheckTouch_ret
|
||||
ldi xl, LOW(guiapp_touch_event)
|
||||
ldi xh, HIGH(guiapp_touch_event)
|
||||
st X+, r4 ; X
|
||||
st X+, r5
|
||||
st X+, r6 ; Y
|
||||
st X+, r7
|
||||
st X, r16 ; flags
|
||||
sbiw xh:xl, 4 ; (4 times incremented)
|
||||
; send touch signal
|
||||
ldi r16, WIDGET_SIGNAL_TOUCH
|
||||
clr r17
|
||||
bigcall OBJ_HandleSignal
|
||||
guiAppCheckTouch_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
guiAbortIfNotObject:
|
||||
bigcall OBJ_IsObject
|
||||
brcs guiAbortIfNotObject_ret
|
||||
rcall DEBUG2
|
||||
guiAbortIfNotObject_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,276 +0,0 @@
|
||||
; ***************************************************************************
|
||||
; 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_GUICNTRL_ASM
|
||||
#define AQH_AVR_GUI2_GUICNTRL_ASM
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; data
|
||||
|
||||
.dseg
|
||||
|
||||
guicntl_touch_event:
|
||||
.byte WIDGET_DATA_TOUCH_SIZE
|
||||
|
||||
guicntl_current_app:
|
||||
.byte 2
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiApp_ShowFirstChild @global
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
GuiCntrl_ShowFirstApp:
|
||||
; select first child (GuiApp) as current app
|
||||
bigcall OBJ_GetFirstChild
|
||||
mov xl, r18
|
||||
mov xh, r19
|
||||
or r18, r19
|
||||
breq GuiCntrl_ShowFirstApp_ret
|
||||
rcall GuiCntlr_ShowApp
|
||||
GuiCntrl_ShowFirstApp_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiCntrl_ShowApp @global
|
||||
;
|
||||
; @param Z byte address of object (for LPM!)
|
||||
; @param X byte address of object to raise (for LPM!)
|
||||
; @return CFLAG set if signal handled
|
||||
; @clobbers any, !Z
|
||||
|
||||
GuiCntlr_ShowApp:
|
||||
lds r18, guicntl_current_app
|
||||
lds r19, guicntl_current_app+1
|
||||
|
||||
cp r18, xl
|
||||
brne GuiCntlr_ShowApp_changed
|
||||
cp r19, xh
|
||||
breq GuiCntlr_ShowApp_secRet ; already current app
|
||||
GuiCntlr_ShowApp_changed:
|
||||
push zl
|
||||
push zh
|
||||
push xl
|
||||
push xh
|
||||
; hide previous app
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
or r18, r19
|
||||
breq GuiCntlr_ShowApp_l1
|
||||
ldi r16, WIDGET_SIGNAL_HIDE
|
||||
clr r17
|
||||
bigcall OBJ_HandleSignal
|
||||
GuiCntlr_ShowApp_l1:
|
||||
pop zh
|
||||
pop zl
|
||||
; show new app
|
||||
mov r16, zl
|
||||
or r16, zh
|
||||
breq GuiCntlr_ShowApp_l2
|
||||
ldi r16, WIDGET_SIGNAL_SHOW
|
||||
clr r17
|
||||
bigcall OBJ_HandleSignal
|
||||
GuiCntlr_ShowApp_l2:
|
||||
pop zh
|
||||
pop zl
|
||||
GuiCntlr_ShowApp_secRet:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiCntrl_Every100ms @global
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
GuiCntrl_Every100ms:
|
||||
rcall guiCntrlCheckTouch
|
||||
rcall guiCntrlSendTimer
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiCntrl_Every100ms @global
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
; @param X ptr to msg received
|
||||
|
||||
GuiCntrl_MsgReceived:
|
||||
push zl
|
||||
push zh
|
||||
bigcall OBJ_GetFirstChild
|
||||
GuiCntrl_MsgReceived_loop:
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
or r18, r19
|
||||
breq GuiCntrl_MsgReceived_loopEnd
|
||||
; let child handle msg signal
|
||||
ldi r16, OBJECT_SIGNAL_RECVMSG
|
||||
clr r17
|
||||
push xl
|
||||
push xh
|
||||
bigcall OBJ_HandleSignal
|
||||
pop xh
|
||||
pop xl
|
||||
bigcall OBJ_GetNext
|
||||
rjmp GuiCntrl_MsgReceived_loop
|
||||
GuiCntrl_MsgReceived_loopEnd:
|
||||
pop zh
|
||||
pop zl
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine guiCntrlCheckTouch
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
guiCntrlCheckTouch:
|
||||
bigcall Display_InputGetState ; r16=flags, r5:r4=x, r7:r6=y
|
||||
mov r17, r16
|
||||
andi r17, (1<<DISPLAY_IFLAGS_CHGCOORD_BIT) | (1<<DISPLAY_IFLAGS_CHGPRESS_BIT)
|
||||
breq guiCntrlCheckTouch_ret
|
||||
ldi xl, LOW(guicntl_touch_event)
|
||||
ldi xh, HIGH(guicntl_touch_event)
|
||||
st X+, r4 ; X
|
||||
st X+, r5
|
||||
st X+, r6 ; Y
|
||||
st X+, r7
|
||||
st X, r16 ; flags
|
||||
sbiw xh:xl, 4 ; (4 times incremented)
|
||||
push zl
|
||||
push zh
|
||||
lds zl, guicntl_current_app
|
||||
lds zh, guicntl_current_app+1
|
||||
mov r16, zl
|
||||
or r16, zh
|
||||
breq guiCntrlCheckTouch_l1
|
||||
ldi r16, WIDGET_SIGNAL_TOUCH
|
||||
clr r17
|
||||
bigcall OBJ_HandleSignal
|
||||
guiCntrlCheckTouch_l1:
|
||||
pop zh
|
||||
pop zl
|
||||
guiCntrlCheckTouch_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine guiCntrlSendTimer
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
guiCntrlSendTimer:
|
||||
push zl
|
||||
push zh
|
||||
bigcall OBJ_GetFirstChild
|
||||
guiCntrlSendTimer_loop:
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
or r18, r19
|
||||
breq guiCntrlSendTimer_loopEnd
|
||||
; let child handle timer signal
|
||||
ldi r16, OBJECT_SIGNAL_TIMER
|
||||
clr r17
|
||||
bigcall OBJ_HandleSignal
|
||||
bigcall OBJ_GetNext
|
||||
rjmp guiCntrlSendTimer_loop
|
||||
guiCntrlSendTimer_loopEnd:
|
||||
pop zh
|
||||
pop zl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiApp_Init @global
|
||||
;
|
||||
; @param Z byte address of guiapp object (for LPM!)
|
||||
|
||||
GuiCntrl_Init:
|
||||
clr r16
|
||||
sts guicntl_current_app, r16
|
||||
sts guicntl_current_app+1, r16
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
; signal handlers (to directly be used in signal maps)
|
||||
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiCntrl_OnCreate @global
|
||||
;
|
||||
; @param Z byte address of object (for LPM!)
|
||||
; @return CFLAG set if signal handled
|
||||
; @clobbers any, !Z
|
||||
|
||||
GuiCntlr_OnCreate:
|
||||
rcall GuiCntrl_Init
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine GuiCntrl_OnRaise @global
|
||||
;
|
||||
; @param Z byte address of object (for LPM!)
|
||||
; @param X byte address of object to raise (for LPM!)
|
||||
; @return CFLAG set if signal handled
|
||||
; @clobbers any, !Z
|
||||
|
||||
GuiCntlr_OnRaise:
|
||||
rcall GuiCntlr_ShowApp
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,19 +15,21 @@
|
||||
; defines
|
||||
|
||||
; Object in flash
|
||||
.equ OBJECT_OFFS_NEXT_LO = 0 ; byte address (for LPM!)
|
||||
.equ OBJECT_OFFS_NEXT_HI = 1
|
||||
.equ OBJECT_OFFS_PARENT_LO = 2 ; byte address (for LPM!)
|
||||
.equ OBJECT_OFFS_PARENT_HI = 3
|
||||
.equ OBJECT_OFFS_CHILD_LO = 4 ; byte address (for LPM!)
|
||||
.equ OBJECT_OFFS_CHILD_HI = 5
|
||||
.equ OBJECT_OFFS_TARGET_LO = 6 ; byte address (for LPM!)
|
||||
.equ OBJECT_OFFS_TARGET_HI = 7
|
||||
.equ OBJECT_OFFS_SELECTOR = 8
|
||||
.equ OBJECT_OFFS_UNUSED = 9
|
||||
.equ OBJECT_OFFS_SIGNALMAP_LO = 10 ; byte address (for LPM!)
|
||||
.equ OBJECT_OFFS_SIGNALMAP_HI = 11
|
||||
.equ OBJECT_SIZE = 12
|
||||
.equ OBJECT_OFFS_MAGIC_LO = 0
|
||||
.equ OBJECT_OFFS_MAGIC_HI = 1
|
||||
.equ OBJECT_OFFS_NEXT_LO = 2 ; byte address (for LPM!)
|
||||
.equ OBJECT_OFFS_NEXT_HI = 3
|
||||
.equ OBJECT_OFFS_PARENT_LO = 4 ; byte address (for LPM!)
|
||||
.equ OBJECT_OFFS_PARENT_HI = 5
|
||||
.equ OBJECT_OFFS_CHILD_LO = 6 ; byte address (for LPM!)
|
||||
.equ OBJECT_OFFS_CHILD_HI = 7
|
||||
.equ OBJECT_OFFS_TARGET_LO = 8 ; byte address (for LPM!)
|
||||
.equ OBJECT_OFFS_TARGET_HI = 9
|
||||
.equ OBJECT_OFFS_SELECTOR = 10
|
||||
.equ OBJECT_OFFS_UNUSED = 11
|
||||
.equ OBJECT_OFFS_SIGNALMAP_LO = 12 ; byte address (for LPM!)
|
||||
.equ OBJECT_OFFS_SIGNALMAP_HI = 13
|
||||
.equ OBJECT_SIZE = 14
|
||||
|
||||
; SignalMap entries
|
||||
.equ OBJECT_SIGNALMAP_OFFS_SELECTOR = 0
|
||||
@@ -53,6 +55,38 @@
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_IsObject @global
|
||||
;
|
||||
; @param Z byte address of object (for LPM!)
|
||||
; @return CFLAG set if is widget, cleared otherwise
|
||||
; @clobbers none
|
||||
|
||||
OBJ_IsObject:
|
||||
push r22
|
||||
push r23
|
||||
mov r22, zl
|
||||
or r22, zh
|
||||
clc
|
||||
breq OBJ_IsObject_ret
|
||||
lpm r22, Z+
|
||||
lpm r23, Z
|
||||
sbiw zh:zl, 1
|
||||
cpi r22, 0x55
|
||||
clc
|
||||
brne OBJ_IsObject_ret
|
||||
cpi r23, 0xaa
|
||||
clc
|
||||
brne OBJ_IsObject_ret
|
||||
sec
|
||||
OBJ_IsObject_ret:
|
||||
pop r23
|
||||
pop r22
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_GetParent @global
|
||||
;
|
||||
@@ -62,17 +96,13 @@
|
||||
; @clobbers none
|
||||
|
||||
OBJ_GetParent:
|
||||
tst zh
|
||||
brne OBJ_GetParent_get
|
||||
tst zl
|
||||
brne OBJ_GetParent_get
|
||||
clc
|
||||
rjmp OBJ_GetParent_ret
|
||||
OBJ_GetParent_get:
|
||||
rcall OBJ_IsObject
|
||||
brcc OBJ_GetParent_ret
|
||||
|
||||
adiw zh:zl, OBJECT_OFFS_PARENT_LO
|
||||
lpm r18, Z+
|
||||
lpm r19, Z
|
||||
sbiw zh:zl, (OBJECT_OFFS_PARENT_LO+1)
|
||||
sbiw zh:zl, OBJECT_OFFS_PARENT_LO+1
|
||||
tst r18
|
||||
brne OBJ_GetParent_secRet
|
||||
tst r19
|
||||
@@ -95,13 +125,8 @@ OBJ_GetParent_ret:
|
||||
; @clobbers none
|
||||
|
||||
OBJ_GetFirstChild:
|
||||
tst zh
|
||||
brne OBJ_GetFirstChild_get
|
||||
tst zl
|
||||
brne OBJ_GetFirstChild_get
|
||||
clc
|
||||
rjmp OBJ_GetFirstChild_ret
|
||||
OBJ_GetFirstChild_get:
|
||||
rcall OBJ_IsObject
|
||||
brcc OBJ_GetFirstChild_ret
|
||||
adiw zh:zl, OBJECT_OFFS_CHILD_LO
|
||||
lpm r18, Z+
|
||||
lpm r19, Z
|
||||
@@ -128,13 +153,9 @@ OBJ_GetFirstChild_ret:
|
||||
; @clobbers none
|
||||
|
||||
OBJ_GetNext:
|
||||
tst zh
|
||||
brne OBJ_GetNext_get
|
||||
tst zl
|
||||
brne OBJ_GetNext_get
|
||||
clc
|
||||
rjmp OBJ_GetNext_ret
|
||||
OBJ_GetNext_get:
|
||||
rcall OBJ_IsObject
|
||||
brcc OBJ_GetNext_ret
|
||||
|
||||
adiw zh:zl, OBJECT_OFFS_NEXT_LO
|
||||
lpm r18, Z+
|
||||
lpm r19, Z
|
||||
@@ -161,27 +182,121 @@ OBJ_GetNext_ret:
|
||||
; @clobbers r16
|
||||
|
||||
OBJ_GetBelow:
|
||||
tst zh
|
||||
brne OBJ_GetBelow_get
|
||||
tst zl
|
||||
breq OBJ_GetBelow_ret
|
||||
push zl
|
||||
push zh
|
||||
rcall OBJ_IsObject
|
||||
brcc OBJ_GetBelow_ret
|
||||
OBJ_GetBelow_get:
|
||||
rcall OBJ_GetFirstChild
|
||||
brcs OBJ_GetBelow_ret ; jmp if found
|
||||
rcall OBJ_GetNext
|
||||
brcs OBJ_GetBelow_ret ; jmp if found
|
||||
|
||||
rcall OBJ_GetFirstChild
|
||||
brcs OBJ_GetBelow_ret ; jmp if found
|
||||
rcall OBJ_GetNext
|
||||
brcs OBJ_GetBelow_ret ; jmp if found
|
||||
|
||||
OBJ_GetBelow_loop:
|
||||
rcall OBJ_GetParent
|
||||
brcc OBJ_GetBelow_ret ; jmp if no parent
|
||||
; use parent
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
; don't check for first child here, we came from there!
|
||||
rcall OBJ_GetNext
|
||||
brcs OBJ_GetBelow_ret
|
||||
rjmp OBJ_GetBelow_loop
|
||||
rcall OBJ_GetParent
|
||||
brcc OBJ_GetBelow_ret ; jmp if no parent
|
||||
; use parent
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
; don't check for first child here, we came from there!
|
||||
rcall OBJ_GetNext
|
||||
brcs OBJ_GetBelow_ret
|
||||
rjmp OBJ_GetBelow_loop
|
||||
OBJ_GetBelow_ret:
|
||||
pop zh
|
||||
pop zl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_GetBelowParent @global
|
||||
;
|
||||
; @param Z byte address of object (for LPM!)
|
||||
; @param r21:20 stay below this object
|
||||
; @return CFLAG set, if found, cleared otherwise
|
||||
; @return r19:r18 resulting object (byte address for LPM!), NULL otherwise
|
||||
; @clobbers r16
|
||||
|
||||
OBJ_GetBelowParent:
|
||||
push zl
|
||||
push zh
|
||||
rcall OBJ_IsObject
|
||||
brcc OBJ_GetBelowParent_ret
|
||||
OBJ_GetBelowParent_get:
|
||||
rcall OBJ_GetFirstChild
|
||||
brcs OBJ_GetBelowParent_ret ; jmp if found
|
||||
rcall OBJ_GetNext
|
||||
brcs OBJ_GetBelowParent_ret ; jmp if found
|
||||
|
||||
OBJ_GetBelowParent_loop:
|
||||
rcall OBJ_GetParent
|
||||
brcc OBJ_GetBelowParent_ret ; jmp if no parent
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
rcall objZIsNotR21R20
|
||||
brcc OBJ_GetBelowParent_ret ; Z is avoidable parent
|
||||
; don't check for first child here, we came from there!
|
||||
rcall OBJ_GetNext
|
||||
brcs OBJ_GetBelowParent_ret
|
||||
rjmp OBJ_GetBelowParent_loop
|
||||
OBJ_GetBelowParent_ret:
|
||||
pop zh
|
||||
pop zl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
objZIsNotR21R20:
|
||||
cp zl, r20
|
||||
brne objZIsNotR21R20_secRet
|
||||
cp zh, r21
|
||||
brne objZIsNotR21R20_secRet
|
||||
clc
|
||||
rjmp objZIsNotR21R20_ret
|
||||
objZIsNotR21R20_secRet:
|
||||
sec
|
||||
objZIsNotR21R20_ret:
|
||||
ret
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_GetBelowSkipChildren @global
|
||||
;
|
||||
; Same as @ref OBJ_GetBelow but skips children of given object.
|
||||
;
|
||||
; @param Z byte address of object (for LPM!)
|
||||
; @return CFLAG set, if found, cleared otherwise
|
||||
; @return r19:r18 resulting object (byte address for LPM!), NULL otherwise
|
||||
; @clobbers r16
|
||||
|
||||
OBJ_GetBelowSkipChildren:
|
||||
push zl
|
||||
push zh
|
||||
tst zh
|
||||
brne OBJ_GetBelowSkipChildren_get
|
||||
tst zl
|
||||
clc
|
||||
breq OBJ_GetBelowSkipChildren_ret
|
||||
OBJ_GetBelowSkipChildren_get:
|
||||
rcall OBJ_GetNext
|
||||
brcs OBJ_GetBelowSkipChildren_ret ; jmp if found
|
||||
|
||||
OBJ_GetBelowSkipChildren_loop:
|
||||
rcall OBJ_GetParent
|
||||
brcc OBJ_GetBelowSkipChildren_ret ; jmp if no parent
|
||||
; use parent
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
; don't check for first child here, we came from there!
|
||||
rcall OBJ_GetNext
|
||||
brcs OBJ_GetBelowSkipChildren_ret
|
||||
rjmp OBJ_GetBelowSkipChildren_loop
|
||||
OBJ_GetBelowSkipChildren_ret:
|
||||
pop zh
|
||||
pop zl
|
||||
ret
|
||||
; @end
|
||||
|
||||
@@ -194,26 +309,23 @@ OBJ_GetBelow_ret:
|
||||
; @param R16 signal number
|
||||
; @param xl param1
|
||||
; @param xh param2
|
||||
; @clobbers any, !Z
|
||||
; @clobbers any, !X, !Y, !Z
|
||||
|
||||
OBJ_EmitSignal:
|
||||
rcall OBJ_IsObject ; (none)
|
||||
brcc OBJ_EmitSignal_ret
|
||||
push zl
|
||||
push zh
|
||||
rcall OBJ_EmitSignal_savedZ
|
||||
adiw zh:zl, OBJECT_OFFS_SELECTOR
|
||||
lpm r17, Z
|
||||
sbiw zh:zl, OBJECT_OFFS_SELECTOR
|
||||
adiw zh:zl, OBJECT_OFFS_TARGET_LO
|
||||
lpm r23, Z+
|
||||
lpm zh, Z
|
||||
mov zl, r23
|
||||
rcall OBJ_HandleSignal ; (any, !X, !Y, !Z)
|
||||
pop zh
|
||||
pop zl
|
||||
rjmp OBJ_EmitSignal_ret
|
||||
|
||||
OBJ_EmitSignal_savedZ:
|
||||
adiw zh:zl, OBJECT_OFFS_SELECTOR
|
||||
lpm r17, Z
|
||||
sbiw zh:zl, OBJECT_OFFS_SELECTOR
|
||||
adiw zh:zl, OBJECT_OFFS_TARGET_LO
|
||||
lpm r23, Z+
|
||||
lpm zh, Z
|
||||
mov zl, r23
|
||||
rjmp OBJ_HandleSignal ; (any, !Z)
|
||||
|
||||
OBJ_EmitSignal_ret:
|
||||
ret
|
||||
; @end
|
||||
@@ -232,24 +344,23 @@ OBJ_EmitSignal_ret:
|
||||
; @clobbers any, !R16, !R17, !X, !Z
|
||||
|
||||
OBJ_TreeHandleSignal:
|
||||
rcall OBJ_IsObject ; (none)
|
||||
brcc OBJ_TreeHandleSignal_ret
|
||||
push zl
|
||||
push zh
|
||||
mov r18, zl
|
||||
or r18, zh
|
||||
clc
|
||||
breq OBJ_TreeHandleSignal_done
|
||||
rcall objectHandleSignalSaveInRegs
|
||||
rcall OBJ_HandleSignalSaveInRegs
|
||||
brcs OBJ_TreeHandleSignal_done
|
||||
|
||||
rcall OBJ_GetFirstChild
|
||||
OBJ_TreeHandleSignal_loop:
|
||||
brcc OBJ_TreeHandleSignal_done
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
or r18, r19
|
||||
clc
|
||||
breq OBJ_TreeHandleSignal_done
|
||||
rcall OBJ_TreeHandleSignal ; recursion
|
||||
;rcall objectHandleSignalSaveInRegs
|
||||
brcs OBJ_TreeHandleSignal_done
|
||||
rcall OBJ_GetNext
|
||||
rjmp OBJ_TreeHandleSignal_loop
|
||||
@@ -257,6 +368,7 @@ OBJ_TreeHandleSignal_loop:
|
||||
OBJ_TreeHandleSignal_done:
|
||||
pop zh
|
||||
pop zl
|
||||
OBJ_TreeHandleSignal_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
@@ -273,14 +385,13 @@ OBJ_TreeHandleSignal_done:
|
||||
; @clobbers any, !R16, !R17, !X, !Z
|
||||
|
||||
OBJ_TreeAllHandleSignal:
|
||||
rcall OBJ_IsObject ; (none)
|
||||
brcc OBJ_TreeAllHandleSignal_ret
|
||||
push zl
|
||||
push zh
|
||||
|
||||
OBJ_TreeAllHandleSignal_loop:
|
||||
mov r18, zl
|
||||
or r18, zh
|
||||
breq OBJ_TreeAllHandleSignal_done
|
||||
rcall objectHandleSignalSaveInRegs
|
||||
rcall OBJ_HandleSignalSaveInRegs ; (any, !R16, !R17, !X, !Z)
|
||||
push r16
|
||||
rcall OBJ_GetBelow ; (R16)
|
||||
pop r16
|
||||
@@ -291,13 +402,14 @@ OBJ_TreeAllHandleSignal_loop:
|
||||
OBJ_TreeAllHandleSignal_done:
|
||||
pop zh
|
||||
pop zl
|
||||
OBJ_TreeAllHandleSignal_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine objectHandleSignalSaveInRegs
|
||||
; @routine OBJ_HandleSignalSaveInRegs
|
||||
;
|
||||
; @param Z byte address of object (for LPM!)
|
||||
; @param R16 signal number
|
||||
@@ -307,14 +419,10 @@ OBJ_TreeAllHandleSignal_done:
|
||||
; @return CFLAG set if handled, cleared otherwise
|
||||
; @clobbers any, !R16, !R17, !X, !Z
|
||||
|
||||
objectHandleSignalSaveInRegs:
|
||||
OBJ_HandleSignalSaveInRegs:
|
||||
push r16
|
||||
push r17
|
||||
push xl
|
||||
push xh
|
||||
rcall OBJ_HandleSignal
|
||||
pop xh
|
||||
pop xl
|
||||
rcall OBJ_HandleSignal ; (any, !X, !Y, !Z)
|
||||
pop r17
|
||||
pop r16
|
||||
ret
|
||||
@@ -331,17 +439,28 @@ objectHandleSignalSaveInRegs:
|
||||
; @param xl param1
|
||||
; @param xh param2
|
||||
; @return CFLAG set if handled, cleared otherwise
|
||||
; @clobbers any, !Z
|
||||
; @clobbers any, !X, !Y, !Z
|
||||
|
||||
OBJ_HandleSignal:
|
||||
rcall OBJ_IsObject ; (none)
|
||||
brcc OBJ_HandleSignal_ret
|
||||
push zl
|
||||
push zh
|
||||
rcall objGetHandlerFromSignalMap
|
||||
rcall objGetHandlerFromSignalMap ; CF set: R19:R18=handler (r22, r23)
|
||||
brcc OBJ_HandleSignal_done
|
||||
rcall OBJ_HandleSignal_jmpR19R18
|
||||
push xl
|
||||
push xh
|
||||
push yl
|
||||
push yh
|
||||
rcall OBJ_HandleSignal_jmpR19R18
|
||||
pop yh
|
||||
pop yl
|
||||
pop xh
|
||||
pop xl
|
||||
OBJ_HandleSignal_done:
|
||||
pop zh
|
||||
pop zl
|
||||
OBJ_HandleSignal_ret:
|
||||
ret
|
||||
OBJ_HandleSignal_jmpR19R18:
|
||||
; jmp to r19:r18 via stack
|
||||
@@ -362,11 +481,12 @@ OBJ_HandleSignal_jmpR19R18:
|
||||
; @param xh param2
|
||||
; @return CFLAG set if found, cleared otherwise
|
||||
; @return R19:R18 handler found
|
||||
; @clobbers any, !Z
|
||||
; @clobbers r22, r23
|
||||
|
||||
objGetHandlerFromSignalMap:
|
||||
push zl
|
||||
push zh
|
||||
; z:=signal map
|
||||
adiw zh:zl, OBJECT_OFFS_SIGNALMAP_LO
|
||||
lpm r23, Z+
|
||||
lpm zh, Z
|
||||
@@ -375,22 +495,22 @@ objGetHandlerFromSignalMap:
|
||||
clc
|
||||
breq objGetHandlerFromSignalMap_done ; no signal map
|
||||
objGetHandlerFromSignalMap_loop:
|
||||
lpm r22, Z+ ; selector
|
||||
lpm r23, Z+ ; signal (0=end of table)
|
||||
lpm r18, Z+ ; handler LOW
|
||||
lpm r19, Z+ ; handler HIGH
|
||||
tst r23
|
||||
clc
|
||||
breq objGetHandlerFromSignalMap_done
|
||||
cp r16, r23
|
||||
brne objGetHandlerFromSignalMap_next
|
||||
cp r17, r22
|
||||
brne objGetHandlerFromSignalMap_next
|
||||
mov r23, r18
|
||||
lpm r22, Z+ ; selector
|
||||
lpm r23, Z+ ; signal (0=end of table)
|
||||
lpm r18, Z+ ; handler LOW
|
||||
lpm r19, Z+ ; handler HIGH
|
||||
tst r23 ; end of table?
|
||||
clc
|
||||
breq objGetHandlerFromSignalMap_done ; yes, jmp
|
||||
cp r16, r23 ; signal match?
|
||||
brne objGetHandlerFromSignalMap_next ; no, next
|
||||
cp r17, r22 ; selector match?
|
||||
brne objGetHandlerFromSignalMap_next ; no, next
|
||||
mov r23, r18 ; handler==NULL?
|
||||
or r23, r19
|
||||
clc
|
||||
breq objGetHandlerFromSignalMap_done
|
||||
sec ; found handler
|
||||
breq objGetHandlerFromSignalMap_done ; yes, done
|
||||
sec ; found handler, return in r19:r18
|
||||
rjmp objGetHandlerFromSignalMap_done
|
||||
objGetHandlerFromSignalMap_next:
|
||||
rjmp objGetHandlerFromSignalMap_loop
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
; ***************************************************************************
|
||||
; 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_STYLE_ASM
|
||||
#define AQH_AVR_GUI2_STYLE_ASM
|
||||
|
||||
|
||||
.equ STYLE_WIN_TITLE_BACKGROUND = DISPLAY_COLOR_NAVY
|
||||
.equ STYLE_WIN_TITLE_FOREGROUND = DISPLAY_COLOR_WHITE
|
||||
.equ STYLE_BUTTON_COL_BORDER = DISPLAY_COLOR_BLACK
|
||||
.equ STYLE_BUTTON_COL_BG_NORM = DISPLAY_COLOR_WHITE
|
||||
.equ STYLE_BUTTON_COL_BG_PRESSED = DISPLAY_COLOR_NAVY
|
||||
.equ STYLE_BUTTON_COL_FG_NORM = DISPLAY_COLOR_BLACK
|
||||
.equ STYLE_BUTTON_COL_FG_PRESSED = DISPLAY_COLOR_WHITE
|
||||
|
||||
.equ STYLE_WIN_BACKGROUND = DISPLAY_COLOR_LIGHTGREY
|
||||
.equ STYLE_WIN_FOREGROUND = DISPLAY_COLOR_BLACK
|
||||
.equ STYLE_WIN_FONT = ili9341Font12x16_1
|
||||
.equ STYLE_WIN_FONT_WIDTH = 12
|
||||
.equ STYLE_WIN_FONT_HEIGHT = 16
|
||||
|
||||
.equ STYLE_WIN_TITLE_HEIGHT = (STYLE_WIN_FONT_HEIGHT+4)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,9 +41,10 @@
|
||||
.equ WIDGET_SD_SIZE = 1
|
||||
|
||||
; widget opts_lo
|
||||
.equ WIDGETS_OPTSLO_BORDER_BIT = 7
|
||||
.equ WIDGETS_OPTSLO_INPUT_BIT = 6 ; TOUCH, KEY
|
||||
.equ WIDGETS_OPTSLO_TIMER_BIT = 5
|
||||
.equ WIDGETS_OPTSLO_BORDER_BIT = 7
|
||||
.equ WIDGETS_OPTSLO_INPUT_BIT = 6 ; TOUCH, KEY
|
||||
.equ WIDGETS_OPTSLO_TIMER_BIT = 5
|
||||
.equ WIDGETS_OPTSLO_MSGRECV_BIT = 4
|
||||
|
||||
; widget flags
|
||||
.equ WIDGET_FLAGS_ACTIVE_BIT = 7
|
||||
@@ -319,24 +320,18 @@ Widget_GetSdramPtr:
|
||||
;
|
||||
; @param Z byte address of widget object (for LPM!)
|
||||
; @param R16 flags to add
|
||||
; @clobbers R17, R18, R19, Y
|
||||
; @clobbers R17, R18, R19, R22, R23, Y
|
||||
|
||||
Widget_AddFlagsDown:
|
||||
mov r17, zl
|
||||
or r17, zh
|
||||
breq Widget_AddFlagsDown_ret
|
||||
rcall OBJ_IsObject
|
||||
brcc Widget_AddFlagsDown_ret
|
||||
|
||||
rcall Widget_GetSdramPtr
|
||||
ldd r17, Y+WIDGET_SD_OFFS_FLAGS
|
||||
or r17, r16
|
||||
std Y+WIDGET_SD_OFFS_FLAGS, r17
|
||||
rcall Widget_AddFlags ; (R17, R22, R23)
|
||||
push zl
|
||||
push zh
|
||||
bigcall OBJ_GetFirstChild ; R19:R18=next object
|
||||
Widget_AddFlagsDown_loop:
|
||||
mov r17, r18
|
||||
or r17, r19
|
||||
breq Widget_AddFlagsDown_loopEnd
|
||||
brcc Widget_AddFlagsDown_loopEnd
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
rcall Widget_AddFlagsDown
|
||||
@@ -352,35 +347,27 @@ Widget_AddFlagsDown_ret:
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_SubFlagsDown @global
|
||||
;
|
||||
; @param Z byte address of widget object (for LPM!)
|
||||
; @param R16 flags to add
|
||||
; @clobbers R17, R18, R19, Y
|
||||
; @clobbers R17, R18, R19, R22, R23
|
||||
|
||||
Widget_SubFlagsDown:
|
||||
mov r17, zl
|
||||
or r17, zh
|
||||
breq Widget_SubFlagsDown_ret
|
||||
|
||||
rcall Widget_GetSdramPtr
|
||||
ldd r17, Y+WIDGET_SD_OFFS_FLAGS
|
||||
com r16 ; one's-complement
|
||||
and r17, r16
|
||||
com r16
|
||||
std Y+WIDGET_SD_OFFS_FLAGS, r17
|
||||
rcall OBJ_IsObject ; (none)
|
||||
brcc Widget_SubFlagsDown_ret
|
||||
rcall Widget_SubFlags ; (R17)
|
||||
push zl
|
||||
push zh
|
||||
bigcall OBJ_GetFirstChild ; R19:R18=next object
|
||||
Widget_SubFlagsDown_loop:
|
||||
mov r17, r18
|
||||
or r17, r19
|
||||
breq Widget_SubFlagsDown_loopEnd
|
||||
brcc Widget_SubFlagsDown_loopEnd
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
rcall Widget_SubFlagsDown
|
||||
bigcall OBJ_GetNext
|
||||
rcall OBJ_GetNext
|
||||
rjmp Widget_SubFlagsDown_loop
|
||||
|
||||
Widget_SubFlagsDown_loopEnd:
|
||||
@@ -392,6 +379,59 @@ Widget_SubFlagsDown_ret:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_AddFlags @global
|
||||
;
|
||||
; @param Z byte address of widget object (for LPM!)
|
||||
; @param R16 flags to add
|
||||
; @clobbers R17, R22, R23
|
||||
|
||||
Widget_AddFlags:
|
||||
rcall OBJ_IsObject
|
||||
brcc Widget_AddFlags_ret
|
||||
|
||||
push yl
|
||||
push yh
|
||||
rcall Widget_GetSdramPtr ; (none)
|
||||
ldd r17, Y+WIDGET_SD_OFFS_FLAGS
|
||||
or r17, r16
|
||||
std Y+WIDGET_SD_OFFS_FLAGS, r17
|
||||
pop yh
|
||||
pop yl
|
||||
Widget_AddFlags_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_SubFlags @global
|
||||
;
|
||||
; @param Z byte address of widget object (for LPM!)
|
||||
; @param R16 flags to clear
|
||||
; @clobbers R17
|
||||
|
||||
Widget_SubFlags:
|
||||
mov r17, zl
|
||||
or r17, zh
|
||||
breq Widget_SubFlags_ret
|
||||
|
||||
push yl
|
||||
push yh
|
||||
rcall Widget_GetSdramPtr ; (none)
|
||||
ldd r17, Y+WIDGET_SD_OFFS_FLAGS
|
||||
com r16 ; one's-complement
|
||||
and r17, r16
|
||||
com r16
|
||||
std Y+WIDGET_SD_OFFS_FLAGS, r17
|
||||
pop yh
|
||||
pop yl
|
||||
Widget_SubFlags_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_Clear @global
|
||||
;
|
||||
@@ -727,14 +767,242 @@ Widget_Tree_Init_loopEnd:
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_Tree_Draw @global
|
||||
; @routine Widget_Tree_SendDrawSignal @global
|
||||
;
|
||||
; @param Z byte address of root widget object (for LPM!)
|
||||
|
||||
Widget_Tree_Draw:
|
||||
Widget_Tree_SendDrawSignal:
|
||||
ldi r16, WIDGET_SIGNAL_DRAW
|
||||
clr r17
|
||||
bigcall OBJ_TreeAllHandleSignal
|
||||
; only let active and dirty widgets draw
|
||||
ldi r20, (1<<WIDGET_FLAGS_DIRTY_BIT)
|
||||
ldi r21, (1<<WIDGET_FLAGS_DIRTY_BIT)
|
||||
rcall Widget_TreeMatchFlagsAndSendSignalToActive
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_Tree_SendTouchSignal @global
|
||||
;
|
||||
; @param Z byte address of root widget object (for LPM!)
|
||||
; @param X pointer to touch event datain SDRAM
|
||||
|
||||
Widget_Tree_SendTouchSignal:
|
||||
ldi r16, WIDGET_SIGNAL_TOUCH
|
||||
clr r17
|
||||
; only check active widgets
|
||||
ldi r20, (1<<WIDGETS_OPTSLO_INPUT_BIT)
|
||||
ldi r21, (1<<WIDGETS_OPTSLO_INPUT_BIT)
|
||||
rcall Widget_TreeMatchOptsAndSendSignal
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_Tree_SendTimerSignal @global
|
||||
;
|
||||
; @param Z byte address of root widget object (for LPM!)
|
||||
|
||||
Widget_Tree_SendTimerSignal:
|
||||
ldi r16, OBJECT_SIGNAL_TIMER
|
||||
clr r17
|
||||
; only check active widgets
|
||||
ldi r20, (1<<WIDGETS_OPTSLO_TIMER_BIT)
|
||||
ldi r21, (1<<WIDGETS_OPTSLO_TIMER_BIT)
|
||||
rcall Widget_TreeMatchOptsAndSendSignal
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_Tree_SendMsgRecvSignal @global
|
||||
;
|
||||
; @param Z byte address of root widget object (for LPM!)
|
||||
; @param X pointer to received message in SDRAM
|
||||
|
||||
Widget_Tree_SendMsgRecvSignal:
|
||||
ldi r16, OBJECT_SIGNAL_RECVMSG
|
||||
clr r17
|
||||
; only check active widgets
|
||||
ldi r20, (1<<WIDGETS_OPTSLO_MSGRECV_BIT)
|
||||
ldi r21, (1<<WIDGETS_OPTSLO_MSGRECV_BIT)
|
||||
rcall Widget_TreeMatchOptsAndSendSignal
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_TreeMatchOptsAndSendSignal @global
|
||||
;
|
||||
; Send signal to all widgets whose WIDGET_OFFS_OPTS_LO matches the given mask/value.
|
||||
; Widgets which don't match will not be called, but there children will still be checked
|
||||
; (as opposed to Widget_TreeMatchingHandleSignal which would also skip the children).
|
||||
;
|
||||
; @param Z byte address of object (for LPM!)
|
||||
; @param R16 signal number
|
||||
; @param R17 selector
|
||||
; @param R20 mask for WIDGET_OFFS_OPTS_LO to match
|
||||
; @param R21 value for WIDGET_OFFS_OPTS_LO to match
|
||||
; @param xl param1
|
||||
; @param xh param2
|
||||
; @clobbers any, !R16, !R17, !X, !Z
|
||||
|
||||
Widget_TreeMatchOptsAndSendSignal:
|
||||
push zl
|
||||
push zh
|
||||
|
||||
Widget_TreeMatchOptsAndSendSignal_loop:
|
||||
mov r18, zl
|
||||
or r18, zh
|
||||
breq Widget_TreeMatchOptsAndSendSignal_done
|
||||
adiw zh:zl, WIDGET_OFFS_OPTS_LO
|
||||
lpm r18, Z
|
||||
sbiw zh:zl, WIDGET_OFFS_OPTS_LO
|
||||
eor r18, r21 ; XOR with value (1 if different)
|
||||
and r18, r20 ; AND with mask
|
||||
brne Widget_TreeMatchOptsAndSendSignal_next
|
||||
push r20
|
||||
push r21
|
||||
rcall OBJ_HandleSignalSaveInRegs
|
||||
pop r21
|
||||
pop r20
|
||||
Widget_TreeMatchOptsAndSendSignal_next:
|
||||
push r16
|
||||
rcall OBJ_GetBelow ; (R16)
|
||||
pop r16
|
||||
brcc Widget_TreeMatchOptsAndSendSignal_done
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
rjmp Widget_TreeMatchOptsAndSendSignal_loop
|
||||
Widget_TreeMatchOptsAndSendSignal_done:
|
||||
pop zh
|
||||
pop zl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_TreeMatchOptsAndSendSignalToActive @global
|
||||
;
|
||||
; Send signal to all widgets whose WIDGET_OFFS_OPTS_LO matches the given mask/value.
|
||||
; Inactive branches are skipped.
|
||||
;
|
||||
; @param Z byte address of object (for LPM!)
|
||||
; @param R16 signal number
|
||||
; @param R17 selector
|
||||
; @param R20 mask for WIDGET_OFFS_OPTS_LO to match
|
||||
; @param R21 value for WIDGET_OFFS_OPTS_LO to match
|
||||
; @param xl param1
|
||||
; @param xh param2
|
||||
; @clobbers any, !R16, !R17, !X, !Z
|
||||
|
||||
Widget_TreeMatchOptsAndSendSignalToActive:
|
||||
push zl
|
||||
push zh
|
||||
|
||||
Widget_TreeMatchOptsAndSendSignalToActive_loop:
|
||||
mov r18, zl
|
||||
or r18, zh
|
||||
breq Widget_TreeMatchOptsAndSendSignalToActive_done
|
||||
|
||||
; check flags
|
||||
rcall Widget_GetSdramPtr ; (none)
|
||||
ldd r18, Y+WIDGET_SD_OFFS_FLAGS
|
||||
sbrc r18, WIDGET_FLAGS_ACTIVE_BIT
|
||||
rjmp Widget_TreeMatchOptsAndSendSignalToActive_checkOpts
|
||||
push r16
|
||||
rcall OBJ_GetBelowSkipChildren ; (R16)
|
||||
pop r16
|
||||
rjmp Widget_TreeMatchOptsAndSendSignalToActive_next
|
||||
Widget_TreeMatchOptsAndSendSignalToActive_checkOpts:
|
||||
adiw zh:zl, WIDGET_OFFS_OPTS_LO
|
||||
lpm r18, Z
|
||||
sbiw zh:zl, WIDGET_OFFS_OPTS_LO
|
||||
eor r18, r21 ; XOR with value (1 if different)
|
||||
and r18, r20 ; AND with mask
|
||||
brne Widget_TreeMatchOptsAndSendSignalToActive_below
|
||||
push r20
|
||||
push r21
|
||||
rcall OBJ_HandleSignalSaveInRegs
|
||||
pop r21
|
||||
pop r20
|
||||
Widget_TreeMatchOptsAndSendSignalToActive_below:
|
||||
push r16
|
||||
rcall OBJ_GetBelow ; (R16)
|
||||
pop r16
|
||||
Widget_TreeMatchOptsAndSendSignalToActive_next:
|
||||
brcc Widget_TreeMatchOptsAndSendSignalToActive_done
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
rjmp Widget_TreeMatchOptsAndSendSignalToActive_loop
|
||||
Widget_TreeMatchOptsAndSendSignalToActive_done:
|
||||
pop zh
|
||||
pop zl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_TreeMatchFlagsAndSendSignalToActive @global
|
||||
;
|
||||
; Send signal to all widgets whose WIDGET_SD_OFFS_FLAGS matches the given mask/value.
|
||||
; Inactive branches are skipped.
|
||||
;
|
||||
; @param Z byte address of object (for LPM!)
|
||||
; @param R16 signal number
|
||||
; @param R17 selector
|
||||
; @param R20 mask for WIDGET_SD_OFFS_FLAGS to match
|
||||
; @param R21 value for WIDGET_SD_OFFS_FLAGS to match
|
||||
; @param xl param1
|
||||
; @param xh param2
|
||||
; @clobbers any, !R16, !R17, !X, !Z
|
||||
|
||||
Widget_TreeMatchFlagsAndSendSignalToActive:
|
||||
push zl
|
||||
push zh
|
||||
Widget_TreeMatchFlagsAndSendSignalToActive_loop:
|
||||
mov r18, zl
|
||||
or r18, zh
|
||||
breq Widget_TreeMatchFlagsAndSendSignalToActive_done
|
||||
|
||||
; check flags
|
||||
rcall Widget_GetSdramPtr ; (none)
|
||||
ldd r18, Y+WIDGET_SD_OFFS_FLAGS
|
||||
sbrc r18, WIDGET_FLAGS_ACTIVE_BIT
|
||||
rjmp Widget_TreeMatchFlagsAndSendSignalToActive_checkFlags
|
||||
push r16
|
||||
rcall OBJ_GetBelowSkipChildren ; (R16)
|
||||
pop r16
|
||||
rjmp Widget_TreeMatchFlagsAndSendSignalToActive_next
|
||||
Widget_TreeMatchFlagsAndSendSignalToActive_checkFlags:
|
||||
ldd r18, Y+WIDGET_SD_OFFS_FLAGS
|
||||
eor r18, r21 ; XOR with value (1 if different)
|
||||
and r18, r20 ; AND with mask
|
||||
brne Widget_TreeMatchFlagsAndSendSignalToActive_below
|
||||
push r20
|
||||
push r21
|
||||
rcall OBJ_HandleSignalSaveInRegs
|
||||
pop r21
|
||||
pop r20
|
||||
Widget_TreeMatchFlagsAndSendSignalToActive_below:
|
||||
push r16
|
||||
rcall OBJ_GetBelow ; (R16)
|
||||
pop r16
|
||||
Widget_TreeMatchFlagsAndSendSignalToActive_next:
|
||||
brcc Widget_TreeMatchFlagsAndSendSignalToActive_done
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
rjmp Widget_TreeMatchFlagsAndSendSignalToActive_loop
|
||||
Widget_TreeMatchFlagsAndSendSignalToActive_done:
|
||||
pop zh
|
||||
pop zl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user