This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Does anyone has ASM6 mapper 30 game template?

Does anyone has ASM6 mapper 30 game template?
by on (#227764)
Basic stuff such as header, NES initialization, simple state machine, some mapper30-specific macros and so on. Just so I can start write other stuff (actual game code like data loading, etc.) without having to worry about basics.
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227770)
You could also use a mapper 2 template, as mapper 30 can run essentially all software designed for mapper 2.

Unfortunately, I've only made one of those for ca65, not ASM6.
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227782)
Also take a look at this viewtopic.php?t=6160 , search for UNROM.
A must read:
https://wiki.nesdev.com/w/index.php/UNROM_512
https://wiki.nesdev.com/w/index.php/Programming_UNROM
https://wiki.nesdev.com/w/index.php/CHR ... to_CHR_RAM
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227796)
Thanks, but I'm looking into UNROM-512 specifically to take advantage of the features of this mapper and INL boards, such as increased ROM space (512KB).
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227798)
To upgrade a template for 128 KiB UNROM to 512 KiB, find the places where it puts 7 blank banks and put 31 instead.
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227801)
There are more differences between the two other than the amount of banks. I need a template so I won't get something that doesn't compile.
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227802)
mapper 30 / UNROM512 is literally just mapper 2 with the following modifications:
1- supports self-flashing
2- always has exactly 512 KiB of SST39SF040 flash instead of variable amount of ROM
3- may support multiple banks of CHR RAM (but not always)
4- may support alternative nametable layous (but not always)

None of these other changes will produce something that doesn't compile.
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227804)
But they need a different template to Mapper 2 one, up to and including iNES header. And by "not compile" I've actually meant "not compile into a valid Mapper 30 rom", not that there would be any errors or anything like that.
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227805)
There are no relevant differences between a 512 KiB mapper 2 ROM and a 512 KiB mapper 30 ROM.

If it's a valid 512 KiB mapper 2 ROM, it will work as a mapper 30 ROM.
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227806)
Yeah, but I kinda want self-flashing capability (battery-less saving and no bus conflicts) and CHR-RAM (for easy animated tiles).
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227807)
And neither of those have anything to do with the ROM that you've made, and everything to do with the code that you put in it.
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227808)
The self flashing feature doesn't involve changing any of the file layout, but the header should select mapper 30 and battery backerd RAM.

The CHR-RAM banking feature also doesn't involve changing any of the file layout, but the header should be iNES 2 and specify 32 KB of CHR-RAM.
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227811)
I see. I feel like it'd be best if someone capable could make full UNROM-512 template here (in particular, bank definitions). I can handle actual logic such as initializing the PPU, setting up attributes and name tables and so on, but bank definitions and ines header... that stuff scares me.

//edit: And does anyone has more complete docs of UNROM-512 than what wiki has (which mostly deals with electrical layout of the board and not what memory locations it uses and for what).
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227812)
Why don't you try making a mapper 30 template from the mapper 2 template that Tokumaru shared and we'll tell you if you did it correctly.
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227817)
I may try but I probably wouldn't do it correctly (mostly talking about the header and bank definitions). For example, I don't know what iNES ID does mapper 30 have and if |mirroring of the mapper 2 template still applies. For reference, this is how actual mapper 2 template looks like (with triple semicolons, ;;;, comments added by me to express my doubts):

Code:
;----------------------------------------------------------------
; constants
;----------------------------------------------------------------

MIRRORING = %0001 ;%0000 = horizontal, %0001 = vertical, %1000 = four-screen
;;;does above still apply to mapper 30?

;----------------------------------------------------------------
; 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 $20|MIRRORING ;mapper 2 and mirroring ;;what is this section like for mapper 30, INL boards?
   .dsb 9, $00 ;clear the remaining bytes

;----------------------------------------------------------------
; 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

;----------------------------------------------------------------
; fixed program bank (7)
;----------------------------------------------------------------

   .base $c000
  ;;;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?
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
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227821)
Mapper 30 is iNES number 30. 30 in to hexadecimal is $1E. So change this
Code:
   .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:
   .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
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227823)
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

Quote:
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.
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227844)
So...

Code:
;----------------------------------------------------------------
; 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.
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227867)
Code:
;----------------------------------------------------------------
; 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.

Quote:
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.
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227870)
Reading and reading and I still don't understand what exactly to modify...
Re: Does anyone has ASM6 mapper 30 game template?
by on (#227874)
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?