News: 11 March 2016 - Forum Rules

Author Topic: Shifting where a text appears on-screen (SNES)?  (Read 1937 times)

VicVergil

  • Hero Member
  • *****
  • Posts: 734
    • View Profile
Shifting where a text appears on-screen (SNES)?
« on: May 19, 2015, 03:00:29 am »
I want to make something that could be a decent "first asm hack" for a SNES game.
After all, NOP'ing instructions that decrease player's health isn't really remarkable.
As a side note, I did some NES tilemap mods (for static bg stuff like title screens) in the past.

The game in question is Clock Tower for the SNES.
Using the AG English translation since each letter takes one tile and that's easier for me.
Game hangs in Snes9X 1.51 Gieger's debugger, so I used no$sns.

The dialogue appears normally in the bottom of the screen.
Kind of like with the WonderSwan port did, I'm trying to shifting around these tiles to be an overlay on the top left of the screen overlapping in-game graphics . It's a dirty hack of sorts where I'm not as not concerned about transparency that much, it's just for learning, to become more familiar with SNES tilemapping.

So...
the game displays dialogue in 2 lines - using fixed width 1 tile width 2 tiles high letters.

Seems like, according to some poking around in no$sns's VRAM viewer:
* Font is stored in ROM
* Font is pulled from ROM and sentence gets written to VRAM as 2bpp, 8x16 tiles, to 0x6580 in the VRAM. Some garbage (not empty, not other data, often is remants of earlier sentences) tiles in the very end. They don't appear in-game. Seems just enough for 36 characters. Appear instantly (unlike in-game, where it's letter by letter)
* BG3 as priority tiles according to no$sns are the two lines in the VRAM. Here it appears gradually.

Thing is, I can't figure out what value in no$sns's BG3 viewer is useful to search for in the hex viewer just to see if I'm on the right track and know what to even edit (as in, placing a breakpoint on a BG3 tilemap square for example? so that I can find the instruction and tell it to place it elsewhere).
Neither "Map Address" or "Attribute" are useful (and "Tile Address" is just where the 2bpp tiles are initially dumped)

Any help about how to handle this specific issue?

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7203
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Shifting where a text appears on-screen (SNES)?
« Reply #1 on: May 19, 2015, 09:04:42 pm »
VSNES is a savestate viewer very useful for finding tilemaps. I you are just moving text to a different screen position, you want to edit the tilemap.
However, note that SNES has multiple layers with different priority. If the main game layer is a higher priority than the text layer, then you have another problem.

You can use a ZSNES savestate if you can't open the game in Geiger's SNES9x.
Find what layer the text is on, the use the Scene Viewer in VSNES. In the Info tab, it will tell you where in VRAM the tilemap iis ("tilemap base").
You can look at the layers to find the tiles that the text characters are using. Then look for a match of hex data (better to look for just a match of the lower byte of the tile IDs, as the upper byte contains flags in the upper bits.)
See if you can find a match of the tile data in RAM.

The reason I still use ZSNES for this purpose is because WindHex can strip off the ZSNES headers allowing me to see the actual RAM addresses without having to account for the ZSNES header. (the first $20000 bytes would thus be RAM, the next $10000 VRAM and I think after that is probably ARAM)

Note that SNES PPU address VRAM as word addresses, not byte, so you when you find the VRAM address you will have to search for access to VRAM address divided by 2. (games should be setting the VRAM address to write to by writing to $2116 (as well as $2117 if they use 8-bit addressing), if you want to search for that in a trace log)
"My watch says 30 chickens" Google, 2018