Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.
hi,
i'm having a problem understanding what's going on in Day 10 of GBAGUY's tutorial. you're supposed to use it to mod Day 9's code. But i just didn't understand his instructions and wondered if someone could help?
First, copy the .org $0300 and stuff over
our old variables section.
ok i understand i have to copy .org $0300 over, but what's "and stuff"?
as a matter of fact, i'm not even totaly sure where i'm supposed to paste .org $0300.
I might have missed something. maybe it's cause i haven't practiced any for about a week almost(still waiting for that 6502 book to arrive in the mail). i'll look back and check, but that really confused me
.org $0000
X_Pos .db 20 ; a X position for our sprite, start at 20
Y_Pos .db 20 ; a Y position for our sprite, start at 20
.org $0300 ; OAM Copy location $0300
Sprite1_Y: .db 0 ; sprite #1's Y value
Sprite1_T: .db 0 ; sprite #1's Tile Number
Sprite1_S: .db 0 ; sprite #1's special byte
Sprite1_X: .db 0 ; sprite #1's X value
Sprite2_Y: .db 0 ; same thing, same order for sprite #2
Sprite2_T: .db 0 ; note that I numbered 1 2 ...
Sprite2_S: .db 0 ; some people may actually prefer starting
Sprite2_X: .db 0 ; the count at 0, but it doesn't really matter.
; this would just go on and on for however many sprites you have
The block of code he refers to that writes to $2003 and writes to $2004 several times is:
lda #$00 ; these lines tell $2003
sta $2003 ; to tell
lda #$00 ; $2004 to start
sta $2003 ; at $0000.
lda Sprite1_Y ; load Y value
sta $2004 ; store Y value
lda #$00 ; tile number 0
sta $2004 ; store tile number
lda #$00 ; no special junk
sta $2004 ; store special junk
lda Sprite1_X ; load X value
sta $2004 ; store X value
; and yes, it MUST go in that order.
.org $0000
X_Pos .db 20 ; a X position for our sprite, start at 20
Y_Pos .db 20 ; a Y position for our sprite, start at 20
This kind of thing does not work (X_Pos will not be 20 initially).
GBAGuy's tutorial is infamous for delivering false information. I would recommend you stay clear of it and uses a different tutorial (like that NES 101 one)
If you're a complete begginer, you can learn at least something from them. It may not be accurate, but it definitely gave me a boost into the world of programming. I suggest reading them, and then go over other documents. A lot of the information IS garbage. Like Disch said, something like .db $20 will not work. I'm pretty sure that's actually telling it to make whatever you store in Y_Pos to be stored at $20 in Zero Page. Don't take the information in the tutorials as fact, take it as maybe possibly in a way correct.
yeah, i was told that the info here could be very wrong, but i wasn't sure if it was just opinion or not, and even if it were wrong, if it worked, i could learn the correct way later.
but MY PROGRAMMING THE 6502 BOOK JUST CAME IN THE MAIL!!!!!!!!!!
after i finish writting this one, i'll probably just stop and play around with my new book and try the NES 101 tutorial, since you need to know a lot of stuff to even start NES 101.
Celius wrote:Like Disch said, something like .db $20 will not work. I'm pretty sure that's actually telling it to make whatever you store in Y_Pos to be stored at $20 in Zero Page.
No, that's not what happens. What happens is that the labels are defined correctly (as if a byte was reserved for each variable), but since $0000 is RAM, that part is not assembled and the number 20 goes nowhere. Well, that's what should happen, unless NESASM does something weird with that code.
tokumaru wrote:What happens is that the labels are defined correctly (as if a byte was reserved for each variable), but since $0000 is RAM, that part is not assembled and the number 20 goes nowhere. Well, that's what should happen, unless NESASM does something weird with that code.
Or unless NESASM emits symbols like ZP_src, ZP_src_end, and ZP_dst when it assembles and links the code. At least CC65 can be set up to do that.
Yeah, in a normal assembler, yes... but I assumed that NESASM, being exclusive to the NES, wouldn't output ROM for the $0000-$7FFF area. Anyway, is there any 6502 machine with ROM in zero page? That'd be a bit crazy...
thanks guys, sorry for the late reply, i've been watching, just no real chance to work on it. but i'm here now and have done this
one question though. his tutorial says to find all instances of X_Pos and replace them with Sprite1_X and the same the same for SPrite1_Y and Y_Pos, so then, do i rename these two lines?:
.org $0000
X_Pos .db 20 ; a X position for our sprite, start at 20
Y_Pos .db 20 ; a Y position for our sprite, start at 20
;with these two lines?
.org $0000
Sprite1_X .db 20 ; a X position for our sprite, start at 20
Sprite1_Y .db 20 ; a Y position for our sprite, start at 20
cause i remember him mentioning something about it and i did replace it but i get a lable multiply error in NESASM when i do replace them cause i guess they labels are already used.
C:\nesasm\sprites>nesasm ourmove3.asm
NES Assembler (v2.51)
pass 1
#[1] ourmove3.asm
20 00:0300 Sprite1_Y: .db 0 ; sprite #1's Y value
Label multiply defined!
23 00:0303 Sprite1_X: .db 0 ; sprite #1's X value
Label multiply defined!
# 2 error(s)
tokumaru wrote:
No, that's not what happens. What happens is that the labels are defined correctly (as if a byte was reserved for each variable)...
a byte as in 16 bits right? so 20 is really 16 in hex? i don't see anything in the code saying wether or not this 20 is hex. are all numbers hex by default?
tokumaru wrote:What happens is that the labels are defined correctly (as if a byte was reserved for each variable), but since $0000 is RAM, that part is not assembled and the number 20 goes nowhere. Well, that's what should happen, unless NESASM does something weird with that code.
Or unless NESASM emits symbols like ZP_src, ZP_src_end, and ZP_dst when it assembles and links the code. At least CC65 can be set up to do that.
RTFM. From http://www.cc65.org/ go to "Docs and Samples", go to "available online", go to "ld65", go to "Load and run addresses". Is there anything on that page that you do not understand?
tepples wrote:RTFM. From http://www.cc65.org/ go to "Docs and Samples", go to "available online", go to "ld65", go to "Load and run addresses". Is there anything on that page that you do not understand?