It is currently Sun Dec 16, 2018 5:20 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Questions about banking
PostPosted: Sun Aug 13, 2006 10:54 am 
Offline
User avatar

Joined: Sat Aug 12, 2006 4:21 am
Posts: 28
I'm using mapper 0 for my test demo, which works fine.

I have some difficulty understanding the relation of the banks and the ROM-sizes. The numbering of banks also confuses me.

Mapper 0 documentation states that it's PRG-ROM may be 16k or 32k.

I've laid out my program like this:

Code:
  .inesprg 1
  .ineschr 1
  .inesmir 0
  .inesmap 0

  .bank 2

  .org $0000
  .incbin "demo.chr" ;8kb of CHR-ROM

  .bank 0 
  .org $8000
  .incbin "song.bin" ;nerdtracker 2 tune, about 7kb

RESET:

  ;  code goes here

nmi:
  ; nmi routine here

irq: ; blank

  .bank 1

  .org $FFFA
  ; pointers to reset, irq & nmi here



Now, I'd like to add a DPCM sample to $c000 by stating
Code:
  .org $c000
  .incbin "sample.dmc" ;4kb of sample data

after the irq routine. This, however, screws up the program. My code isn't that long, and it doesn't overlap $c000.

Also, say that I would like to have another 16k of CHR-ROM. What is the best way to change between the different roms in code? (I've tested MMC1 and got it to work to some degree).

EDIT: Also, if I remove the song incbin, the rom doesn't work. I'm doing something fundamentaly wrong here, but I really don't know what. Help is much appriciated.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 13, 2006 11:35 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1440
If you're using NESASM (which you really shouldn't be, since it sucks), $C000 starts at bank 1. Also, you should set your .inesprg count to 2.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 13, 2006 11:38 am 
Offline
User avatar

Joined: Sat Aug 12, 2006 4:21 am
Posts: 28
Yes, I am using NESASM, and I concur, it does suck.

What is the most convenient assembler for NES work?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 13, 2006 11:42 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3601
Location: Indianapolis
I've never understood NESASM's banking, so I don't know whats going on there. The way the code looks, (.org $8000 followed by .org $FFFA) would usually make a 32kB ROM (then the emu would complain when you loaded it, since you have it set to 1 PRG bank). When there's one PRG bank (16kB), it gets placed at $8000-$BFFF and $C000-$FFFF, mirrored. You could just align it after the NSF and put the DPCM sample at $D000 (same as $9000 if it's 16kB PRG).

Mapper 3 (CNROM) is good for simple CHR-ROM switching. Let's you chose from 4 different 8kB pages. Just write the page number to ROM like this (compensates for bus conflicts):

Code:
label:
 lda #1
 sta label+1  ; writes 1 to the 1 in ROM


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 13, 2006 12:55 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20880
Location: NE Indiana, USA (NTSC)
visy wrote:
What is the most convenient assembler for NES work?

CA65, once you've made or found a proper link script.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 13, 2006 1:29 pm 
Offline
User avatar

Joined: Sat Aug 12, 2006 4:21 am
Posts: 28
After few hours of hacking, I managed to get TASM working. Thank you all for help.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 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