11 March 2016 - Forum Rules

Main Menu

Zelda 1 tile mapping

Started by Rules of Nature, January 09, 2022, 05:16:02 AM

Previous topic - Next topic

Rules of Nature

(first post here so excuse me if I get things wrong)
I've been trying to make Gleeok's animation a bit """smoother""" (not exactly since it's still three frames, i just animated parts that are static on the original)
The main problem is how Gleeok's sprite ingame is made; The middle tiles are shared on all three of his animation frames. Since Gleeok's sprites are always loaded alongside other boss sprites
I was thinking about using Gohma's tiles to add the new Gleeok tiles, since I don't plan on using Gohma in my hack.
I would like to know where is the code that assigns Gleeok's tiles to each frame, as I couldn't find anything on the internet
Thank you  :)


I think the info you are looking for is in Bank 1. At 6E04, there is a table that defines the Sprite Index for each sprite (enemies, Link, cave characters), which is the starting offset in the next table, at 6E83, that defines tile mapping codes.

You can download my docs here (, the disassemblies are named "zelda1bank1.txt", and so on.

I haven't documented everything in these tables, but if you use the same logic, you should be able to find the offsets for Gleeok and all its associated sprites, as well as the ones for Gohma.

As for the code itself, it's often tricky to get the correct offsets, because parts of the code are copied to Cartridge RAM (6000-7FFF) before being executed. The code that fetches data for sprites follows the tables I refer to above. For enemies, it's around 70BE.

Rules of Nature

I'm still a complete noob when it comes to romhacking so I don't really understand how I should find those offsets
What I'm looking for specifically is the thing that maps those C0, C1, C2, etc. here to each of Gleeok's animation frames


Most of the game enemies are made of a block of 4x4 tiles, and the larger of them, like Gleeok, have multiple 4x4 blocks assembled. When a sprite has the code N, the game interprets it as N, N+1, N+2, N+3. So, C0 means C0-C1-C2-C4, in reversed N pattern.

As for the code for each enemy's behavior and display, I don't know exactly. It seems a lot of code is spaghetti code. Most of the code for enemies is in Bank 4. When a sprite is ready to be drawn, the specific code will fetch data from the tables I mentionned earlier and set sprite attributes according to what frame the enemy wants to display.

Rules of Nature

4x4? Aren't tiles 8x8? And if I'm correct, looking at Zelda 1 sprites it seems the tiles are 8x16


Quote from: Rules of Nature on January 10, 2022, 04:05:22 AM
4x4? Aren't tiles 8x8? And if I'm correct, looking at Zelda 1 sprites it seems the tiles are 8x16

Tiles are made of 8x8 pixels, yes, but what Trax meant was an arrangement of 4x4 tiles, meaning 4 tiles width and 4 tiles height.

Rules of Nature

I tested changing up bits that I thought might be Gleeok's tiles near the end of the tile mapping code for enemies, but it didn't work
I know changing stuff up is possible from frame to frame, since Zelda Outlands did it but I don't know how...


I've been working on some boss drawing stuff as well. Here's what I have in my notes:

12809: Gleeok Body Tiles 0
1280F: Gleeok Body Tiles 1
12815: Gleeok Body Tiles 2
1281B: Gleeok Body Base Tile Offsets

These are unheadered addresses so they'll be accurate in Mesen's memory viewer. Add $10 if looking at the rom in a hex editor etc.

Rules of Nature

It works! Thank you so much
But now I'm looking for something else...
How do I make it so Link always uses the small shield sprites even when you have the big shield? I sometimes make new sprites for Link and I would like to make them without the constraints of the big shield (especially the front facing big shield sprite which is shared with both rotations)


Maybe I'm missing something but can't you just copy and paste little shield link over the graphics that contain the big shield? I think there are only two half-sprites to overwrite. Use YY-CHR, press Ctrl-J (or click the addr button in red text) and enter 808f. Modify as needed. Zoom: x16 will help you copy only the few tiles you need.

Rules of Nature

I can't for the big shield at least on the front facing sprite, since the front "half" containing the big shield is one 8x16 sprite that is shared to both walk frames.  The big shield sprite on the front rotation obstructs the foot which is why it's shared with both frames, if I were to overwrite it with the small shield half it would fuck up the front walk animation.
Edit: I found how to make it work! I'll post what I found when I track down the tile mapping for the side rotations too, so we have a bit more free space from the unused big shields


I see what you mean now. The magic shield only has one frame and doesn't have the same bounce that the small shield does. You can NOP two bytes to remove the big shield drawing routine completely without changing the behavior of blocking more projectiles. But then there's no way to tell if link actually has the magical shield or not. Not sure if that's what you're looking for but maybe it will put you in the right direction.

This removes the branch to the shield drawing routine which is at $F340 in RAM:

-01f330  a0 00 20 d0 ff ad 76 06 d0 16 a5 98 c9 04 d0 3a
+01f330  a0 00 20 d0 ff ad 76 06 ea ea a5 98 c9 04 d0 3a

I would recommend downloading this Mesen debug file if you haven't already. The relevant code is well commented if you're looking to implement a more sophisticated hack.

Rules of Nature

the way I did it was way simpler
There's just big shield sprite mapping at 165E3 so I changed them to small shield offsets

January 29, 2022, 11:38:27 AM - (Auto Merged - Double Posts are not allowed before 7 days.)

I've been making a Link reskin that reassigns his palette to the red general palette, leaving his normal palette for other things since editing it to be the same as the general red palette would be redundant
I reattributed palette to all animation frames but I can't find the offset that attributes the palette to the hold animation
The palette it should have:
The palette it has during the hold animation:

Where is the thing that attributes its palette to the hold? It doesn't seem grouped with the others

Rules of Nature

excuse me for bumping this old thread. I've been working on and off on a hack for a while, but while i made progress on other things, i still haven't resolved that pickup palette assignment issue from my last post. can anyone answer to my question? thanks in advance  :)


Unfortunately it doesn't look like you can change that palette without affecting other things. It's not as easy as changing a single byte anyway. A bit of code seems to do the trick though, here's a patch (not thoroughly tested).

Rules of Nature

It works! Out of curiosity, what are the addresses affected by this patch? in case i need to do some more code trickery like that


Quote from: Rules of Nature on April 17, 2022, 07:00:22 AM
It works! Out of curiosity, what are the addresses affected by this patch? in case i need to do some more code trickery like that

You can use ips peek to see the changes
✍️ Blog:

💀 Join my crypt on discord: