Skip to content

Instantly share code, notes, and snippets.

@gnacu
Last active March 9, 2017 22:00
Show Gist options
  • Save gnacu/c9844b0db2987c2cbe89a3ab99b8ff8c to your computer and use it in GitHub Desktop.
Save gnacu/c9844b0db2987c2cbe89a3ab99b8ff8c to your computer and use it in GitHub Desktop.
rootpg .byte 0
defpage .byte 0
defpgcnt .byte 0
;.x .y pointer to filename string.
mnuload ;Frees old memory. Allocs mem.
;Loads menu file and parses it.
.block
lda rootpg
beq load ;Nothing to free
tya ;Backup filename ptr
pha
txa
pha
;Free definitions memory
lda defpage
ldy defpgcnt
jsr pgfree
;Free structured memory
lda rootpg
sta ptr+1 ;Set hi ptr byte
lda #0
sta ptr ;Set lo ptr byte
jsr freemenu ;Call recursively
pla ;Restore filename ptr
tax
pla
tay
jmp load
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment