It is currently Wed Jul 18, 2018 9:18 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Wed Apr 12, 2006 10:17 am 
Offline

Joined: Wed Apr 12, 2006 10:07 am
Posts: 4
Location: Vancouver, BC, Canada
(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.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 1:32 pm 
Offline
User avatar

Joined: Wed Sep 07, 2005 9:55 am
Posts: 320
Location: Phoenix, AZ
post something with a little more detail because there could be many things.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 3:27 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20263
Location: NE Indiana, USA (NTSC)
Are you getting any error messages? Which assembler are you using?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 11:15 am 
Offline

Joined: Wed Apr 12, 2006 10:07 am
Posts: 4
Location: Vancouver, BC, Canada
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)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 2:14 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2149
Location: Minneapolis, Minnesota, United States
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?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 2:15 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1849
you probably meant to .incbin the CHR file and not .include?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 3:50 pm 
Offline

Joined: Wed Apr 12, 2006 10:07 am
Posts: 4
Location: Vancouver, BC, Canada
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 3:58 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1849
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 5:35 pm 
Offline

Joined: Wed Apr 12, 2006 10:07 am
Posts: 4
Location: Vancouver, BC, Canada
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 6:12 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2149
Location: Minneapolis, Minnesota, United States
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 6:16 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20263
Location: NE Indiana, USA (NTSC)
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group