Hex editing for overriding the pendant phase to the crystal

Page 4 of 4 Previous  1, 2, 3, 4

View previous topic View next topic Go down

Re: Hex editing for overriding the pendant phase to the crystal

Post by SunGodPortal on Wed 21 Dec 2016 - 1:01

Cool. Glad I could help. Just don't forget that you can customize the rate at which the magic refills in case the "stock" rate it doesn't suit your hack.
avatar
SunGodPortal
                             
                             

Since : 2015-01-26

Back to top Go down

Re: Hex editing for overriding the pendant phase to the crystal

Post by AntROMhacker on Wed 21 Dec 2016 - 1:08

Yeah, my hack already has a lot of cool things added in it, such as opening chest from all four directions, a brand new castle, storyline, auto refill magic, and much more. Very Happy I want it to be a type of mixed difficulty hack really, at first it's easy, then it gets really really hard, and the process repeats. Oh yeah, before you get the sword you can punch enemy's, kind of like Conker. Except I didn't take the all in patch and just apply it, because I won't learn that way, I got to get in depth with Hex and HM.

AntROMhacker
Rank: Snap Dragon
Rank: Snap Dragon

Since : 2016-04-13

Back to top Go down

Re: Hex editing for overriding the pendant phase to the crystal

Post by AntROMhacker on Wed 21 Dec 2016 - 11:19

SunGodPortal wrote:Cool. Glad I could help. Just don't forget that you can customize the rate at which the magic refills in case the "stock" rate it doesn't suit your hack.
Hi, i was reading the compendium and i see there are some hex addresses(?) that are like 0xDBE9E , do you need to convert these to hex addresses? if so , how can i?

AntROMhacker
Rank: Snap Dragon
Rank: Snap Dragon

Since : 2016-04-13

Back to top Go down

Re: Hex editing for overriding the pendant phase to the crystal

Post by Puzzledude on Wed 21 Dec 2016 - 14:25

Hi, i was reading the compendium and i see there are some hex addresses(?) that are like 0xDBE9E , do you need to convert these to hex addresses? if so , how can i?
The address 0xDBE9E seems like a PC/hex address. Otherwise use Snestuff or Lunar address to convert Snes addresses to hex addresses and vice versa. Also, this is a ROM address instead of RAM, which start as 7E or 7F.
avatar
Puzzledude
   
   

Since : 2012-06-20

Back to top Go down

Re: Hex editing for overriding the pendant phase to the crystal

Post by AntROMhacker on Wed 21 Dec 2016 - 22:05

Puzzledude wrote:
Hi, i was reading the compendium and i see there are some hex addresses(?) that are like 0xDBE9E , do you need to convert these to hex addresses? if so , how can i?
The address 0xDBE9E seems like a PC/hex address. Otherwise use Snestuff or Lunar address to convert Snes addresses to hex addresses and vice versa. Also, this is a ROM address instead of RAM, which start as 7E or 7F.
Ok thank's i actually got both of these address programs, how could i convert the address 0xDBE9E to a HEX address on Lunar address?

AntROMhacker
Rank: Snap Dragon
Rank: Snap Dragon

Since : 2016-04-13

Back to top Go down

Re: Hex editing for overriding the pendant phase to the crystal

Post by SunGodPortal on Wed 21 Dec 2016 - 23:25

AntROMhacker wrote:Ok thank's i actually got both of these address programs, how could i convert the address 0xDBE9E to a HEX address on Lunar address?

As far as I know, you only need to convert the address if you are making ASM mods where the location that the code is referring to (pointer) is in "SNES" format (like if you are actually rewriting code rather than just changing a byte here or there). Most of the time when you see documentation around here the address is just a standard PC address and most of the stuff you are editing will be ROM, not RAM (though that depends solely on what you are trying to accomplish). If you are trying to alter one little thing that is more or less a variable or NOPing an operation (preventing something from happening) the address you see is just going to be the address you go to in the hex editor.

I've made lots of changes and have only had to do this conversion once so I actually don't remember how. LOL I think I had to do it when I changed the pointer for the list of damage pits in the Bruce Campbell bug fix. That should tell you how important it is to know this. All I remember is that it was in little endian form. I'd say more than likely, if you are looking at a SNES address it's because you are reading a disassembly, not something like the information in the "Single Codes Section" for example.
avatar
SunGodPortal
                             
                             

