Reputation: 165
A duplicate may be put on this question, but the particular questions with the same concept as mine have not been answered in one single way.
The .byte
directive stores bytes into ROM unused by instructions. (the several questions with similar topics as mine had answers stating this) I have not been sure how to access the data from the .byte
code, so let me give you an example of 6502 code.
.byte $0F
label:
LDA label - 1
Would this work? Anyways, my question is not where the .byte goes (ROM), but how to access it. For example, in the NES the cartridge is loaded to $8000
, so if I were to have .byte
data at the beginning of my program, would I access it by loading from $8000
? And when loading the next 16 bytes I would load from $8010
?
Thank you, and please do not mark this as a duplicate as no other question answers my question.
If tl;dr, then, How do you access the .byte
data from ROM (in the NES)
Upvotes: 2
Views: 980
Reputation: 27626
You can put a label on the .byte
itself. For example, to load it into A
, you could do
foo:
.byte $0F
; More stuff here
bar:
LDA foo
Upvotes: 3