Skip to content

Instantly share code, notes, and snippets.

@gnacu
Last active March 9, 2017 21:59
Show Gist options
  • Save gnacu/52ba7861ccb00fd814437f9c0993d019 to your computer and use it in GitHub Desktop.
Save gnacu/52ba7861ccb00fd814437f9c0993d019 to your computer and use it in GitHub Desktop.
headrow lda #0
sta (tptr),y ;Terminate string
#incptr tptr ;Points to length
lda children ;Backup current
pha ;child count
lda (tptr),y ;Load child count
sec
sbc #$40 ;Shift a,x to 1,24
sta children ;sub-child count
#writeptr tptr,ptr,codeptr
ldy #titleptr
lda (ptr),y
tax
iny
lda (ptr),y
tay
jsr strlen ;Get title length
iny
iny ;plus 2 for " >"
tya
ldy #0
sta (tptr),y ;Set mnu row width
#incptr tptr
lda #0 ;Set .A closed
sta (tptr),y ;Save menu state
#incptr tptr ;Points to nxt row
#saveptr lptr
#saveptr child
#saveptr ptr
lda #0
sta lptr
sta lptr+1
jsr alloc ;Recurse!!
#fetchptr ptr
#writeptr child,ptr,childptr
#fetchptr child
#fetchptr lptr
pla
sta children
jmp nextnode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment