Real SNES hardware help?

Programming the SNES - covers hardware via 6502 emulation mode (65816 coming next year!)
Post Reply
Posts: 2
Joined: Sun Jul 24, 2022 6:35 pm

Real SNES hardware help?

Post by Domeshtan » Mon Jul 25, 2022 1:07 am

I hope you can help me because I'm staring to loose my mind trying so many different ways. I have both of the books and I wanted to learn SNES assembly programing. I know it isn't ment to be "in depth" to cover everything. I've already wrote about a dozen games total for Atari 2600, NES and one Colecovision so assembly isn't totally new to me.
I managed to get the examples to assemble and link into a rom image. Only thing I changed was the location so I wouldn't have to type out extra stuff. So my lines would be....
wla-65816.exe -i -o cart.o HellolWorld.asm
wlalink -i -b cart.txt cart.sfc

I can get the stuff to run on an emulator but not real hardware. It's driving me nuts. Snes9x tells me things like the rom is corrupt, bad checksum, etc. It does run but it seemed something was off...

I bought some circuit boards from Muramasa for making my own SNES cartridges. I have test boards made for LOROM games 1 Meg and under and others for LOROM or HIROM games (and probably others like ExHi, etc) up to 2 Megabytes. I am using a GQ 4x4 (and also an adp-054 adaptor for larger eproms.) Eproms I am using are 27C040 (512K chip) and 27C160 (2 Megabyte chip). I've tested a few LoROM and HIROM homebrew games on them and the boards work fine on a real Super Nintendo. (No rewiring either... Yay!) I have 12F629s programer as SuperCICs to get around the lock-out chip problem. (Reverse engineered multi region lock out chip clone.) I've tested them with Classic Kong Complete, Jet Pilot Rising and some other multi-player simple fighting game. Everything works fine so I know it isn't a hardware issue or writing the files wrong.

With all of the tutorials they come up as a blank screen on a real system. After much looking around reading and watching videos I think I have found some issues...

The file always came out as 32K actual size. After some reading I changed the linker command line from -b to -r to make a proper sized rom image...
wlalink -i -r cart.txt cart.sfc

File size was now right. Next thing I noticed...
SLOTSIZE $020000

BANKSIZE $020000
It does make a file 128K in size but from what I understand if a game is LOROM it uses 32K banks. HIROM uses 64K banks. All the other examples I found out there have multiple banks using these sizes.

Another thing... No header type information defined. SLOWROM/FASTROM, LoROM, HIROM, title, country, rom size, etc. I understand this part can be a bit optional.

Next I think this may be part of the problem... Defining the vectors. A video made it sound like the vectors are pretty important to make a game run. I see something at the end like...
.DW $0000 ;NMI
.DW $8000 ;Reset vector
.DW $0000 ;IRQ/Break
These are the only examples I've seen done that way. Others I see things defining
COP EmptyHandler
BRK EmptyHandler
ABORT EmptyHandler
UNUSED $0000
IRQ EmptyHandler

and then something simular...

COP EmptyHandler
UNUSED $0000
ABORT EmptyHandler
NMI EmptyHandler
IRQBRK EmptyHandler

So I take it that written this way it would do slightly different things depending if you are in 65816 Native mode or the 6502 emulated mode?
All I know is every other program looks different.

The another thing that I am sure is playing a part is having things in memory zeroed out and set on a real system. Snes_Init SEMIFREE section I saw in some files. It's long with quite a bit to zero out and set. I know emulators and stuff might have things zeroed out and set already. My NES games ran fine on emulators and even worked fine on my Everdrive N8 I used for testing, but once I put my programs on Eproms cannibalizing some Ice Hockey cartridges I got square patches of wrong colors all over the screen and gibberish at the top and bottom of the screen because my atribute table wasn't zeroed out and the entire screen was not filled with empty spaces for unused areas.

So basically I have tried to "re-word" and rearrange things every way I could think of to get things working on a real SNES. I tried parts of other programs, I've tried LOROM headers, HIROM headers.... I don't want to change out of WLADX at this point after all this. Other examples ... No use ca65, no use 64tass, etc. Everything seems scattered all over and I can't get ANYTHING to assemble and work on real hardware. Like I said, other homebrew games run fine on it so it's not the circuit boards or writing to the Eproms.
Basically can someone PLEASE make a version of the tutorial examples that runs on a real machine using WLADX? Preferably all in one assembly file not split up for the header or Snes_Init info to zero things out properly.
I just want some kind of "skeleton" program where I can just add and tweak stuff with a ready made routine to get someone up and running. I already played with the text, colors, changing graphics, changing keypad stuff around experimenting but I'm at my wits end trying to get it to run on a real machine. Only other thing I can think of is if it's bouncing back and forth the wrong way expecting 8 or 16 bit values swapped around. Thanks so much for your time!

Posts: 2
Joined: Sun Jul 24, 2022 6:35 pm

Re: Real SNES hardware help?

Post by Domeshtan » Mon Jul 25, 2022 1:25 am

Test boards I am using.
Test boards I am using.
TestBoardsSNES.jpg (113.05 KiB) Viewed 29 times

Post Reply

Return to “Super Nintendo Assembly Programming”