UNROM and NESASM

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.

Moderator: Moderators

Post Reply
sav
Posts: 9
Joined: Fri Dec 04, 2015 7:26 pm

UNROM and NESASM

Post by sav » Thu Dec 05, 2019 2:48 am

Hey,

I've been working on this game for a while, and the time has come to change the mapper. I've been using NROM so far, but I really need more PRG ROM and I kind of need CHR RAM. After reading the wiki, I've decided to go with UNROM (it seems pretty straightforward to use).

I'm using NESASM (really considering switching to ASM6 though) and one thing I'm not sure how to do though is how do I set up the additional banks. NESASM using 8kB banks makes it even more confusing.

So right now I have something like

Code: Select all

  .bank 0
  .org $8000
  
  .bank 1
  .org $A000
  
  .bank 2
  .org $C000
  
  .bank 3
  .org $E000
How do I declare the new banks, and how do I 'map' from the 8kB to 16kB?
Do I just declare 16 banks? I've tried this very briefly but it didn't work (maybe I did something wrong though)

Code: Select all

  ; selected by writing $00 to $8000-$FFFF
  .bank 0
  .org $8000 
  .bank 1
  .org $A000

  ; selected by writing $01 to $8000-$FFFF
  .bank 2
  .org $8000 
  .bank 3
  .org $A000
  
  […]

  ; selected by writing $06 to $8000-$FFFF
  .bank 12
  .org $8000 
  .bank 13
  .org $A000
  
  ; always selected
  .bank 14
  .org $C000  
  .bank 15
  .org $E000
Any help appreciated!

sdm
Posts: 306
Joined: Tue Apr 11, 2006 4:08 am
Location: Poland

Re: UNROM and NESASM

Post by sdm » Thu Dec 05, 2019 7:28 am

I mainly use UNROM/UOROM and NESASM3. Each UNROM bank is 16kb, so it is divided into two "parts" in NESASM3, 8KB each. So we switch in pairs, not 8kb individually (At least I've never heard of such a method).

Code: Select all

  .bank 0		;00 (1/2 first bank/swappable)
  .org $8000 

  .bank 1		;00 (2/2 first bank/swappable)
  .org $A000

;-----------

  .bank 2		;01 (1/2)
  .org $8000

  .bank 3		;01 (2/2)
  .org $A000

;-----------

  .bank 4		;02
  .org $8000

  .bank 5		;02
  .org $A000

;-----------

  .bank 6		;03
  .org $8000

  .bank 7		;03
  .org $A000

;-----------

  .bank 8		;04
  .org $8000

  .bank 9		;04
  .org $A000

;-----------

  .bank 10		;05
  .org $8000

  .bank 11		;05
  .org $A000

;-----------

  .bank 12		;06
  .org $8000

  .bank 13		;06
  .org $A000

;-----------
  
  .bank 14		;07 (1/2 last bank/fixed)
  .org $C000

  .bank 15		;07 (2/2 last bank/fixed)
  .org $E000

;-------------------UOROM-256:

(...)

  .bank 28		;14/$0E
  .org $8000

  .bank 29		;14/$0E
  .org $A000

;--------

  .bank 30		;15/$0F (1/2 last bank/fixed)
  .org $C000

  .bank 31		;15/$0F (2/2 last bank/fixed)
  .org $E000

User avatar
Memblers
Site Admin
Posts: 3890
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: UNROM and NESASM

Post by Memblers » Thu Dec 05, 2019 4:23 pm

I don't see anything wrong there. How about where you write to the mapper register? UNROM has bus conflicts, so normally mapper writes would be done like this:

Code: Select all

banktable: .byte 0,1,2,3,4,5,6,7
bankswitch: ; bank # loaded in A
	tax
	sta banktable,x
	rts

sav
Posts: 9
Joined: Fri Dec 04, 2015 7:26 pm

Re: UNROM and NESASM

Post by sav » Thu Dec 05, 2019 11:36 pm

Thanks for the replies!
I'll give this another try, at least now I know this is the way to go.

Post Reply