Primary Zelda Hacking
April 21, 2014, 10:04:21 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: The website has switched hosts and now has the domain zeldahacking.net!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: offset of map pointer b2 in LA?  (Read 389 times)
cyanprime
Newcomer
*
Offline Offline

Posts: 9


View Profile
« on: October 27, 2010, 06:59:08 AM »

Hello, I was wondering what the offset for map b2's pointer is on the overworld. I heard that it's in the table at 0x024000

but when I tried getting the offset from the value of f5 4b it didn't work.

according to jigglysaint's document if I understand correctly:

024000 + f5 4b = 02454b or 0254b0

Here is the document I'm talking about:

Quote
Now, to find the actual data for each room(a room is definded by two byte
pairs), first take the second number in the pair.  Since room 17 is the
enterence to the dungeon, find the value 8C 46.  What's the beginning offset
of it's data?  Easy!  It's 2868C.  Notice anything similar between the
byte pair and the offset?  Yes, 8C, the first number in the pair is the last
number in the offset.  Now, the 28 is easy to figure out too.  The 28 means
it's still in the same part of the rom as the room pointers.  Now what about
the 68?  This is tougher to figure out.  Take the pair 8C 46.
now, the second byte can be split up into two single number which I think
are called Nybbles.  The "4" in this number refers back to 28000h.
The "6" means that the start data is from line 600, in offset 28000h.
So the number is 28600h.  You know what goes in the last space, right?
Yes, it's the first number in the pair!  The first number controls
the first 3 numbers of the offset, while the last two are the first number.
Now, you will be seeing some "50's" in some of the pairs.  The first
nybble of the number changes to a 5 when you get down to offset 29000h.
So what do you think 2a000h's number be?  That's right, a "6".

This is the table I got b2's value from:
http://xkeeper.net/hacking/linksawakening/test.php

and this is the map that tells you where b2 is if you don't know.
http://xkeeper.net/hacking/linksawakening/drawermap0.png
Logged
Jigglysaint
Hacking Guru
Full Member
*****
Offline Offline

Posts: 150


View Profile
« Reply #1 on: October 27, 2010, 03:40:06 PM »

Knowing me I bet I made a mistake somewhere.  Also, I wrote that before I knew crap about Z80 ASM so I think I can explain it better now.

Basically, pointers can reference 3 sections of ram.  If the second byte of a pointer is from 00-3F, then it will reference 0000 to 3FFF in ram, which is also 0000-3FFF in the rom file too.  Second, if the second byte is from 40 to 7F, it will reference 4000 to 7FFF in ram.  Finally, anything that uses CX or DX or stuff all access space in the later sections of ram,  FF00 to FFFF is used for direct page access.

Now most data pointes go from 40 to 7F(second byte) because they are stored at 4000 to 7FFF in ram.  All you need to do is reverse the bytes, so if F5 4B is the pointer, than the data is located at 4BF5.  In the rom, you use the start of the bank as the starting address.  So for example, F5 4B at 24000 is 24BF5.  If it were F5 5B, then it would be 25BF5, and if the offset were at 28000, it would be 29BF5.

Now how the game works is that the overworld level data(not the overlay data, but remember that if you are playing in GB mode, you will see this data as is) is broken up into two banks.  Overworld screens from 00 to 7F are stored in at 24000, or bank 09  Screens 80 to FF are located at 68000.  The routine that determines which of the two banks to load is at 3532 in the rom.  It loads the screen number, then checks to see if it's 80 or not.  The it either loads bank 09 or bank 1A.
Logged
cyanprime
Newcomer
*
Offline Offline

Posts: 9


View Profile
« Reply #2 on: October 27, 2010, 04:38:08 PM »

Alright thanks for clearing that up, but why is it that when I change the bytes at 24BF5  and 24BF6 the map b2 doesn't change at all?
Logged
Jigglysaint
Hacking Guru
Full Member
*****
Offline Offline

Posts: 150


View Profile
« Reply #3 on: October 28, 2010, 02:04:10 AM »

The map did change.  You see, in the DX version, there is a seperate section of data that contains a tile overlay.  It's purely graphical, and if you were to add an object, you would still interact with it, but you would not be able to see it unless that tile was changed in the other section.  If you were running it on a regular gb, you would see the changes.  Also, the first two bytes of any room are special.  The first one is, for the overworld, the tile used as the base of the room.  The second byte is the animation index.  For dungeons, the first byte is a bit different.  The first nybble is the room template.  Basically, each room has different preset wall configurations, starting from walls on all sides, to no walls at all.  The second nybble is the first 16 tiles in the tileset, and that is the floor for the room.  The rest is added in as object data.

For objects, there are 3 types.  The first type is a tile ID, and it's x/y position on the map.  It's two bytes long.  3 byte objects have 8x, for horizontal rows, and Cx for vertical columns, prefixed to the data.  x is how many tiles, starting at one(not zero).  Third, there are 5 byte objects that tell the game to add in a warp.  Warp data is part of the actual level data itself.  It starts with Ex, which x being the map type you want to have.  E0 means overworld, E1 means a dungeon or indoors, and E2 means a side scrolling area.  Then comes the dungeon map number, room number, and the x/y co-ordinates(pixel placement).  Overworld data can have several warp data on a screen, provided you place them in the right order.  Dungeon maps can only have one warp per screen.

Also note that objects F0 through FD are not single tile large, but are made up of several tiles.  For example, F5 in the overworld is actually a tree that's 4 tiles large.
Logged
cyanprime
Newcomer
*
Offline Offline

Posts: 9


View Profile
« Reply #4 on: October 28, 2010, 03:34:27 AM »

Ah, I see now. thank you very much. So do you know where the tile data for b2 is? And the tile data bank so I can change tiles in color mode?
Logged
cyanprime
Newcomer
*
Offline Offline

Posts: 9


View Profile
« Reply #5 on: October 28, 2010, 04:20:33 PM »

Okay, according to Lin's notes on RomHacking.net:
Overlay data start: 98000

So now I just need to know what the format is. does it just list each tile? or does it list anything else before or after the tiles in this area?
Logged
Jigglysaint
Hacking Guru
Full Member
*****
Offline Offline

Posts: 150


View Profile
« Reply #6 on: October 28, 2010, 06:11:25 PM »

I think it's just the tiles, and I don't think there are any markers to say when one room is done an another starts.  I think it's just room number +80(tiles).  I never really looked into the overlay data much.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!