gui2: added OBJ_CountDirectChildren

This commit is contained in:
Martin Preuss
2026-04-08 23:54:05 +02:00
parent 9da5f71ce1
commit 2a5f09e239

View File

@@ -1008,6 +1008,30 @@ objGetPredecessor_ret:
; ---------------------------------------------------------------------------
; @routine OBJ_CountDirectChildren @global
;
; @param Y address of object whose children are to be counted
; @return r16 number of direct children
; @clobbers r18, r19
OBJ_CountDirectChildren:
push yl
push yh
clr r16
rcall OBJ_GetFirstChild
OBJ_CountDirectChildren_loop:
brcc OBJ_CountDirectChildren_done
inc r16
mov yl, r18
mov yh, r19
rcall OBJ_GetNext
rjmp OBJ_CountDirectChildren_loop
OBJ_CountDirectChildren_done:
pop yh
pop yl
ret
; @end