Hello,
I'm having trouble figuring out some basic 6502 stuff. I have a bunch of labels followed by .byte data, each of which has a list of menu items and command codes. I then have a function to draw a menu given one of these labels. I want to be able to call this function and "pass" it different labels, so that depending on which label it is, a different menu will be drawn.
My code works fine when I hard code a given label into the function. But I am having trouble passing the address of the label. I have tried something like this:
But it is not working. How do I copy the address of a label and later use it for addressing? Also I am unclear on how exactly the < and > operators work. They return the low and high bytes of the address, right?
I'm having trouble figuring out some basic 6502 stuff. I have a bunch of labels followed by .byte data, each of which has a list of menu items and command codes. I then have a function to draw a menu given one of these labels. I want to be able to call this function and "pass" it different labels, so that depending on which label it is, a different menu will be drawn.
My code works fine when I hard code a given label into the function. But I am having trouble passing the address of the label. I have tried something like this:
Code:
lda >menu_label
sta menuhi
lda <menu_label
sta menulo
jsr draw_menu
;;;;;
.proc draw_menu
ldy menulo
loop:
lda (menuhi), y
;;;;; etc...
;....
.endproc
sta menuhi
lda <menu_label
sta menulo
jsr draw_menu
;;;;;
.proc draw_menu
ldy menulo
loop:
lda (menuhi), y
;;;;; etc...
;....
.endproc
But it is not working. How do I copy the address of a label and later use it for addressing? Also I am unclear on how exactly the < and > operators work. They return the low and high bytes of the address, right?