diff --git a/avr/modules/lcd2/gui/base/wlist.asm b/avr/modules/lcd2/gui/base/wlist.asm index ac61d56..5bf4d2d 100644 --- a/avr/modules/lcd2/gui/base/wlist.asm +++ b/avr/modules/lcd2/gui/base/wlist.asm @@ -103,6 +103,13 @@ wListRebuild: sbc r11, r23 add r11, r23 + ; loop vars: + ; - r7:r6 : current Ypos + ; - r11:r10: widget height + ; - r22 : spacing + ; - r23 : number of items handled + ; - X : current element + clr r23 wListRebuild_loop: ; check height (does element fit?) adiw xh:xl, WLIST_ELEM_OFFS_HEIGHT_LO @@ -121,13 +128,15 @@ wListRebuild_loop: push r10 push r11 push r22 - push xl - push xh - ldi r16, WLIST_SIGNAL_MKOBJECT ; in: list element - clr r17 - bigcall OBJ_HandleSignal ; out: r19:r18=result (if CFLAG set) - pop xh - pop xl + push r23 + push xl + push xh + ldi r16, WLIST_SIGNAL_MKOBJECT ; in: list element + clr r17 + bigcall OBJ_HandleSignal ; out: r19:r18=result (if CFLAG set) + pop xh + pop xl + pop r23 pop r22 pop r11 pop r10 @@ -135,6 +144,8 @@ wListRebuild_loop: pop r6 brcc wListRebuild_ret + inc r23 ; inc number of items + ; increment Y adiw xh:xl, WLIST_ELEM_OFFS_HEIGHT_LO ld r18, X+ @@ -152,8 +163,8 @@ wListRebuild_loop: mov xl, r16 mov xh, r17 or r16, r17 - brne wListRebuild_loop - + brne wListRebuild_loop + std Y+WLIST_OFFS_ELEMNUM, r23 wListRebuild_ret: ret ; @end