News:

11 March 2016 - Forum Rules

Main Menu

HiRoM/LoRoM

Started by mopoz, March 11, 2013, 05:20:03 AM

Previous topic - Next topic

mopoz

Hi guys!Please help me.
So I write firmware for the flash cartridge for SNES. I have a problem, how to programmatically determine which mapper?
Just to prove that each header, it is possible that the bytes match.
I just need to know how to accurately determine the offset to read the header to set the flash cartridge.

I am writing to ASM
Skate-punk rulezzzz

henke37

All licensed snes games include a header that states the id of the memory map used.

Gideon Zhi

Quote from: henke37 on March 11, 2013, 11:21:36 AM
All licensed snes games include a header that states the id of the memory map used.

Except that with the exception of stuff like the NMI, IRQ, and reset vectors, most of the header information is never actually accessed by the software, and as such is frequently incorrect and can't be trusted.

mopoz

let us say:

sep #$20
lda $7Fd5
cmp #$20
beq lorom_slow
cmp #$30
beq lorom_fast
cmp #$32
beq 12mbit_rom
bne check_hirom



check_hirom:
lda $ffd5
cmp #$21
beq hirom_slow
cmp #$31
beq hirom_fast
cmp #$35
beq exhirom_fast
cmp #$25
beq exhirom_slow

If the randomly Lorom match bytes Hirom?
Then it will be a error. Or make a check on the size of the ROM, sram size, type, and more?
Skate-punk rulezzzz

henke37

Quote from: Gideon Zhi on March 11, 2013, 01:09:52 PM
Except that with the exception of stuff like the NMI, IRQ, and reset vectors, most of the header information is never actually accessed by the software, and as such is frequently incorrect and can't be trusted.
Then it is clearly a bad dump or a very badly done hack. Emulators actually look at these headers to figure out how to map the game.

Gideon Zhi

Quote from: henke37 on March 12, 2013, 03:23:17 PM
Emulators actually look at these headers to figure out how to map the game.

No, actually, they don't. They used to, and I remember it caused problems with some games.

Quote
(6:01:41 PM) Gideon Zhi: Hey, I *know* there are some SNES games that have bad cartridge header information buried in them.
(6:02:06 PM) Gideon Zhi: but I don't know what any of them are, offhand.
(6:02:31 PM) <byuu>: bazooka blitzkrieg says it has no ROM and 8mbit RAM
(6:02:34 PM) <byuu>: the reverse is true
(6:02:45 PM) <byuu>: thats ... actually it for commercial titles
(6:02:55 PM) <byuu>: betas and protos are fucked across the board
(6:03:02 PM) <byuu>: DSP1 tech demo, batman revenge of the joker, all of the
(6:03:03 PM) <byuu>: m
(6:03:13 PM) Gideon Zhi: I could have sworn that there were a bunch that had bad hirom/lorom bytes?
(6:03:17 PM) <byuu>: header doesnt distinguish between DSP1 and ST01x revisions
(6:03:30 PM) <byuu>: i dont know, nobody checks those
(6:03:35 PM) Gideon Zhi: hah.
(6:03:44 PM) <byuu>: if its at 7fcx its lorom, if its at ffcx its hirom
(6:03:57 PM) <byuu>: if its at both we look at the reset vectors first opcode to determine which one is correct
(6:04:05 PM) <byuu>: first op is almost always sei, clc or xce
(6:04:21 PM) <byuu>: it can also be at 40ffcx

None of the information in the cartridge header is used by the SNES except for the vectors. There's no guarantee that the data in the header is valid or not, and it would probably be a bad decision to attempt to trust it.

mopoz

Spoiler
first op is almost always sei, clc or xc
[close]

The fact that the Secret of Everomore begins with LDA.
To me it is necessary to write it in snes ASM.

I just do not know how to approach this, so that I can be recognized and the games that with a bad header.
Skate-punk rulezzzz