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 > ASM n00b - Please help!

#99344 - DimondEdge - Sun Aug 20, 2006 10:03 pm

I am trying to write an ARM ASM program to write the value 9 to
0x023cdcd8. My code won't work! Can some one please help?
My code:
Code:

.arm
.global main

main:
mov r0, #0x00000009

pop r0

push  0x023cdcd8



Thanks,
DE

#99355 - phonymike - Sun Aug 20, 2006 11:14 pm

my asm skillz are a little rusty, but for the gba you do it like this:

Code:

mov   r0,#0x09
ldr   r1,#0x023cdcd8
strb   r0, [r1]


this will store a byte. do strh for 16bits, or str for 32bits. read up on some doccuments and source code, this is pretty easy stuff.

#99478 - DimondEdge - Tue Aug 22, 2006 12:19 am

I get the error:
'bad expression 'ldr r1, #0x23CDCD8'"
I don't see anything as far as I can tell, and the syntax seems correct...
I'm using arm-eabi-as, mayber I'll try arm-elf-as?

DE

#99480 - sajiimori - Tue Aug 22, 2006 12:28 am

Phonymike probably meant ldr r1,=0x023cdcd8. Using that form also requires that you put .pool somewhere nearby, outside the path of execution.

You should also go look up what push and pop mean.

#99492 - DimondEdge - Tue Aug 22, 2006 1:32 am

sajiimori wrote:
Phonymike probably meant ldr r1,=0x023cdcd8. Using that form also requires that you put .pool somewhere nearby, outside the path of execution.

You should also go look up what push and pop mean.


That works! SWEET! Thanks!

DE