Does anyone has ASM6 mapper 30 game template?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Does anyone has ASM6 mapper 30 game template?

Post by tepples »

Mapper 30 is iNES number 30. 30 in to hexadecimal is $1E. So change this

Code: Select all

   .db $20|MIRRORING ;mapper 2 and mirroring ;;what is this section like for mapper 30, INL boards?
   .dsb 9, $00 ;clear the remaining bytes
to this

Code: Select all

   .db $E0|MIRRORING ;low nibble of mapper number and mirroring
   .db $10 ;high nibble of mapper number
   .dsb 8, $00 ;clear one fewer byte because we now have a nonzero high mapper number
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Does anyone has ASM6 mapper 30 game template?

Post by lidnariq »

darkhog wrote:MIRRORING = %0001 ;%0000 = horizontal, %0001 = vertical, %1000 = four-screen
;;;does above still apply to mapper 30?
For mapper 30, %0000 and and %0001 still indicate fixed H/V mirroring.
%1000 and %1001 represent ... uh, depends on emulator.

Mesen implements %1000 to mean "four screen" and %1001 to mean runtime-selectable 1-screen.
FCEUX ... implements the opposite.

Joy. :x
is static bank still #7 or just the last one? In other words, should I add bank declaration of other banks before or after this section?
It is just the last one. (This is always true in mapper 2. In 64 KiB UNROM, there are four banks, and bank 3 is the last one. In 256 KiB UOROM, there are sixteen banks, and bank 15 is the last one. So yes, you need to add bank declarations for the subsequent ones.
darkhog
Posts: 192
Joined: Tue Jun 28, 2011 2:39 pm

Re: Does anyone has ASM6 mapper 30 game template?

Post by darkhog »

So...

Code: Select all

;----------------------------------------------------------------
; constants
;----------------------------------------------------------------

MIRRORING = %0001 ;%0000 = horizontal, %0001 = vertical, %1000 = four-screen

;----------------------------------------------------------------
; variables
;----------------------------------------------------------------

   .enum $0000

   ;NOTE: declare variables using the DSB and DSW directives, like this:

   ;MyVariable0 .dsb 1
   ;MyVariable1 .dsb 3

   .ende

   ;NOTE: you can also split the variable declarations into individual pages, like this:

   ;.enum $0100
   ;.ende

   ;.enum $0200
   ;.ende

;----------------------------------------------------------------
; iNES header
;----------------------------------------------------------------

   .db "NES", $1a ;identification of the iNES header
   .db $08 ;number of 16KB PRG-ROM pages
   .db $00 ;number of 8KB CHR-ROM pages
   .db $E0|MIRRORING ;low nibble of mapper number and mirroring
   .db $10 ;high nibble of mapper number
   .dsb 8, $00 ;clear one fewer byte because we now have a nonzero high mapper number

;----------------------------------------------------------------
; program bank 0
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 0 go here

   .org $c000

;----------------------------------------------------------------
; program bank 1
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 1 go here

   .org $c000

;----------------------------------------------------------------
; program bank 2
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 2 go here

   .org $c000

;----------------------------------------------------------------
; program bank 3
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 3 go here

   .org $c000

;----------------------------------------------------------------
; program bank 4
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 4 go here

   .org $c000

;----------------------------------------------------------------
; program bank 5
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 5 go here

   .org $c000

;----------------------------------------------------------------
; program bank 6
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000

;----------------------------------------------------------------
; program bank 7
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 8
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 9
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 10
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 11
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 12
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 13
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 14
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 15
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 16
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 17
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 18
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 19
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 20
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 21
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 22
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 23
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 24
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 25
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 26
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 27
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 28
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 29
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; program bank 30
;----------------------------------------------------------------

   .base $8000

   ;NOTE: contents of program bank 6 go here

   .org $c000
;----------------------------------------------------------------
; fixed program bank (31)
;----------------------------------------------------------------

   .base $c000

Reset:

   ;NOTE: initialization code goes here

NMI:

   ;NOTE: NMI code goes here

IRQ:

   ;NOTE: IRQ code goes here

;----------------------------------------------------------------
; interrupt vectors
;----------------------------------------------------------------

   .org $fffa

   .dw NMI
   .dw Reset
   .dw IRQ
Is there something else what I'm missing? I want self-flashable (for battery-less saving and to avoid bus conflicts) and CHR-RAM (which would make animation easy as all I'd need for animations was to load other tile into CHR-RAM in place of existing one).

Also, where should I put main loop? I want to reserve NMI for stuff that can only be done in Vblank, such as rendering.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Does anyone has ASM6 mapper 30 game template?

Post by lidnariq »

Code: Select all

;----------------------------------------------------------------
; iNES header
;----------------------------------------------------------------

   .db "NES", $1a ;identification of the iNES header
   .db $08 ;number of 16KB PRG-ROM pages
   .db $00 ;number of 8KB CHR-ROM pages
   .db $E0|MIRRORING ;low nibble of mapper number and mirroring
   .db $10 ;high nibble of mapper number
   .dsb 8, $00 ;clear one fewer byte because we now have a nonzero high mapper number
This is where all the remaining modification you need to make need to go. Please read nesdevwiki:iNES and nesdevwiki:NES 2.0 to understand the structure of this section.
Also, where should I put main loop? I want to reserve NMI for stuff that can only be done in Vblank, such as rendering.
You have a 16 KiB fixed bank. Currently, everything is already in that fixed bank.
darkhog
Posts: 192
Joined: Tue Jun 28, 2011 2:39 pm

Re: Does anyone has ASM6 mapper 30 game template?

Post by darkhog »

Reading and reading and I still don't understand what exactly to modify...
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Does anyone has ASM6 mapper 30 game template?

Post by lidnariq »

Well, let's go byte by byte.

iNES1 says that the first four bytes are fixed, always the same thing to mark that this is a NES file.
It also says that the fifth byte specifies the size of program data ROM in terms of units of 16384 bytes. 512 KiB ÷ 16 KiB = what?
The sixth byte is the size of the graphic data ROM in terms of units of 8192 bytes. There's no ROM, so this should be zero.
The seventh byte (called "Flags 6" because it's at offset 6 in the file, because bytes are zero-indexed) specifies mirroring, half of the mapper number, and whether there's nonvolatile storage on the board ("battery").
The eighth byte (called "Flags 7") stores the upper half of the mapper number ... as well as instructions on how to interpret the next 8 bytes.

Follow so far?
Post Reply