User | Post |
blackhole89
Posts: 92/971 |
*pushes* Ah yes, back from deep underground. Well then, I'll check this out.
EDIT - This didn't fix my problem, but anyway, I found the (evident) reason for the crash: It occurs only when a palette change is done. Many of the SMW-intern palette changes don't care for vertical-blank periods and therefore can start changing the palette amidst of HDMA's work, interfering with the first HDMA table working on $2121 (palette index selector) in some way and causing a crash/pointer havoc/endless loop/whatsoever. I fear there's no real way to fix it, unless you can make all the palette changes wait for VBLANKs.
GreetZ Blacky. |
BMF98567
Posts: 117/1261 |
Alright, new version is available here. There are some major changes this time around, so please read this carefully...
First, you'll need to insert hdmamainv2.bin, just like you did hdmamain.bin. However, this one hooks a different part of the code (in the NMI routine, actually), so you'll need to restore the old JSL @ $2495 (should be 22 00 80 7F) and make the following change at $03AA:
22 xx xx xx EA EA EA EA (where xx xx xx is the 24-bit address of hdmamainv2.bin)
In this version, there are 8 reserved sections of memory, one for each HDMA channel. Your palette-based code will write the HDMA parameters here. Each section is 8 bytes long, though the last 2 bytes are currently unused. They are set up as follows:
HDMA 0: $7FFF00 HDMA 1: $7FFF08 HDMA 2: $7FFF10 HDMA 3: $7FFF18 HDMA 4: $7FFF20 HDMA 5: $7FFF28 HDMA 6: $7FFF30 HDMA 7: $7FFF38
Each set of parameters has the following format:
CC PP RR AA AA AA xx xx
CC: HDMA channel enable flag. This must correspond to the channel number of the memory section you're using:
HDMA 1: 01 HDMA 2: 02 HDMA 3: 04 HDMA 4: 08 HDMA 5: 10 HDMA 6: 20 HDMA 7: 40 HDMA 8: 80
PP: HDMA parameters (register $43x0).
RR: PPU register to be altered by this HDMA channel.
AA AA AA: 24-bit address of your HDMA table.
xx: Currently unused.
Unused sections (those starting with a zero byte) will be bypassed, and the corresponding HDMA channel will be left untouched.
NOTE: Although you can configure up to 8 channels simultaneously, please note that only channels 3 and 4 appear to be entirely unused. The rest are used for other HDMA effects and general-purpose DMA. Use them at your own risk!
Now, a rundown of the new palette-activated hdmasubv2.bin example file:
$01, $10: These 24-bit addresses point to one of the 8 memory sections described above. In the example file, they're set to channel 3 ($7FFF18). $0D: 16-bit address of HDMA parameters. $17: Size of HDMA table, minus 1. $19: 16-bit address of HDMA table. $1C: 24-bit RAM address HDMA table will be copied to. Set to $7FFF40 by default. $40: HDMA parameters, 6 bytes. This is copied to the memory section specified at $01 and $10. In the example file, it's set to channel 3, write mode 02 (write twice), PPU register $210F, table address $7FFF40. $46: HDMA table. This is copied to the RAM address specified at $1C.
Okay, I'm very tired and this post is making less and less sense each time I read it. In summary, all you need to do to use an HDMA channel in this version is write the necessary parameters to the appropriate memory section (so, if you want to use channel 3, write the parameters to $7FFF18; for channel 4, $7FFF20; etc.). The code will take care of the rest for you.
To activate HDMA channel 4, using write mode 02, PPU register $210F, and HDMA table at $7FFF80, write the following to $7FFF20-$7FFF26:
10 02 0F 80 FF 7F
Please note that I haven't tried using multiple channels at once with this code, though it *should* work. If not, let me know.
Any questions, please don't hesitate to ask. I can probably explain things better once I've had a good night's sleep... |
blackhole89
Posts: 89/971 |
Yep, that could be way better. Meanwhile, I'd better think about how I'll get rid of the old code the best way... |
BMF98567
Posts: 116/1261 |
I really don't think that was the main problem with it...as we both know, it just clears the area of RAM reserved for sprite data (which is later copied to actual OAM memory). Doing so at the wrong time shouldn't cause a crash, unless there are some freaky timing issues going on elsewhere in the hardware.
Anyway, it doesn't really matter anymore, as I'm probably going to hook a different part of the code in the next release. |
blackhole89
Posts: 88/971 |
At last. I think the old version's capital error was that it was hooked on that 7F8000 call, wasn't it? |
BMF98567
Posts: 115/1261 |
Just a quick little update: I've decided to rewrite my HDMA-handling system from scratch, due to stupid limitations and a couple of bugs blackhole89 brought up. The new version will be able to handle multiple HDMA channels, and you'll have full control over which register each channel writes to, and what write method is used (the current version forces mode 02). If all goes as planned, it should be available before next week. |
mikepjr
Posts: 57/242 |
God i would love to be able to do this kind of stuff its sooooo panm cool. |
ExKay
Posts: 53/1114 |
Here is it:Palette ASM |
Atma X
Posts: 99/801 |
Oh, you're right you didn't. You quoted on Blackhole89's question and I just wasn't looking at it right. Sorry about that.
Edit: Where's BMF's "Palette-Based ASM System", I couldn't find a link for it. |
HyperLamer
Posts: 318/8210 |
I did? Read the first post. You have to import the hdmamain.bin file. |
Atma X
Posts: 98/801 |
Thanks Blackhole89, yes, please do post those.
And also, can you tell me how hard it would be to make the HDMA Effect from the last bosses room in Act Raiser (the Background moving effect, it's the space looking BG)? I could send you a savestate that is at that part if you're not sure which BG and HDMA effect that I'm talking about. |
blackhole89
Posts: 73/971 |
There are two ways in general.
(1) assembly. (2) the SNES9x cheat function (think ZSNES has kind of this too)
means, you won't come around asm when you wanna insert it in your hack. (2) can be used for some little experiments. If you wanna try, I'd post a list with about 15 game genie codes to be used at once. |
knuck
Posts: 187/1818 |
Atma X:
Originally posted by BMF54123 WARNING: This is only for people who are experienced with ASM. It involves directly modifying game code and utilizing palette hacks.
READ before you POST. |
Atma X
Posts: 88/801 |
So does HDMA hacking actually require any knowledge of ASM? If not, is there a program that can be used to help me to edit it. |
blackhole89
Posts: 71/971 |
It's quite good (used this one too), but this one's even better: http://www.geocities.com/Qwertie256/attic/snesemu/qsnesdoc.html#DMATransfers Can be also used as a reference. As for assembly, I recommend you to google around a bit.
GreetZ Blacky. |
Atma X
Posts: 87/801 |
HyperHacker: I'm not really familliar with ASM or HDMA, so I was wondering (from your opinion) if this page I found is a good place (a good explination of how to hack HDMA) for me to get started with HDMA hacking. http://www.emulatronia.com/doctec/consolas/snes/dma.txt |
blackhole89
Posts: 67/971 |
@BMF: Now I've got a real problem. I am using HDMA chans #2 and #3 together for background gradients (as described above). #2 works on $2121 and #3 on $2122, so I basically edit the palette. It looks ok, but is heavily unstable (as described above). If you can help me, I'll mail you the ROM.
GreetZ & thanks in advance, Blacky. |
HyperLamer
Posts: 241/8210 |
Originally posted by blackhole89 No. Change the register# affected by the HDMA. Search Google for "SNES register", you'll find a lot of manuals. I think BMF well described what in particular you should change. (Exchange L2 HSCROLL with L1 HSCROLL register).
And I think YI's fuzzy effect was waving horizontally. It won't work that way unless there's something like "VDMA".
GreetZ Blacky.
And of course change the collision detection to match. YI used the SuperFX chip for that. |
Atma X
Posts: 85/801 |
What is the hdmamain.bin. (Is it only useful for ASM Hackers?)
Edit: I hate when everything is capitalized, Acmlm please change it back, it's killing my eyes! |
Xkeeper 2.0
Posts: 22/1091 |
Originally posted by BMF54123 So, is anyone getting any use out of this?
Err, the real reason for the bump is to let you guys know that hdmamain.bin has been updated to fix a couple of problems, namely HDMA shutting off when you die or pause the game. Turns out there's a RAM mirror of $420C at $0D9F that's not reset after each frame, so the code now writes there instead.
Message boxes, keyholes, and goals still don't properly coexist with custom HDMA, though...I should have a fix shortly.
[EDIT] A sample of HDMA's awesome power:
Is that a real screen from SMO? Looks great!
Oh, and is it possible to do something like HDMA on sprites only? (I would use it on the last level ) |
This is a long thread. Click here to view it. |