• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
March 28, 2024, 04:55:12 pm

News:

Don't be hasty to start your own mod; all our FFT modding projects are greatly understaffed! Find out how you can help in the Recruitment section or our Discord!


Unaligned offset at address xxxx

Started by stardragoon9, October 11, 2018, 11:54:56 am

stardragoon9

October 11, 2018, 11:54:56 am Last Edit: October 11, 2018, 12:24:00 pm by stardragoon9
When i try to use "Equip X Hack" from Razele,i got this error message from FFTorgASM.

What is this error about?Would it mess up the game?Should i ignore it?

Same goes for Pokeytax's "Inherent R/S/M Limitation Hack"
  • Modding version: PSX

xjamxx

October 11, 2018, 12:25:02 pm #1 Last Edit: October 11, 2018, 05:05:04 pm by xjamxx
Ignore. The warning in this case is cuz:
lw r2,0x004a(r4)
nop
or r2,r2,r3
sw r2,0x004a(r4)

'lw' and 'sw' asm instrucctions load and save 32 bits in memory and if you start from 0000 then aligned address should be xxx0 - xxx4 - xxx8 - xxxc. The author of that hack put xxxa to modify two 32 bits aligned slots in memory with a single instruction (16 bit of one slot and 16 bit of another). It may not be the best practice, but it save code space.

UPDATE: didn't know that Glain, i guess i haven't play on my console for more than 18 years. But if Glain says so, then just don't use it if u are going for console.
I never bother to asm the 'event instruction upgrade' hack, but from what i recall it had some offset not aligned, so that hack won't work with consoles too?
  • Modding version: PSX
<Random> This seems to be a PSX issue.
<Elric> A psx issue? That makes no sense. Sounds more like an issue with your OS.

stardragoon9

Quote from: xjamxx on October 11, 2018, 12:25:02 pm
Ignore. The warning in this case is cuz:
lw r2,0x004a(r4)
nop
or r2,r2,r3
sw r2,0x004a(r4)

'lw' and 'sw' asm instrucctions load and save 32 bits in memory and if you start from 0000 then aligned address should be xxx0 - xxx4 - xxx8 - xxxc. The author of that hack put xxxa to modify two 32 bits aligned slots in memory with a single instruction (16 bit of one slot and 16 bit of another). It may not be the best practice, but it save code space.


Thanks,i'll ignore it and use the hack!

BTW I tried really hard to understand the "reason" part but failed :oops: I'm a complete idiot when it comes to assembly language  :(
  • Modding version: PSX

Glain

October 11, 2018, 04:40:11 pm #3 Last Edit: October 12, 2018, 06:27:49 pm by Glain
This will cause the game to crash on console.  Some emulators may allow it.  Use at your own risk.

EDIT - The hardware doesn't allow doing unaligned loads and stores using lw/lh/lhu and sw/sh.  I wouldn't recommend using any hack that does it.  Any emulator that does allow it is not emulating the hardware correctly.
Unaligned loads/stores of 4-byte values can be done with lwl/lwr/swl/swr but you need to use 2 instructions a shot.

EDIT - Event Instruction Upgrade v1.13 doesn't have unaligned loads/stores.
  • Modding version: Other/Unknown

Pride

  • Modding version: PSX
Check out my ASM thread. Who doesn't like hax?

stardragoon9

Quote from: Glain on October 11, 2018, 04:40:11 pm
This will cause the game to crash on console.  Some emulators may allow it.  Use at your own risk.

EDIT - The hardware doesn't allow doing unaligned loads and stores using lw/lh/lhu and sw/sh.  I wouldn't recommend using any hack that does it.  Any emulator that does allow it is not emulating the hardware correctly.
Unaligned loads/stores of 4-byte values can be done with lwl/lwr/swl/swr but you need to use 2 instructions a shot.

EDIT - Event Instruction Upgrade v1.13 doesn't have unaligned loads/stores.


Got it
  • Modding version: PSX