Since : 2015-01-26

Back to top Go down

Re: Hex editing for overriding the pendant phase to the crystal

Post by Puzzledude on Thu 22 Dec 2016 - 6:32

Ok thank's i actually got both of these address programs, how could i convert the address 0xDBE9E to a HEX address on Lunar address?
I've made lots of changes and have only had to do this conversion once so I actually don't remember how. LOL
LoL indeed. This is the most trivial thing ever.

You type the address under "PC address" and under "SNES address" the value pops up automatically. Same for vice versa.

However this is necessary if you are dealing with either pointers and thus shifting data or with ASM, where everything is in a SNES rather than PC address.

Ok thank's i actually got both of these address programs, how could i convert the address 0xDBE9E to a HEX address on Lunar address?
Like said before, this already is PC/hex. No need to convert.

avatar
Puzzledude
   
   

Since : 2012-06-20

Back to top Go down

Re: Hex editing for overriding the pendant phase to the crystal

Post by AntROMhacker on Thu 22 Dec 2016 - 9:09

Puzzledude wrote:
Ok thank's i actually got both of these address programs, how could i convert the address 0xDBE9E to a HEX address on Lunar address?
I've made lots of changes and have only had to do this conversion once so I actually don't remember how. LOL
LoL indeed. This is the most trivial thing ever.

You type the address under "PC address" and under "SNES address" the value pops up automatically. Same for vice versa.

However this is necessary if you are dealing with either pointers and thus shifting data or with ASM, where everything is in a SNES rather than PC address.

Ok thank's i actually got both of these address programs, how could i convert the address 0xDBE9E to a HEX address on Lunar address?
Like said before, this already is PC/hex. No need to convert.

Thanks, I'll look into this later.

AntROMhacker
Rank: Snap Dragon
Rank: Snap Dragon

Since : 2016-04-13

Back to top Go down

Re: Hex editing for overriding the pendant phase to the crystal

Post by Puzzledude on Thu 22 Dec 2016 - 9:35

Furthermore:
here's my document on HEX to SNES conversion with formulas, so that you can see how the program is calculating one from another:

Code:
  /\
  /__\==================================================================================
 /\  /\-----VITAL HEX TO SNES ADDRESS CONVERSIONS AND POINTER INFO
/__\/__\================================================================================


WRITTEN BY UNKNOWN AUTHOR AND PUZZLEDUDE

(all hex addresses are for NON headered rom)

**********************************************************************************************
**********************************************************************************************

WRITTEN BY UNKNOWN AUTHOR


This chart is for standard lo-roms only:

 
HEX------------------SNES (Lorom format)  
  
000000-007FFF--------008000-00FFFF
008000-00FFFF--------018000-01FFFF
010000-017FFF--------028000-02FFFF
018000-01FFFF--------038000-03FFFF
020000-027FFF--------048000-04FFFF
028000-02FFFF--------058000-05FFFF
030000-037FFF--------068000-06FFFF
038000-03FFFF--------078000-07FFFF
040000-047FFF--------088000-08FFFF
048000-04FFFF--------098000-09FFFF

050000-057FFF--------0A8000-0AFFFF
058000-05FFFF--------0B8000-0BFFFF
060000-067FFF--------0C8000-0DFFFF
068000-06FFFF--------0D8000-0CFFFF
070000-077FFF--------0E8000-0EFFFF
078000-07FFFF--------0F8000-0FFFFF
080000-087FFF--------108000-10FFFF
088000-08FFFF--------118000-11FFFF
090000-097FFF--------128000-12FFFF
098000-09FFFF--------138000-13FFFF

0A0000-0A7FFF--------148000-14FFFF
0A8000-0AFFFF--------158000-15FFFF
0B0000-0B7FFF--------168000-16FFFF
0B8000-0BFFFF--------178000-17FFFF
0C0000-0C7FFF--------188000-18FFFF
0C8000-0CFFFF--------198000-19FFFF
0D0000-0D7FFF--------1A8000-1AFFFF
0D8000-0DFFFF--------1B8000-1BFFFF
0E0000-0E7FFF--------1C8000-1CFFFF
0E8000-0EFFFF--------1D8000-1DFFFF

