I've been working through the PVSnesLib wiki tutorials to begin learning SNES coding, and one thing I wanted to try was to run code that I've compiled on actual hardware. I have successfully built
one of these USB-flashable carts on an SHVC-1J3M-11 board, and tried twice unsuccessfully to build one on an SHVC-1A3M-30, so for now I'm limited to HiROM. However, the "likemario" example provided with PVSnesLib is built for LoROM. I've looked through the code, and I really don't understand where in the code or in the project configurations the memory mapping is defined. Can anybody help me re-map this code example to an SHVC-1J3M-11 (HiROM) board? The code is found in the games\likemario directory of
this set of snes examples The only thing I could find that seemed even remotely relevant to the memory map is the .MEMORYMAP section of hdr.asm, but if that is, in fact the key to this, I need some help setting this section properly for my mapping. Thanks.
I think HiROM might still map every other 32K chunk to LoROM, so if the code is small enough, you could keep it LoROM and just pre-pad it with 32K of filler.
Yes, you should be able to get away with doubling up every 32K of ROM data, max size 2MB (which would expand to 4MB.)
Ok, that's good to know for the sake of getting that one example running on hardware (though I haven't tried it yet... I'll give it a shot when I get back to the dorms), but I would also like to understand how to actually configure the code to compile as HiROM (without duplicating code...) using the toolchain, if anybody has any ideas there. If you don't feel like downloading the code to look at it, here's the section from header.asm that seems to be the most likely candidate for controlling this (nothing else in the code seems to have anything to do with memory mapping):
.MEMORYMAP ; Begin describing the system architecture.
SLOTSIZE $8000 ; The slot is $8000 bytes in size. More details on slots later.
DEFAULTSLOT 0 ; There's only 1 slot in SNES, there are more in other consoles.
SLOT 0 $8000 ; Defines Slot 0's starting address.
SLOT 1 $0 $2000
SLOT 2 $2000 $E000
SLOT 3 $0 $10000
.ENDME ; End MemoryMap definition
.ROMBANKSIZE $8000 ; Every ROM bank is 32 KBytes in size
.ROMBANKS 8 ; 2 Mbits - Tell WLA we want to use 8 ROM Banks
The .ROMBANKSIZE param is pretty self-explanatory, but changing that alone doesn't work because then the banks don't match up to the mapping, and the compiler throws a fit. Any ideas on setting up the .MEMORYMAP section? I assume that the SLOTSIZE should match the ROMBANKSIZE, but I'm not sure how to set the starting addresses.
Also... 32Kbit or 32Kbyte for the doubling-up of the code?
32KBytes; each bank on the 65816 is 64KBytes, hence byuu's proposal.
Shame on both blargg and byuu for not specifying a unit! :P Sorry guys, just had to say it. ;-)
Technically, they did specify a unit... they just used an ambiguous abbreviation.
Oh my, you're using wla. Run for cover, that thing is buggier than the houses I lived in as a kid. My main preference for LoROM is the much simpler memory model when accessng program data, the 2K RAM, and I/O registers. HiROM requires more familiarity with the 65816 addressing modes, and is easier to mess up if you forget which bank a particular mode uses.
You don't have choice when use the snes-sdk or the PVSnesLIb, as tcc816 only works with (customized) WLA.
I personally don't know how to setup the compiler to use HiROM, if it is even possible, but I would like to know.
If somebody has a good "For dummies" guide for setting up a better toolchain, with example code, I'm all ears. I'm using WLA because I'm using PVSnesLib, but I'm open to suggestions.
Yay
I too drink rubbing alcohol when doing development. :D
No, the root beer is for drinking. The rubbing alcohol is for cleaning PCBs
Apparently, the doubling trick doesn't always work. Not that I really expected it to, but I had the bright idea today that since I couldn't get a LoROM board working with my FlashROMs, I could try converting Zelda: Parallel Worlds to work with my HiROM (SHVC-1J3M-11) board. It boots fine, and I can get as far as the new game naming screen, but at that point, no matter what letter I choose, it just types a capital 'A', and when I press END, it goes back to the game select screen without actually creating the game. Is there any chance of making this work, or should I just give up? Is this maybe due to SRAM being mapped differently in HiROM than it is in LoROM?
> Is this maybe due to SRAM being mapped differently in HiROM than it is in LoROM?
That is correct. 1A boards have SRAM in 70-7f:0000-7fff (some from 0000-ffff), and 1J boards in 30-3f:6000-7fff (some in 10-1f, some in 20-2f); both ignore A23 so you get your f0-ff or b0-bf mirrors, of course.
You could try splicing your own wires to remap SRAM, but that's getting pretty extreme :/
Yeah, that is a bit extreme. I just wish I could get the stupid 1A boards to work with my flash ROMs
No matter what I do with them, I just get a black screen, even when I flash the original game to it...