(EDIT, the title should read: 'Attempting "Programming that 8-bit beast of power, the NES" but it cut off, even though the title box accepted that many characters...)
I've just gotten into this sort of stuff. I belive I have enough knowledge to understand more or less whats going on in this document, but not much beyond that.
That said, I'm to the point where you start adding sprites, but I'm having a problem: the assembler isn't putting my chr data into my file, it is instead, cutting off at the end of the prg page.
I have tried both with what I typed out and what was in the document (which may or may not be different, I haven't compared them line for line) and the result is the same, a 16kb file with no chr data.
I'm probably overlooking something stupidly simple, but I can't for the life of me work out what it is.
post something with a little more detail because there could be many things.
Are you getting any error messages? Which assembler are you using?
This is what I have so far:
http://members.shaw.ca/aknowlan/test.asm
working from this here:
http://nesdev.com/NESprgmn.txt
I'm using nesasm, which I've already read here isn't too good an idea, but it was what the tutorial recomended, so I would think that would work in that.
I didn't upload the other files (the palette and the chr) because the pal is working for me and the chr is taken from a commercial ROM. The file sizes for both are correct (as far as the tutorial says they should be anyway)
I know the problem, I bet. Turn OFF the screen before writing to $2007. For some reason, it really will NOT work if you write to $2007 while the screen is on. So just change the beggining part to:
Code:
cld
sei
ldx #$FF
txs
inx
stx $2000
stx $2001
The first four lines are almost required for an actual game to run properly. Then since X is #$FF, do inx, and X will be #$00, and store that in those registers and turn off the screen. When you're done writing to $2007, be sure to also restore the scroll! When you write to the register, you always have to turn the screen off, write, restore scroll, turn on screen. So put this at the end before your endless loop:
Code:
lda #$00
sta $2005
sta $2005
lda #$08
sta $2000
lda #$1E
sta $2001
Does this help?
you probably meant to .incbin the CHR file and not .include?
It was set to incbin when I had the problem, I had forgotten I had changed that when I was trying to work out what was wrong on my own.
When it said incbin it still wasn't working.
Even using the code included in the tutorial word for word (the part right before name tables) still gives the same problem.
No matter what I seem to do, I end up outputting a 16k nes file with no chr bank.
Well it seems strange to me that you would have the .chr in the .asm anyway. But I guess that's how nesasm works =/
Normally though.. the assembler would just assemble the code and make a binary file, which you would combine with other binary files (like your header, .chr, etc) to make the .nes file.
Anyway I can't really help on this one since it appears to be related to nesasm, which I'm not familiar with.
I could just add it manually myself. I had been avoiding doing that because I assumed that the proper way was to get the assembler to do it, like the tutorial had said, but if it isn't the standard way of doing things, then there's no point in getting used to doing it the wrong way.
Well, I don't know what's wrong with it when you assemble it, but I assembled it just fine. Even without changing that code I was talking about. The scroll is all messed up, but just restore it and it will be fine. Make a .bat file that looks like this:
@echo off
nesasm (asmfile).asm
pause
If you don't know how to make one, just open up notepad, type that, and save it as "demo.bat" or something. But yeah, change "include" to "incbin", because you must do that. And also, maybe instead of "Test.pal", put this under the lable:
.db $3F,$00,$10,$30,$3F,$00,$10,$30,$3F,$00,$10,$30,$3F,$00,$10,$30
.db $3F,$00,$10,$30,$3F,$00,$10,$30,$3F,$00,$10,$30,$3F,$00,$10,$30
It's a complete greyscale pallete. It will work with the code. And you say you have the CHR file with graphics in it, correct? 8K data, correct? Put this before the endless loop:
lda #$00
sta $2005
sta $2005
It will show "Hello" in the top left corner of the screen. Just so you know, that code would most likely not run on a real NES, but for now, it's okay. If you're just starting out not trying to make anything big, it's all good.
Until linkers are made available that support UNIF, it's best to rely on tools outside the assembler to join the iNES header or UNIF other chunks, the PRG, and the CHR, into one file.