Acmlm's Board - I2 Archive - Super Mario World hacking - Found something useful [Howto]
User | Post |
HyperLamer
Posts: 1519/8210 |
Yes, but you seem to have a serious problem with releasing your findings. |
jonwil
Posts: 13/25 |
I have been using the exit table as part of my "random exit" blocks for ages now
|
BMF98567
Posts: 320/1261 |
Err...ooooops. That's what I get for skimming posts...I didn't realize you had already made use of that table.
I know I can just use bank 7F (as I have been doing), but sometimes having free RAM in the $0000-$1FFF range is nice, as it results in smaller code and a slightly larger selection of opcodes you can use. |
FuSoYa
Posts: 118/255 |
Originally posted by HyperHacker So how do you tell if there isn't an exit? Would it just point to level 000/100?
No, there's currently no way to know. The game doesn't clear the old values between levels. You could probably clear them out yourself with some ASM, if you really need a way to know that (or just do as the game did, and don't put an exit-enabled object on a screen that doesn't have an exit set up).
BMF: If you're willing to put up with the exit limitations of the original game, I suppose so... but it seems a bit extreme to be giving up those bits for a mere $10 bytes of RAM. If it were me, I'd just look for RAM in bank 7F that wasn't being used. |
HyperLamer
Posts: 1504/8210 |
But then you'd be restricted to levels in the same 256 as the current one, and the Secondary Exit and Water Level flags wouldn't work.
So how do you tell if there isn't an exit? Would it just point to level 000/100? |
BMF98567
Posts: 318/1261 |
Originally posted by FuSoYa The $19D8 array was rather pointless in the original game... it was being used to store a single bit from the screen exit data. But the game never bothered to look at it. It was probably for something Nintendo either abandoned or never got around to.
You mean...if I were to hack out all the code that writes to this table, I'd have even MORE free 16-bit RAM addresses to use?!
*Neko54123 sweats slightly |
FuSoYa
Posts: 117/255 |
Originally posted by HyperHacker Bit 2 = Is Exit Present Flag (set if any exit is on this screen)
Er, not quite. I chose that bit to indicate whether it's an original style exit, or a new LM ASM enhanced exit. If it's set to zero to indicate an old style exit, all the other bits in that byte are ignored and the exit is determined the way the game originally did... meaning you can only exit within the same 0x100 OV level block, only use secondary exit #s within that same block, and all the exits in the level must be either secondary or normal (not a mix of both).
The $19D8 array was rather pointless in the original game... it was being used to store a single bit from the screen exit data. But the game never bothered to look at it. It was probably for something Nintendo either abandoned or never got around to.
LM always uses new style exits when saving levels, but original levels that haven't been saved using LM yet will still be using the old style.
I posted the information on the new exit array flags almost 3 years ago on the old board...
|
HyperLamer
Posts: 1503/8210 |
I figured out the exit tables. Just write to the given address plus the desired screen number.
7E19B8 - Exit Table, low bytes (32 bytes) 7E19D8 - Exit Table, flags + high bit (32 bytes) Bit 0 = High bit of level # (1=level 1xx, 0=level 0xx) Bit 1 = Is Secondary Exit Flag Bit 2 = Is Exit Present Flag (set if any exit is on this screen) Bit 3 = Make Destination Water Flag (Secondary Exit only) Bits 4-7 = Unused
So, say screen 2 had an exit to level 106 as a water level, then 7E19BA = 06 and 7E19DA = 0D (00001101).
To make this even more useful: 7E0095, 7E009B and 7E00D2 all appear to contain the current screen number that Mario's in. You can read them to know what address to write to. |
|