Logging game events to text file
#18
So, I've officially completed the Beginner ASM tutorial to a degree where I understood it 100%.  The video was very helpful, thanks for making that.

I've officially got my first working code!  While I do now understand how to do logic in ASM (branching), and will make a code implementing that logic later, I want to first show a code that just grabs and dumps the information.  Here's my source:

Insertion Address 0x8078894C (for NTSC-U, see here for ported codes)

Code:
lwz r31, 0x008C (r3) # Default instruction, loads item to r31

# Find out what item was used, store to 8000164F
lwz r31, 0x008C (r3) # Default instruction, loads item to r31
lis r12, 0x8000 #Set the upper 16 bits of the EVA
stb r31, 0x164F (r12) #Store what item was used to the EVA at address 8000164F

# Load the slot of player that just used an item, store to 8000165F
lwz r3, 0x0 (r27) # Slot loading code start, load mem address from r27 into r3
lwz r3, 0x0 (r3)  # Load new word from a memory address based on the word we just loaded
lbz r3, 0x10 (r3) # Load new byte from a memory address based on the word we just loaded
lis r12, 0x8000 #Set the upper 16 bits of the EVA
stb r3, 0x165F (r12) #Store who used an item to the EVA at address 8000165F

And the compiled code:
Code:
C278894C 00000005
83E3008C 83E3008C
3D808000 9BEC164F
807B0000 80630000
88630010 3D808000
986C165F 00000000

So, if I wanted to, I could just stop here and use Chataigne for the logic.  But, now that I CAN use ASM to do the logic, I might as well Wink  I'll work on that code next.

But, in the meantime, I wanted to stop here and ask a question.  I put memory write breakpoints at 8000164F and 8000165F, and for whatever reason according to Dolphin's log my code seems to be writing extra junk beyond the byte I assumed I was writing with my stb commands.  For example, when P1 uses a Fake Item Box, it logs:

Code:
17:48:916 Core\PowerPC\BreakPoints.cpp:381 N[MI]: MBP 80002354 ( --- ) Write8 80f2bf03 at 8000164f ( --- )
17:48:916 Core\PowerPC\BreakPoints.cpp:381 N[MI]: MBP 80002368 ( --- ) Write8 80e90300 at 8000165f ( --- )

This is the intended behavior if you only look at the last two written digits (03 for Fake Item Box, 00 for P1).  But what's the rest of it all about?  The 80f2bf and 80e903?  In DME's memory viewer, I'm not seeing any of those digits at that address.  It does not affect functionality in any way, I'm just curious.

edit: added insertion address
Reply


Messages In This Thread
Logging game events to text file - by seanmcnally - 03-02-2024, 09:56 PM
RE: Logging game events to text file - by Vega - 03-04-2024, 01:38 AM
RE: Logging game events to text file - by Vega - 03-04-2024, 09:37 PM
RE: Logging game events to text file - by Vega - 03-07-2024, 01:02 AM
RE: Logging game events to text file - by Vega - 03-08-2024, 12:25 AM
RE: Logging game events to text file - by Vega - 03-08-2024, 06:44 PM
RE: Logging game events to text file - by Vega - 03-12-2024, 09:13 PM
RE: Logging game events to text file - by Vega - 03-13-2024, 11:36 PM
RE: Logging game events to text file - by Vega - 03-14-2024, 06:28 PM
RE: Logging game events to text file - by seanmcnally - 03-15-2024, 08:29 PM
RE: Logging game events to text file - by Vega - 03-16-2024, 02:23 AM
RE: Logging game events to text file - by Vega - 03-16-2024, 04:54 PM
RE: Logging game events to text file - by Vega - 03-16-2024, 11:13 PM
RE: Logging game events to text file - by Vega - 03-18-2024, 05:20 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)