gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

ASM > Bit shifting question

#42241 - chishm - Sun May 08, 2005 8:46 am

Hi,
I am trying to hack a GBA ROM but I am not sure if I have this part correct.
Is this (in asm):
Code:
mov r0, r1, lsl #0x04
mov r1, #0xe0
orr r0, r1, r0, lsr #0x1c

equivalent to this (in c):
Code:

r0 = 0xe0 || ( (r1 << 0x04) >> 0x1c );

?

#42242 - DekuTree64 - Sun May 08, 2005 9:04 am

Provided that your || (returns true/false) was meant to just be | (bitwise or), then yes, that's correct.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#42245 - chishm - Sun May 08, 2005 10:42 am

Thankyou for your help. Yes that was meant to be a |. I forgot that || is not a bitwise operator. Every time I learn something new it pushes the old stuff out of my brain.

#42266 - tepples - Sun May 08, 2005 6:31 pm

chishm wrote:
Every time I learn something new it pushes the old stuff out of my brain.

Are you hacking a Pokemon game, whose characters can learn only four skills?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#42269 - Kyoufu Kawa - Sun May 08, 2005 7:23 pm

tepples wrote:
Are you hacking a Pokemon game, whose characters can learn only four skills?
And if you are, can I have some of your data?

Please?

#42304 - chishm - Mon May 09, 2005 9:06 am

Quote:
Are you hacking a Pokemon game, whose characters can learn only four skills?

No, I am trying to work out how to read CF cards using the GBA movie player.
That line was from The Simpsons. I have a habit of sticking semi-random Simpsons quotes into things I say. What it meant was now that I am learning ASM , I am unintentionally forgetting C.