Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


ZSNES: Zelda, Link to the Past (U) - Disassembler question

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Banjo Patterson
Cheater
Reputation: 1

Joined: 15 May 2018
Posts: 36

PostPosted: Wed May 16, 2018 6:03 pm    Post subject: ZSNES: Zelda, Link to the Past (U) - Disassembler question Reply with quote

Hello everyone,

Looking to get some different angles/opinions on some CE disassembled code. The game is LoZ LttP (U) running through the ZSNES emulator. I tracked down the instruction that is called when the player takes damage, and can successfully modify this to prevent damage etc. However, it appears this one instruction is responsible for others as well, such as mana, ammunition, and other game loops (tile drawing perhaps). I'll post that one below.

What I'm curious about, is whether the CE disassembler is able to accurately represent what I assume to be 65816 assembly. Or is it possible that a whole bunch of routines have been lumped into one instruction in the process of disassembly? I guess what I was expecting was to see separate instructions for HP loss, mana loss, etc.

For example:
The instruction at zsnesw.exe+3D4F9 seems to be responsible for updating the player variables when taking damage etc, and when NOP'd will make you invincible. Also, if you move zone, the tile graphics for e.g. floors, carpets and wall torches go all out of whack, until eventually nothing makes sense visually and you are invisible.

The instruction is: mov [ecx+zsnesw.exe+32B468],al

With this instruction, I was hoping to trace where the amount of damage Link takes from an enemy is loaded from. However, seeing as this instruction is in some way tied to other game loops, setting a breakpoint leads it to constantly catch (with ECX changing frequently).

EDIT: What I should also mention, is that following this instruction is a return, with the instruction immediately after the return being:
sub dword ptr [zsnesw.exe+2E404C],37 at address zsnesw.exe+71C1B
Checking the address at zsnesw.exe+2E404C in memory, seems to be memory of the emulator itself, not game memory. I think this because the values change even when the emulation is paused, and just a little further down in memory are strings related to ZSNES itself e.g. STALL DETECTED, "This is info for the last game you ran" etc etc.

I'm just looking for some insight from all of you, who are a lot smarter than I am, on this one. Do you think the game was originally written with all of these functions (hp change, mana change, tile graphics pointers(I think?)) written into one instruction? Or could this simply be the difference between emulated SNES instructions and CE disassembled instructions? Or is it hopeless trying to disassemble SNES via CE?

Thanks everyone, let me know if I've made no sense whatsoever.
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Wed May 16, 2018 6:24 pm    Post subject: Reply with quote

Banjo Patterson wrote:
...is whether the CE disassembler is able to accurately represent what I assume to be 65816 assembly...

It should be X86 emulating 65816 assembly


Programming got it's start with punch cards, but eventually programming was about byte codes.

https://wikipedia.org/wiki/Computer_programming_in_the_punched_card_era

But this is not very human readable:

Code:
89 83 80 04 00 00 8D 55 D4 E8 02 62 01 00 8B 55
D4 ...


But this is a little easier to read:
Code:

mov [ebx+00000480],eax
lea edx,[ebp-2C]
call 00439D10
mov edx,[ebp-2C]


That's all assembly is, it's just a human readable language for an assembler to assemble byte code (machine code).

Banjo Patterson wrote:
...However, it appears this one instruction is responsible for others as well, such as mana, ammunition, and other game loops (tile drawing perhaps)...


Most Consoles work like this to save resources, the emulator just emulates the processor and memory it's built to run on. You'll have to find a way to tell the values apart.

Try the CE tutorial if you haven't, it goes over shared opcode.
https://wiki.cheatengine.org/index.php?title=Tutorials:Cheat_Engine_Tutorial_Guide_x32
https://wiki.cheatengine.org/index.php?title=Tutorials:Cheat_Engine_Tutorial_Guide_x64

_________________
Back to top
View user's profile Send private message Visit poster's website
Banjo Patterson
Cheater
Reputation: 1

Joined: 15 May 2018
Posts: 36

PostPosted: Wed May 16, 2018 6:30 pm    Post subject: Reply with quote

Awesome, thanks for that. I'll brush up on the tutorial there and make sure I understand all of it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites