Need help inserting an asm patch!

View previous topic View next topic Go down

Need help inserting an asm patch!

Post by SePH on Sat 14 Sep 2013 - 1:31

About a year ago, I've asked wiiqwertyuiop for an asm patch that would allow me to add new graphics on the title screen that weren't contained in any tilesets...

[You must be registered and logged in to see this image.]

I basically wanted to add those credits at the bottom. Scrolling if possible even lol

You can essentially view the rest of the thread here: [You must be registered and logged in to see this link.]

You need to add those lines of asm into Overlord which you can get here: [You must be registered and logged in to see this link.]

Here's wiiqwertyuiop coding:

wiiqwertyuiop wrote:Here is a code that should work:

Code:

REP #$20
LDA #$0000  ; Destination go here for info: http://dl.dropbox.com/u/29210231/VRAM_Map.txt
STA $2116
LDX #$01    ; Transfer mode
STX $4360    ; Change the channel if needed

LDX #$18
STX $4361

LDA #Graphics
STA $4362
LDX.b #Graphics>>16
STX $4364

LDA #$0800 ; GFX size
STA $4365  ; To get the size right click on your exgfx file and go to properties (the last option) look at the size (not the "size on disc") and convert it to hex on the calculator.

LDX #$40
STX $4355
SEP #$20
RTL

Graphics:
incbin  GFXFile.bin  ; This is the GFX file to use
if you want to save space you can compress them to LC_LZ2 format using Lunar Compress and upload them with this:

Code:
LDA #$7E
STA $02
REP #$20

LDA #$6000
STA $00

LDA #Graphics
STA $C8
LDX.b #Graphics>>16
STX $CA

JSL MeCode  ; Decompress the data

LDA #$0000  ; Destination go here for info: http://dl.dropbox.com/u/29210231/VRAM_Map.txt
STA $2116
LDX #$01    ; Transfer mode
STX $4360    ; Change the channel if needed

LDX #$18
STX $4361

LDA #$6000
STA $4362
LDX #$7E
STX $4364

LDA #$0800 ; Size of the GFX *uncompressed*
STA $4365  ; To get the size right click on your exgfx file and go to properties (the last option) look at the size (not the "size on disc") and convert it to hex on the calculator.

LDX #$40
STX $4355
SEP #$20
RTL

Graphics:
incbin  GFXFile.bin  ; This is the GFX file to use
that should also work with the tilemap. What I would do is first upload the GFX then go to the level/title screen and make a save state in ZSNES, then open it with this, make it and upload it. You can make the palette in Hyrule Magic or whatever.

For the moving text, I would put the text on some other layer (like BG3 for example) and just increase it's X pos. Example:

Code:

INC !RAM
I'm much clueless when it comes to asm and ram together at the same time... so any help inserting it in game is much welcome! I'll of course need to update the credits as a lot has happened in one year Razz

SePH



Since : 2012-06-19

Back to top Go down

Re: Need help inserting an asm patch!

Post by Conn on Sat 14 Sep 2013 - 6:28

I'm unfortunately not very skilled with asm texts and cannot really trace how it should work out. Maybe Euclid, MoN or XaserLE are better suited to help you here...? :-/
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Need help inserting an asm patch!

Post by SePH on Sat 14 Sep 2013 - 18:45

No worries, I'm pretty sure it isn't that hard actually. The asm code seems easy to understand enough as its commented. The only thing I need to change is that line I guess:

LDA #$0000  ; Destination go here for info: [You must be registered and logged in to see this link.]

and maybe those ones too:

LDA #$0800 ; GFX size
STA $4365  ; To get the size right click on your exgfx file and go to properties (the last option) look at the size (not the "size on disc") and convert it to hex on the calculator.


Then I create a "GFXFile.bin" yy-chr file that contains the credits and insert the patch using overlord.

I only need to figure out what is the destination I should use... I'm a noob when it comes to ram and even more when it's vram, what's the difference between the two actually?

SePH



Since : 2012-06-19

Back to top Go down

Re: Need help inserting an asm patch!

Post by Conn on Sat 14 Sep 2013 - 21:23

basically, you have a rom. The rom sends in a one-way street data to ram. From ram (in some cases also directly from rom) you send data to the different ram sectors, that a game is built upon. These are aram (audio ram for spc), vram (video ram for graphics) and sram (save ram for progress). That's mainly all rams a video game needs to satisfy your experience. There are also aliens (cgram for palette, wram (I think sprites), oam (sprites on screen) but don't care about those, these are hardly needed for hacking.
The ram is the most important storage since, and keep that in mind, your game actually plays here. Here are all information for current sprites on screens, bg and so forth.

As for your specific question:
A vram transfer is needed to access everything visible on screen. It is either handled from ram or rom (you can address both).
A typical vram dma transfer is following (one of my code as example):


Code:

REP #$30 ; set 2 byte read    
LDA #$xxxx        ; vram destination
STA $2116          ; destination register
LDA #$xxxx         ; vram origin    
STA $4302           ; origin register
LDA #$1801        ; bus      
 STA $4300          ; bus register
SEP #$30             ; set 1 byte read
LDA $4212  
AND #$80                
BEQ $F9              ; wait for vblank
LDA #$80                
STA $2115          ; VRAM Address Increment Value
LDA #$xx            ; vram origin bank    
 STA $4304  
LDA #$xx           ; number of bytes to transfer (chunk size      
STA $4305          ; chunk size register
LDA #$01                
STA $420B           ; execute dma transfer
It looks complicated but it isn't. The vram is 1000 bytes and contains all information (map, gfx) of any tile and object on screen!
So you need to tell the vram where to store the information, that is destination and stored to register $2116. So you need to specify where of the 1000 bytes vram the gfx (or map) shall go to.
You can only make a dma transfer during vblank, therefore the code that checks register $4212.
Then you of course need an origin from where the data in rom (or ram) shall be transferred (the address where the gfx is, in case it is compressed you need first to decompress it into ram and then from ram to vram). This is handled via registers $4302, $4303, $4304 (reverse order, so $4304 is the bank).
And of course you need to tell how many bytes you want to transfer (size of the gfx, via $4305

I do not understand why wiiq uses 6 instead of 0, e.g., 4365 instead of 4305... but in the end it should be the same.

If you already have the asm inplemented as well as the gfx you need to tell the rom where to display them (vram destination). I think 2 vrams are needed, one for the gfx and one for the map... but as told, I do not know whether I can include it. If you have a rom with this asm and gfx and everything inserted you can send it to me and I look whether I can fix it to have the correct destination and so.
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Need help inserting an asm patch!

Post by SePH on Sat 14 Sep 2013 - 21:39

Alright, I'll change my intro graphics and try to apply the patch on my own and send it to you in the coming days so you can fix it Smile

Thanks for the explanations aswell!!

SePH



Since : 2012-06-19

Back to top Go down

Re: Need help inserting an asm patch!

Post by Conn on Sat 14 Sep 2013 - 21:54

ok, I'll give it a shot then Wink
avatar
Conn



Since : 2013-06-30

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum