1, 2  Next
Having linear addressed ROM and RAM in the same SNES cart. 
Author Message

Joined: 2014-10-29 21:13
Posts: 23
 Having linear addressed ROM and RAM in the same SNES cart.
Have a hirom game cart, but with the last few banks used for RAM? Is there anyway to do this with Higan or BSNES, or do I need to make my own physical cartridge.


2017-09-13 04:01
User avatar

Joined: 2014-10-29 21:24
Posts: 1814
Location: People's Republic of America
 Re: Having linear addressed ROM and RAM in the same SNES car
Try putting this into manifest.bml:

Code:
board region=ntsc
  rom name=program.rom size=0x200000
    map address=00-1f,80-9f:8000-ffff
    map address=40-5f,c0-df:0000-ffff
  ram name=save.ram size=0x200000
    map address=20-3f,a0-bf:8000-ffff
    map address=60-7d,e0-ff:0000-ffff

This will divide your cartridge so that exactly 2 MiB are ROM and that exactly 2 MiB are RAM. If you want 3 MiB ROM and 1 MiB RAM, then use the following instead:

Code:
board region=ntsc
  rom name=program.rom size=0x300000
    map address=00-2f,80-af:8000-ffff
    map address=40-6f,c0-ef:0000-ffff
  ram name=save.ram size=0x100000
    map address=30-3f,b0-bf:8000-ffff
    map address=70-7d,f0-ff:0000-ffff

_________________
bsnes-mcfly: A port of the Qt GUI from v073 to v106.
nSide: A higan fork w/NES boards and peripherals and Sonic & Knuckles Lock-On.
Dragon Quest I & II RPGOne Beran Inn bugfix


2017-09-13 04:19

Joined: 2014-10-29 21:13
Posts: 23
 Re: Having linear addressed ROM and RAM in the same SNES car
Okay so what exactly is a manifest bml?


2017-09-13 11:13
User avatar

Joined: 2014-09-27 09:21
Posts: 1550
Location: 日本
 Re: Having linear addressed ROM and RAM in the same SNES car
https://higan.readthedocs.io/en/latest/ ... manifests/

_________________
CaptainJistuce: He's totally in the wrong, Kakashi's 100% in the right.
Note: The above statement is subject to act of byuu.


2017-09-13 11:58
User avatar

Joined: 2014-09-25 13:57
Posts: 2144
Location: Australia
 Re: Having linear addressed ROM and RAM in the same SNES car
Thanks for the link, Kakashi.

The short version is something like:

In a real, physical SNES, a circuit-board connects the ROM chip to the cartridge connector. There's many, many different ways to wire those two things together; one of them is called "hirom" and another is called "lorom", but there are lots of others. higan uses a "manifest.bml" file in the game folder to describe exactly where in the SNES memory map (and in what order) the contents of the ROM will appear. Once you've imported your game into higan's game library, copy and paste one of the manifests from hex_usr's reply into a file named "manifest.bml" in the game folder.

Note that higan requires manifest files to be UTF-8 encoded and use Unix line-endings, even on Windows, so you probably want to use a real text editor to create the file, not Notepad.

Also, note that higan ignores manifests by default for annoying reasons, so you'll have to turn on manifest support in higan's settings.

_________________
Maintainer of the unofficial git repository for higan.

The ending of the words is ALMSIVI.


2017-09-13 12:04
User avatar

Joined: 2014-09-27 09:21
Posts: 1550
Location: 日本
 Re: Having linear addressed ROM and RAM in the same SNES car
Thanks for writing said link! :-P

_________________
CaptainJistuce: He's totally in the wrong, Kakashi's 100% in the right.
Note: The above statement is subject to act of byuu.


2017-09-13 12:05

Joined: 2014-10-29 21:13
Posts: 23
 Re: Having linear addressed ROM and RAM in the same SNES car
I find this helpful, but it looks like it would make it more complicated to share codes with other programmers. I might stick with lorom for now, but is there a way to get bass.exe to assemble more than 128kB of RAM?


2017-09-13 17:19
User avatar

Joined: 2014-10-29 21:24
Posts: 1814
Location: People's Republic of America
 Re: Having linear addressed ROM and RAM in the same SNES car
Changing the amount of RAM available to the Super Famicom is not bass's responsibility. The ROM's internal header can only do so much, and an actual Super Famicom never makes use of it. The Super Famicom has a hard limit of 128 KiB at
7e-7f:0000-ffff
, and if you need more, you can add more RAM to the cartridge.

In a HiROM, RAM is normally located at
20-3f,a0-bf:6000-7fff
, so there's 8 KiB of RAM per bank. You can probably have up to 64 banks, or 512 KiB of RAM.

Code:
board region=ntsc
  rom name=program.rom size=0x400000
    map address=00-3f,80-bf:8000-ffff
    map address=40-7d,c0-ff:0000-ffff
  ram name=save.ram size=0x80000
    map address=00-3f,80-bf:6000-7fff mask=0xe000

Out of curiosity, why are you trying to make the RAM contiguous with the ROM? Is there a reason it cannot reside at
00-3f,80-bf:6000-7fff
?

_________________
bsnes-mcfly: A port of the Qt GUI from v073 to v106.
nSide: A higan fork w/NES boards and peripherals and Sonic & Knuckles Lock-On.
Dragon Quest I & II RPGOne Beran Inn bugfix


2017-09-13 17:41

Joined: 2014-10-29 21:13
Posts: 23
 Re: Having linear addressed ROM and RAM in the same SNES car
I tried changing the SNES header, but for some reason doesn't go beyond 128kB of SRAM.

I'm doing it so I can have several large rotating/scaling sprites at once, without having to use Mode 7, enhancement chips, or lots of ROM.


2017-09-13 17:55
User avatar

Joined: 2014-10-29 21:24
Posts: 1814
Location: People's Republic of America
 Re: Having linear addressed ROM and RAM in the same SNES car
The SNES header's RAM size doesn't go beyond 128 KiB? I don't think icarus puts a limit on RAM size, so you should be able to have compatibility with higan. You probably won't be able to support Snes9x or ZSNES though, because cartridges with more than that much RAM have never been seen.

The RAM size byte's formula is:
log(ram_size) / log(2) - 10


To retrieve a RAM size from the byte value, then do this:
1024 * 2 ^ ram_size_byte
or
1024 << ram_size_byte


If you want to indicate 512 KiB of RAM, then store 0x09. 1024 * 2^9 is 524288, and 1024 left-shifted 9 times is also 524288, so you store 0x09 to indicate 512 KiB of RAM.

EDIT: Actually, icarus's heuristically-generated manifests prohibit the use of
00-0f,80-8f
for RAM addresses, so you will need to use custom manifests placed inside the cartridge folder.

_________________
bsnes-mcfly: A port of the Qt GUI from v073 to v106.
nSide: A higan fork w/NES boards and peripherals and Sonic & Knuckles Lock-On.
Dragon Quest I & II RPGOne Beran Inn bugfix


2017-09-13 18:07
1, 2  Next