0F0000-0F7FFF--------1E8000-1EFFFF
0F8000-0FFFFF--------1F8000-1FFFFF
100000-107FFF--------208000-20FFFF
108000-10FFFF--------218000-21FFFF
110000-117FFF--------228000-22FFFF
118000-11FFFF--------238000-23FFFF
120000-127FFF--------248000-24FFFF
128000-12FFFF--------258000-25FFFF
130000-137FFF--------268000-26FFFF
138000-13FFFF--------278000-27FFFF

140000-147FFF--------288000-28FFFF
148000-14FFFF--------298000-29FFFF
150000-157FFF--------2A8000-2AFFFF
158000-15FFFF--------2B8000-2BFFFF
160000-167FFF--------2C8000-2CFFFF
168000-16FFFF--------2D8000-2DFFFF
170000-177FFF--------2E8000-2EFFFF
178000-17FFFF--------2F8000-2FFFFF
180000-187FFF--------308000-30FFFF
188000-18FFFF--------318000-31FFFF

190000-197FFF--------328000-32FFFF
198000-19FFFF--------338000-33FFFF
1A0000-1A7FFF--------348000-34FFFF
1A8000-1AFFFF--------358000-35FFFF
1B0000-1B7FFF--------368000-36FFFF
1B8000-1BFFFF--------378000-37FFFF
1C0000-1C7FFF--------388000-38FFFF
1C8000-1CFFFF--------398000-39FFFF
1D0000-1D7FFF--------3A8000-3AFFFF
1D8000-1DFFFF--------3B8000-3BFFFF


I'm sure you see the pattern now. So lets say you have a text block located at $080600.
Subtract the header, so it becomes $080400, and then look it up on the chart and find
its new address. so $080400 is actually $108400. Now split it up into pairs -> 10 84 00,
and re-arrange them backwards -> 00 84 10. Now you'll have to search for that, and remember,
it might appear more than once in the rom, so the best thing to do change all of these
addresses that appear in the rom to the new one.

A little hint: These kind of just USUALLY have "BF" before them, so 00 84 10,
might look like BF 00 84 10.


**********************************************************************************************
**********************************************************************************************



ADDED BY PUZZLEDUDE

