gui2: fixed an important bug (was decrementing r25!)

This commit is contained in:
Martin Preuss
2026-03-23 00:20:36 +01:00
parent bd5a51b4d2
commit 30be5b3681
2 changed files with 1208 additions and 22 deletions

View File

@@ -19,6 +19,30 @@
.macro M_MLAYOUT_FOREVERY_CONT
push yl
push yh
ldi zl, LOW(@0)
ldi zh, HIGH(@0)
rcall mLayoutForEveryObjectContiguous
pop yh
pop yl
.endmacro
.macro M_MLAYOUT_FOREVERY_SKIPPED
push yl
push yh
ldi zl, LOW(@0)
ldi zh, HIGH(@0)
rcall mLayoutForEveryObjectSkipped
pop yh
pop yl
.endmacro
; ***************************************************************************
; defines
@@ -266,9 +290,9 @@ mLayoutCallbackPositionY:
ldd r16, Y+OBJECT_OFFS_FLAGS
sbrs r16, WIDGET_FLAGS_VISIBLE_BIT
rjmp mLayoutCallbackPositionY_ret
ldd r18, Y+WIDGET_OFFS_TMP_LO ; calculated cell width
ldd r18, Y+WIDGET_OFFS_TMP_LO ; calculated cell width
ldd r19, Y+WIDGET_OFFS_TMP_HI
ldd r12, Y+WIDGET_OFFS_HEIGHT_LO ; default width
ldd r12, Y+WIDGET_OFFS_HEIGHT_LO ; default height
ldd r13, Y+WIDGET_OFFS_HEIGHT_HI
ldd r17, Y+WIDGET_OFFS_PACK
lsr r17 ; WIDGET_PACK_VSELF0_BIT = 2 -> shift 2 times right
@@ -283,8 +307,8 @@ mLayoutCallbackPositionY:
adc r21, xh
std Y+WIDGET_OFFS_Y_LO, r20 ; set new Y
std Y+WIDGET_OFFS_Y_HI, r21
std Y+WIDGET_OFFS_HEIGHT_LO, r18 ; set new width
std Y+WIDGET_OFFS_HEIGHT_HI, r19
; std Y+WIDGET_OFFS_HEIGHT_LO, r12 ; set new height
; std Y+WIDGET_OFFS_HEIGHT_HI, r13
add xl, r18 ; advance Y
adc xh, r19
add xl, r22 ; add spacing
@@ -380,7 +404,7 @@ mLayoutSetupFirstSkipped:
;
; @param Y object to start with
; @param r25 number of widgets to skip
; @clobbers r18, r19, r25
; @clobbers r18, r19
mLayoutCallbackSetupFirstSkipped:
push zl
@@ -406,7 +430,7 @@ mLayoutCallbackSetupFirstSkipped:
; @param Y object to start with
; @param r25 number of widgets to handle
; @return r21:r20 maximum TMP value encountered
; @clobbers r18, r19, r25, Z
; @clobbers r18, r19, Z
mLayoutGetMaxTmpContiguous:
push yl
@@ -752,7 +776,7 @@ mLayoutCopyTmpToHeight:
push yh
ldi zl, LOW(mLayoutCallbackCopyTmpToHeight)
ldi zh, HIGH(mLayoutCallbackCopyTmpToHeight)
rcall mLayoutForEveryObjectContiguous ; (r18, r19, r25, Y)
rcall mLayoutForEveryObjectContiguous ; (r18, r19, Y)
pop yh
pop yl
ret
@@ -781,7 +805,7 @@ mLayoutCallbackCopyTmpToHeight:
; @routine mLayoutSumContiguous
;
; @param Y object to start with
; @param r25 number of widgets to handle
; @param r25 widgets per column/row
; @param r22 spacing between widgets
; @param r23 border at beginning and and
; @return r21:r20 total size in the given dimension including borders and inter-widget spacing
@@ -792,7 +816,6 @@ mLayoutSumContiguous:
push yh
mov r20, r23 ; start with border
clr r21
clr r25
ldi zl, LOW(mLayoutCallbackAddToSum)
ldi zh, HIGH(mLayoutCallbackAddToSum)
rcall mLayoutForEveryObjectContiguous ; (r18, r19, r25, Y)
@@ -886,25 +909,33 @@ mLayoutCallbackAddToSum:
mLayoutForEveryObjectContiguous:
push r25
mov r18, r25
mLayoutForEveryObjectContiguous_loop:
push r25
push yl
push yh
icall
pop yh
pop yl
pop r25
push r18
push r25
push yl
push yh
icall
pop yh
pop yl
pop r25
pop r18
brcs mLayoutForEveryObjectContiguous_ret
tst r25
tst r18
breq mLayoutForEveryObjectContiguous_next
dec r25
dec r18
clc
breq mLayoutForEveryObjectContiguous_ret
mLayoutForEveryObjectContiguous_next:
bigcall OBJ_GetNext
brcc mLayoutForEveryObjectContiguous_ret
mov yl, r18
mov yh, r19
push r18
bigcall OBJ_GetNext
brcs mLayoutForEveryObjectContiguous_loopEnd
pop r18
rjmp mLayoutForEveryObjectContiguous_ret
mLayoutForEveryObjectContiguous_loopEnd:
mov yl, r18
mov yh, r19
pop r18
rjmp mLayoutForEveryObjectContiguous_loop
mLayoutForEveryObjectContiguous_ret:
pop r25
@@ -934,6 +965,10 @@ mLayoutForEveryObjectContiguous_ret:
; @clobbers r18, r19, Y {any}
mLayoutForEveryObjectSkipped:
tst r25
brne mLayoutForEveryObjectSkipped_loop
bigjmp DEBUG2
mLayoutForEveryObjectSkipped_loop:
push r25
push yl

File diff suppressed because it is too large Load Diff