MMC5 ExGrafix Hello World

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

kuja killer
Posts: 130
Joined: Mon May 25, 2009 2:20 pm

Post by kuja killer »

i personally use the ex attributes in my megaman odyssey rom hack that MMC5 provides. Im not sure how i can show you the code exactly cause i only type in hex numbers. I dont use assemblers or any of that stuff. I did it all from scartch myself.

But well, how i was able to draw ex attributes, i basically copied the very exact same screen-drawing code megaman 3 did. It's puely the same except just storing the EX attribute data to a temporary RAM area, and unload it after an NMI is finished. (since ex attributes are only allowed to be updated during rendering)

some of my levels have as many as 800 graphic tiles instead of the normal 256 limit. And i mean NO bankswitching or CHR-swapping of any kind needed. :)
-----------
well like for example. when scrolling left/right, the game writes to 780-7A1 RAM for the nametables right ? To update the screen when scrolling right.
ex: 780 = 20, 781 = 02 (2002 Nametable PPU Address), 783 = 1D (number of tiles to change)
I store the EX Attribute data between 7D8-7FF. It's the same format. I use 7D8 for 01, or 20 (when it needs to be vertical or horizontal scrolling), 7D9 and 7DA - 5C02 for Ex Att's - just add + 3C00 to the nametable address), 1D tiles again. And then the ex data from there.

im not good at explaining these things. :(
sdm
Posts: 412
Joined: Tue Apr 11, 2006 4:08 am
Location: Poland

Re: MMC5 ExGrafix Hello World

Post by sdm »

I would like to create a "hello world" using the MMC5 mapper, size PRG 1024kb (128x8KB banks), 8kb chr (8x1KB pages) + WRAM at $ 6000. I don't know if the init / reset mmc5 code is correct.
Does a $ 8000 bank switch work by writing the corresponding value of the other bank to the $ 5114 register?

Code: Select all

	lda #$05+128				; switch 8000 to bank $05
	sta $5114

	jsr subroutine at bank 05		; jump execute the code in the bank 05

	lda #$00+128				; we go back to bank 00 originally set up after reset
	sta $5114
mmc5 init:

PRG mode 3
CPU $6000-$7FFF: 8 KB switchable PRG RAM bank
CPU $8000-$9FFF: 8 KB switchable PRG ROM/RAM bank
CPU $A000-$BFFF: 8 KB switchable PRG ROM/RAM bank
CPU $C000-$DFFF: 8 KB switchable PRG ROM/RAM bank
CPU $E000-$FFFF: 8 KB switchable PRG ROM bank

Code: Select all


  LDA #%00000011
  STA $5100		;Four 8KB PRG ROM/RAM banks
  LDA #%00000011
  STA $5101		;8 x 1KB CHR Banks

  LDA #%00000010
  STA $5102

  LDA #%00000001
  STA $5104		;Extended nametables
  STA $5103		;Data protection zapped

  LDA #$44
  STA $5105		;Vertical mirroring

  LDA #%00000000
  STA $5113		;PRG RAM chip stuff

  LDA #$00+128
  STA $5114

  LDA #$01+128
  STA $5115

  LDA #$7E+128
  STA $5116

  LDA #$7F+128
  STA $5117		;PRG ROM everywhere, Banks 0-1-2-3

  LDA #$00
  STA $5200
  STA $5201
  STA $5202
  STA $5130
  STA $5204


banks:

Code: Select all

	.bank 0							; MMC5 Bank $00 (visible after reset, will be switched)
	.org $8000

	.bank 1							; MMC5 Bank $01 (visible after reset, will be fixed, which means it will never be switched)
	.org $A000

	.bank 2							; MMC5 Bank $02 (banks 02-13) that will switch over at the $8000 address)
	.org $8000

	.bank 2							; MMC5 Bank $03
	.org $8000

	.bank 4							; MMC5 Bank $04
	.org $8000

	.bank 5							; MMC5 Bank $05
	.org $8000

	.bank 6							; MMC5 Bank $06
	.org $8000

	.bank 7							; MMC5 Bank $07
	.org $8000

	.bank 8							; MMC5 Bank $08
	.org $8000

	.bank 9							; MMC5 Bank $09
	.org $8000

	.bank 10						; MMC5 Bank $0A
	.org $8000

	.bank 11						; MMC5 Bank $0B
	.org $8000

	.bank 12						; MMC5 Bank $0C
	.org $8000

	.bank 13						; MMC5 Bank $0D
	.org $8000

(...)

	.bank 125						; MMC5 Bank $7D
	.org $8000

	.bank 126						; MMC5 Bank $7E (visible after reset, will be fixed, which means it will never be switched)
	.org $C000

	.bank 127						; MMC5 Bank $7F (visible after reset, will be fixed, which means it will never be switched)
	.org $E000
EDIT:

I checked, but in NESASM3 it will not work. There is a problem with limiting the number of banks to 128 (0-127), which are permanently 8KB in NESASM3. This gives the possibility to do 1024KB PRG ROM (128x8KB), but with CHR RAM which the MMC5 does not support. CHR ROM then uses the next NESASM3 banks above 128, so the error "Bank index out of range!" Pops up. Such a ROM can be made with another assembler that has the ability to set banks of 16KB size or has no limitations such as NESASM3 to 128.
Last edited by sdm on Wed May 19, 2021 3:22 am, edited 2 times in total.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: MMC5 ExGrafix Hello World

Post by unregistered »

sdm, please create a new thread to post your own question in the future. Consider that this thread’s penultimate post is 10 years old. Yes, similar topic, but searching for your responses can be a bit daunting if you can’t specify your name in the thread creator box. :)

I have no MMC5 experience; sry.
Post Reply