WiiRd forum

Wii & Gamecube Hacking => Wii Game hacking help => Topic started by: Igglyboo on January 19, 2009, 02:01:17 PM

Title: Verifying A Pointer
Post by: Igglyboo on January 19, 2009, 02:01:17 PM
Would anyone know how to verify a pointer in ASM?
It basically has to do DE000000 80008180does, but in ASM.
Title: Re: Verifying A Pointer
Post by: Romaap on January 19, 2009, 04:06:00 PM
I'm not sure but I think you could use something like this:
cmpwi  rA, 8000
blt  branch to end
cmpwi  rA, 8180
bge  branch to end
Title: Re: Verifying A Pointer
Post by: spunit262 on January 20, 2009, 01:18:24 AM
Quote from: Romaap on January 19, 2009, 04:06:00 PM
I'm not sure but I think you could use something like this:
cmpwi  rA, 8000
blt  branch to end
cmpwi  rA, 8180
bge  branch to end
That wouldn't work, you'd need a cmpwis which doesn't exist.
lis rB,0x8000
cmpw rA,rB
blt- end
lis rB,0x8180
cmpw rA,rB
bge- end

Title: Re: Verifying A Pointer
Post by: brkirch on January 20, 2009, 03:35:03 AM
Quote from: spunit262 on January 20, 2009, 01:18:24 AMlis rB,0x8000
cmpw rA,rB
blt- end
lis rB,0x8180
cmpw rA,rB
bge- end

Your code is correct but the first three lines are unnecessary.  The comparison for cmpw is signed, and it is impossible for a 32-bit signed integer to be less than 0x80000000 (-2147483648).
Title: Re: Verifying A Pointer
Post by: spunit262 on January 20, 2009, 04:07:27 AM
Quote from: brkirch on January 20, 2009, 03:35:03 AM
Quote from: spunit262 on January 20, 2009, 01:18:24 AMlis rB,0x8000
cmpw rA,rB
blt- end
lis rB,0x8180
cmpw rA,rB
bge- end

Your code is correct but the first two lines are unnecessary.  The comparison for cmpw is signed, and it is impossible for a 32-bit signed integer to be less than 0x80000000 (-2147483648).
Forgot about that, and it 3 not 2.
And because I'm bored I'll post one that lets 90 pointer though.

lis rB,0x8180
cmpw rA,rB
blt+ 0x1C
lis rB,0x9000
cmpw rA,rB
blt- end
lis rB,0x9380
cmpw rA,rB
bge- end

Title: Re: Verifying A Pointer
Post by: brkirch on January 20, 2009, 06:33:02 AM
Quote from: spunit262 on January 20, 2009, 04:07:27 AM
Forgot about that, and it 3 not 2.
Yeah that's what I meant, I have no idea why I said two.  :confused:

Quote from: spunit262 on January 20, 2009, 04:07:27 AM
And because I'm bored I'll post one that lets 90 pointer though.

lis rB,0x8180
cmpw rA,rB
blt+ 0x1C
lis rB,0x9000
cmpw rA,rB
blt- end
lis rB,0x9380
cmpw rA,rB
bge- end

And since I'm also bored I'll shorten that slightly :P
lis rB,0x8180
cmpw rA,rB
blt+ 0x18
rlwinm rB,rA,16,16,31
cmplwi rB,0x9000
blt- end
cmplwi rB,0x9380
bge- end

Title: Re: Verifying A Pointer
Post by: Romaap on January 20, 2009, 01:13:51 PM
thanks for fixing my mistake (http://i108.photobucket.com/albums/n31/Romaap/cf1a750f.jpg)