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 ; defines
@@ -268,7 +292,7 @@ mLayoutCallbackPositionY:
rjmp mLayoutCallbackPositionY_ret 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 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 r13, Y+WIDGET_OFFS_HEIGHT_HI
ldd r17, Y+WIDGET_OFFS_PACK ldd r17, Y+WIDGET_OFFS_PACK
lsr r17 ; WIDGET_PACK_VSELF0_BIT = 2 -> shift 2 times right lsr r17 ; WIDGET_PACK_VSELF0_BIT = 2 -> shift 2 times right
@@ -283,8 +307,8 @@ mLayoutCallbackPositionY:
adc r21, xh adc r21, xh
std Y+WIDGET_OFFS_Y_LO, r20 ; set new Y std Y+WIDGET_OFFS_Y_LO, r20 ; set new Y
std Y+WIDGET_OFFS_Y_HI, r21 std Y+WIDGET_OFFS_Y_HI, r21
std Y+WIDGET_OFFS_HEIGHT_LO, r18 ; set new width ; std Y+WIDGET_OFFS_HEIGHT_LO, r12 ; set new height
std Y+WIDGET_OFFS_HEIGHT_HI, r19 ; std Y+WIDGET_OFFS_HEIGHT_HI, r13
add xl, r18 ; advance Y add xl, r18 ; advance Y
adc xh, r19 adc xh, r19
add xl, r22 ; add spacing add xl, r22 ; add spacing
@@ -380,7 +404,7 @@ mLayoutSetupFirstSkipped:
; ;
; @param Y object to start with ; @param Y object to start with
; @param r25 number of widgets to skip ; @param r25 number of widgets to skip
; @clobbers r18, r19, r25 ; @clobbers r18, r19
mLayoutCallbackSetupFirstSkipped: mLayoutCallbackSetupFirstSkipped:
push zl push zl
@@ -406,7 +430,7 @@ mLayoutCallbackSetupFirstSkipped:
; @param Y object to start with ; @param Y object to start with
; @param r25 number of widgets to handle ; @param r25 number of widgets to handle
; @return r21:r20 maximum TMP value encountered ; @return r21:r20 maximum TMP value encountered
; @clobbers r18, r19, r25, Z ; @clobbers r18, r19, Z
mLayoutGetMaxTmpContiguous: mLayoutGetMaxTmpContiguous:
push yl push yl
@@ -752,7 +776,7 @@ mLayoutCopyTmpToHeight:
push yh push yh
ldi zl, LOW(mLayoutCallbackCopyTmpToHeight) ldi zl, LOW(mLayoutCallbackCopyTmpToHeight)
ldi zh, HIGH(mLayoutCallbackCopyTmpToHeight) ldi zh, HIGH(mLayoutCallbackCopyTmpToHeight)
rcall mLayoutForEveryObjectContiguous ; (r18, r19, r25, Y) rcall mLayoutForEveryObjectContiguous ; (r18, r19, Y)
pop yh pop yh
pop yl pop yl
ret ret
@@ -781,7 +805,7 @@ mLayoutCallbackCopyTmpToHeight:
; @routine mLayoutSumContiguous ; @routine mLayoutSumContiguous
; ;
; @param Y object to start with ; @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 r22 spacing between widgets
; @param r23 border at beginning and and ; @param r23 border at beginning and and
; @return r21:r20 total size in the given dimension including borders and inter-widget spacing ; @return r21:r20 total size in the given dimension including borders and inter-widget spacing
@@ -792,7 +816,6 @@ mLayoutSumContiguous:
push yh push yh
mov r20, r23 ; start with border mov r20, r23 ; start with border
clr r21 clr r21
clr r25
ldi zl, LOW(mLayoutCallbackAddToSum) ldi zl, LOW(mLayoutCallbackAddToSum)
ldi zh, HIGH(mLayoutCallbackAddToSum) ldi zh, HIGH(mLayoutCallbackAddToSum)
rcall mLayoutForEveryObjectContiguous ; (r18, r19, r25, Y) rcall mLayoutForEveryObjectContiguous ; (r18, r19, r25, Y)
@@ -886,7 +909,9 @@ mLayoutCallbackAddToSum:
mLayoutForEveryObjectContiguous: mLayoutForEveryObjectContiguous:
push r25 push r25
mov r18, r25
mLayoutForEveryObjectContiguous_loop: mLayoutForEveryObjectContiguous_loop:
push r18
push r25 push r25
push yl push yl
push yh push yh
@@ -894,17 +919,23 @@ mLayoutForEveryObjectContiguous_loop:
pop yh pop yh
pop yl pop yl
pop r25 pop r25
pop r18
brcs mLayoutForEveryObjectContiguous_ret brcs mLayoutForEveryObjectContiguous_ret
tst r25 tst r18
breq mLayoutForEveryObjectContiguous_next breq mLayoutForEveryObjectContiguous_next
dec r25 dec r18
clc clc
breq mLayoutForEveryObjectContiguous_ret breq mLayoutForEveryObjectContiguous_ret
mLayoutForEveryObjectContiguous_next: mLayoutForEveryObjectContiguous_next:
push r18
bigcall OBJ_GetNext bigcall OBJ_GetNext
brcc mLayoutForEveryObjectContiguous_ret brcs mLayoutForEveryObjectContiguous_loopEnd
pop r18
rjmp mLayoutForEveryObjectContiguous_ret
mLayoutForEveryObjectContiguous_loopEnd:
mov yl, r18 mov yl, r18
mov yh, r19 mov yh, r19
pop r18
rjmp mLayoutForEveryObjectContiguous_loop rjmp mLayoutForEveryObjectContiguous_loop
mLayoutForEveryObjectContiguous_ret: mLayoutForEveryObjectContiguous_ret:
pop r25 pop r25
@@ -934,6 +965,10 @@ mLayoutForEveryObjectContiguous_ret:
; @clobbers r18, r19, Y {any} ; @clobbers r18, r19, Y {any}
mLayoutForEveryObjectSkipped: mLayoutForEveryObjectSkipped:
tst r25
brne mLayoutForEveryObjectSkipped_loop
bigjmp DEBUG2
mLayoutForEveryObjectSkipped_loop: mLayoutForEveryObjectSkipped_loop:
push r25 push r25
push yl push yl

File diff suppressed because it is too large Load Diff