Skip to content

Instantly share code, notes, and snippets.

@gnacu
Last active March 9, 2017 21:59
Show Gist options
  • Save gnacu/a6dd94b23b5232c82cbdac9fff1e5a41 to your computer and use it in GitHub Desktop.
Save gnacu/a6dd94b23b5232c82cbdac9fff1e5a41 to your computer and use it in GitHub Desktop.
cr = $0d
parserow ldy #0
lda (tptr),y ;Read first byte of
cmp #cr ;line. Chk for CR.
bne alloc
rts ;End Of Data
alloc jsr salloc ;ptr -> Empty Struct
;Set struct's title pointer
#writeptr tptr,ptr,titleptr
lda lptr+1 ;Check last ptr's hi
beq chkspc ;byte. 0=first child
;Set the address of this struct
;as the last sibling's nextptr
#writeptr ptr,lptr,nextptr
chkspc ldy #0
lda (tptr),y ;If first char is
cmp #"*" ;"*", spacer row.
bne nextchr
;Menu Spacer
lda #0 ;String terminator
sta (tptr),y ;0-length title
#incptr tptr ;Points to CR
#incptr tptr ;Points to nxt row
jmp nextnode
nextchr lda (tptr),y
cmp #";"
beq headrow ;goto Menu Header
cmp #":"
beq goactrow ;goto Menu Action
#incptr tptr
bne nextchr
goactrow jmp actrow ;Branch out of range
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment