Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
1 user currently in Super Mario World hacking: labmaster | 3 guests
Acmlm's Board - I2 Archive - Super Mario World hacking - Layer 3/1 color mixing and SMW's HDMA
  
User name:
Password:
Reply:
 

UserPost
Sukasa
Posts: 764/1981
all right. I looked at the mist/tides/anything layer 3, and figured that it might have needed HDMA to scroll the layer three data independently of the status bar. I have had a little experience with ASM, that's true, but nothing major, just LDA and CMP and STA statements, mostly, with the corresponding ASM to boot. however, little to no custom animations are used in the tides and etc. levels. thanks for the HDMA tutorial,, as well.

Let me make sure I understand this. I need to first find the HDMA routine by looking for writes to $420C, then locate the RTI instruction, and just before it place a JML, then re-write the insdtrustion that was replaced in mny code segment? Then figure out the rest of HDMA and in my custom segment, just set registers $2131, $212C, $212D, $212E, and $212F with LDA and STA instructions. Then if I JML again back to the RTI, should that be all I need to do?
d4s
Posts: 220/325
this is simple, considering you have worked with assembler before(i think you did).

you say that the game already does this incrtain levels.
if thats correct, check how the game does that exactly.
it will either have an irq enabled or do it via hdma.

you will have to use 2 hdma channels to write 3 registers once every frame, so i'd suggest to use an irq instead of hdma writes,but you can do it either way.

this is how you implement it:
you will have to hook into the games nmi routine and add your code to the end of it.(look for the rti instruction, thats return from interrupt)

check if the game writes to register $420c, thats the hdma enable register.
if it does, you'll have to add the hdma channels you want to use there.(there is a total of 8 dma/hdma channels, but some will probably be occupied already)

a hdma transfer will only trigger at the beginning of the next frame, thus if you exceed your vblank time, the hdma transfer wont occur.
this can happen when too much animated exgfx are used in one level.

have one hdma transfer set up to single register/one byte transfer and point it to register $2131 (cgadsub).

the other one should be set up to do dual register writes/one byte transfer, point it to the mainscreen reg $212C.
this will issue a write to the main and subscreen register.

what you'll basically do is this:
disable colour addition, count several lines, enable it on layers 1,2 and then put layer 3 on the subscreen and layers 1,2,3 on the mainscreen.

the game will automatically reset main/subscreen and cgasub designation to its default values after a frame has been rendered, so you will most likely not have to take care of that.


i will give you a code example when im back home.
read up the hdma section of this file first and try to understand how it works:
http://www.geocities.com/Qwertie256/attic/snesemu/qsnesdoc.html

blackhole89
Posts: 711/971
First off, SMW does not use HDMA on layer three "out of the box", afaik. Secondly, this could easily be done and I even already considered doing the things you mentioned on my hack. Yet, I didn't bother to actually do it because I dislike how water behaves in SMW and hence don't want any tides in my hack.
When actually taking your time for it, it won't take up more than 15 minutes to code this (probably even less). The only problem I am currently having which stops me from helping you with that is my compie currently being broken (attempted to insert a new processor... it was already broken, and as a result my old processor was burninated and my BIOS was drained, so, ... ) and me not having access to my SMW hacking equipment.
Sukasa
Posts: 761/1981
Hey. I have looked at some of the threads on the board, and had this question:

Would it be possible to edit SMW's present Layer three HDMA for the tides to allow color mixing? It should be possible because the mist already does that, and that would make the tides a little more smooth. would anyone have any idea how to do this, besides editing the tides GFX? By that, i mean changing the ASM to allow layer three and layer one color mixing after the status bar, then disabling it for the status bar.
Acmlm's Board - I2 Archive - Super Mario World hacking - Layer 3/1 color mixing and SMW's HDMA


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.024 seconds.