Its much easier to think of the HEX and SNES addresses, if you consider one to be the
actual one. The "actual" address is a HEX address or hex offset in the rom. This is also
known as the PC address, or the address, the way the humans (that's us, lol) would read a certain
spot in the rom.

Obviouly a human would start at 0. And if the data is at 27502, then this is 27502 in
hex from 0. This is the normal PC address, or the hex address.

But the SNES is a "machine", that reads it in a dumb way. It starts at 008000.
So 0 in hex is 008000 for SNES. And 27502 in hex is then 04F502 in SNES. Even more dumb
is a way this address is read (by SNES CPU) from a file. It is little endian = reversed.  

So what a human would understand as 27502, you have to tell the machine as 02 F5 04.
Because you enter the address in bytes, so you need 3 bytes to tell the machine the address.
It will then read the 3 bytes 02 F5 04 as a SNES address 04F502, which is 27502 in hex,
so it will know to go to 27502.




Seph wrote
Are assembly addresses the same as snes cpu addresses?
--------------
ASM addresses are SNES addresses (luckily they are not reversed, so they are not for CPU,
but for an Assembler like X-kas, who converts the whole code into bytes, for the SNES CPU
to read later). Example by XaserLE (overlays asm) = ORG $3F9180; go to expanded space.
Which is at 1F9180 as hex offset. While this address is RAM = LDA $7EF3C5; load game state.
ASM can do all sorts of stuff, not just addressing.


Seph wrote
Is SNES lorom the same thing as an hex address?
--------------
Not really. Lorom is just formatting. This is the method you would organize your data in a file;
while hex address is a certain spot in this data. So hex address can be a spot in the file of
any format: lorom, hirom, exlorom etc.


What Euclid meant as select Lorom is because most Zelda3 games are Lorom. So at Lunar address
or Snestuff (I use this address calculator), you have multiple options for format. So you
need to select Lorom before calculation.

1DE1C3 ~ 0xEE1C3 unheadered rom
SNES-----HEX

1DE1E5 ~ 0xEE1E5 unheadered rom.
SNES-----HEX

This is calculated with Lunar Address.

But SNES address 1DE1C3 is usually written as C3 E1 1D as 3 bytes in the rom.
(Machine, or rather the SNES CPU will read it this way). It is however written
normally (1DE1C3) in ASM.

But a human does not need any bytes to determine an address and is not dumb enough to
read it backwards. When we see 0xEE1C3, we know it is on EE1C3 in the rom (no bytes needed,
just the brain, lol).  


LIST of addresses:
-HEX or PC or ("human") = 27502
-SNES (not reversed, for ASM) = 04F502
-SNES (reversed for CPU) or ("machine") = 02 F5 04
So 27502, is 04F502 for SNES, is 02 F5 04 as bytes.

-RAM = 7EF3C5 (this is NOT connected to the upper 3)  


It's all about human VS the machine.  


************************************************************

When converting HEX to SNES the last 3 digits are always the same. The 4th digit (from right to left)
is sometimes changed, sometimes not, the same for first 2.


HEX TO SNES (UNDERSTANDING THE CONVERSION)

Example1 (EASY bank)
Hex address    Snes address
028253---------058253

Example2 (COMPLEX bank)
Hex address    Snes address
027253---------04F253



EASY BANK

An easy bank is the 8000 bank in hex that goes from 8000-FFFF.

The last 4 digits remain the same (--8253), while the first two (02----) change as presented
in this table: So 02 will change to 05
If the left increases normally (00, 01, 02), factor is +01, starting at 00
the right increases doubled, starting with 01 = (01, 03, 05), factor is +02, starting at 01.

00---01
01---03
02---05
03---07
04---09
05---0B
06---0D
07---0F
08---11
09---13
0A---15
0B---17
0C---19
0D---1B
0E---1D
0F---1F
ETC

formula: (current address times 2) + 1, so 09 x2 = 18dec = 12 hex + 1 = 13. So 09 --> 13
----------------------------------------------------------------------------


COMPLEX BANK

027253 = example

A complex bank is the 8000 bank in hex that goes from 0000-8000.
The last 3 digits remain the same (---253), while the first two (02----) change as presented
in this table: So 02 will change to 04
If the left increases normally (00, 01, 02), factor is +01, starting at 00
the right increases doubled, starting with 00 = (00, 02, 04), factor is +02, starting at 00.

00---00
01---02
02---04
03---06
04---08
05---0A
06---0C
07---0E
08---10
09---12
0A---14
0B---16
0C---18
0D---1A
0E---1C
0F---1E
ETC

formula: (current address times 2), so 09 x2 = 18dec = 12 hex = 12. So 09 --> 12
-----------------------------

The THIRD digit (--7---) will change as presented in this table: So 7 will change to F
If the left increases normally (0, 1, 2), factor is +1, starting at 0
the right increases normally, starting with 8 = (8, 9, A), factor is +1, starting at 8.

0---8
1---9
2---A
3---B
4---C
5---D
6---E
7---F
formula: (current address plus 8), so 4 +8 = 12dec = C hex = C. So 4 --> C
----------------------------------------------------------------------------------------------


Lets convert a random Hex address into Snes manually, no use of calculator:

106781 (this is just over 1MB).

last bank is 6000 so between 0 and 8000 = complex bank.


-last 3 digits will stay ---781

-first 2 digits are 10
formula: (current address times 2), so 10 hex x2(hex/dec) = 20 hex
-first 2 digits will convert to 20

-third digit is 6
formula: (current address plus 8), 6 +8 = 14dec = E in hex
-third digit will convert to E.

So SNES address is 20E781.

***************************************

Lets convert another random Hex address into Snes manually, no use of calculator:

6A2EB = 06A2EB

last bank is A000 so between 8000 and FFFF = easy bank.

-last 4 digits will stay --A2EB

-first 2 digits are 06
formula: (current address times 2) + 1, so 06 hex x2(hex/dec) +1 = 0D hex
-first 2 digits will convert to 0D

So SNES address is 0DA2EB.

****************************************

For the CPU version of the SNES address brake it up in pairs and reverse them.

So SNES address 20E781 = 20 E7 81 = reversed = 81 E7 20
So SNES address 0DA2EB = 0D A2 EB = reversed = EB A2 0D


CPU SNES addresses are 81 E7 20 and EB A2 0D. This is the way any address is presented
in the ROM file (read only memory that the SNES CPU reads).

But the normal SNES addresses like 20E781, are usually read by Assemblers to produce
the code later on.



**********************************************************************************************
**********************************************************************************************

POINTERS


What is a pointer, you ask? Nothing to complex. These are all of those bytes, that actually
contain an address, usually with the command Load infront.

See this: BF 81 E7 20, this is a pointer. It means load/look up in
SNES address 81 E7 20 = reversed = 20 E7 81 = 20E781.
Converted to hex this is 106781 (calculated with Lunar address directly).

(Knowing this you can actually do ASM with HEX, nice isn't it. But it is just easier to
make a normal Asm file and let Xkas do the conversion thing.)

This process of converting is the opposite of the one presented in the previous chapter.


Sometimes a pointer like that can point to an address with more pointers.
So at 106781 we can have more pointers in a row, making them secondary pointers,
while the one after the BF is a primary one.

Sometimes there are more primary pointers, pointing at the same address or close to it.

All the above are whole or 3 bytes poiters or global pointers = any address can be defined
with them.


Other type are local pointers or 2 byte pointers, since the third bytes will always be the same.

81 E8 20, 62 E9 20, 35 EA 20, gets reduced to 81 E8, 62 E9, 35 EA (third value is 20 for all).

81 E8 is E881 = would be 006881, but with 02 it makes 106881.

Sometimes the global bank is hardcoded and the 2 byte pointer defines an offset from the global
bank. So 81 E8 can mean the offset from 100000 to 106881, or an offset from 40000 to 46881.

Local pointers are used if all the data is in one bank or close together to save space, with the
repeated third byte.

Global pointers are used for larger data blocks.



   /\
  /__\==================================================================================
 /\  /\-----VITAL HEX TO SNES ADDRESS CONVERSIONS AND POINTER INFO
/__\/__\================================================================================



WRITTEN BY UNKNOWN AUTHOR AND PUZZLEDUDE

avatar
Puzzledude
   
   

Since : 2012-06-20

Back to top Go down

Re: Hex editing for overriding the pendant phase to the crystal

Post by Puzzledude on Thu 22 Dec 2016 - 9:45

Furthermore, the conversion from Hex to SNES and vice versa depends on the ROM formatting. Usually this is Lorom, so this should be selected, but as you can see in the Snestuff and Lunar address, there are multiple choices:
Address is thus calculated in a different way for different formattings, which are:
Lorom, Hirom, Exlorom, Exhirom.

The latter I believe were most maligned a while back, but as you can see, they are completely valid formats, with their own addressing conversions. And thus even the pointers are calculated differently, while 3 byte is maximum.

If you look at the 3 byte pointer options, you can see that you can address up to 8MB only and can not exceed this value with a pointer, thus no data can exist over 8MB, since you can not point/jump to it.
avatar
Puzzledude
   
   

Since : 2012-06-20

Back to top Go down

Re: Hex editing for overriding the pendant phase to the crystal

Post by AntROMhacker on Tue 27 Dec 2016 - 9:28

Hello everyone, i hope you all had a great christmas and spent alot of time with your family and friends and got what you wanted, because i know i sure did. Okay, so i was looking through the compendium and i couldnt find how to make link dash in all four directions without having to stop to dash anthor direction, how could i make this happen? checked through most of the compendium already and there was nothing that mentioned it.

AntROMhacker
Rank: Snap Dragon
Rank: Snap Dragon

Since : 2016-04-13

Back to top Go down

Re: Hex editing for overriding the pendant phase to the crystal

Post by Puzzledude on Tue 27 Dec 2016 - 9:35

AntROMhacker wrote:Hello everyone, i hope you all had a great christmas and spent alot of time with your family and friends and got what you wanted, because i know i sure did. Okay, so i was looking through the compendium and i couldnt find how to make link dash in all four directions without having to stop to dash anthor direction, how could i make this happen? checked through most of the compendium already and there was nothing that mentioned it.
http://www.romhacking.net/hacks/2880/
avatar
Puzzledude
   
   

Since : 2012-06-20

Back to top Go down

Re: Hex editing for overriding the pendant phase to the crystal

Post by AntROMhacker on Sun 16 Apr 2017 - 7:26

Wow, it's been a long time since I been on here, I hope everyone's doing alright for the past three months.

AntROMhacker
Rank: Snap Dragon
Rank: Snap Dragon

Since : 2016-04-13

Back to top Go down

Page 4 of 4 Previous  1, 2, 3, 4

View previous topic View next topic Back to top


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