flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
sleepsleep
if there are a guide on, how to do hello world using fasm (arm) for android, maybe kinda cool,
|
|||
![]() |
|
revolution
To make the code a bit more flexible you can do this:
Code: ;... adr r1,hello ;... |
|||
![]() |
|
typedef
Oh. Lol, after banging my head I thought you'd moved it here.
And yup, mov r1, hello ldr r1, [hello] adr r1, hello |
|||
![]() |
|
revolution
ldr won't do it for you unless you put a pointer there.
|
|||
![]() |
|
revolution
Note that the reason I suggest using adr instead of mov is because by default fasmarm will use all available instructions from all architecture versions. So the mov will use the v7/T2 wide encoding to create "movw r1,0x8074". Whereas using adr will encode "add r1,r15,0x14" which is relocatable.
BTW: It is also advisable to use the processor and coprocessor directives to tell fasmarm which instructions are available. Without these you may get unavailable encodings for your particular CPU. |
|||
![]() |
|
sleepsleep
ok, this is cool, and i wanna say thank you first to typedef.
|
|||
![]() |
|
Picnic
Hi all,
I have tested typedef's example using fasmarm and adb.exe as suggested above (day 1 in arm). Then i try a string copy, but the code outputs nothing. Code: format ELF executable entry start segment readable executable start: mov r1, src mov r0, dest strcopy: ldrb r2, [r1], 1 strb r2, [r0], 1 tst r2, r2 bne strcopy mov r0, 1 mov r1, dest mov r2, 5 mov r7, 4 ; write syscall svc 0 mov r0, 0 ; exit mov r7, 1 svc 0 src db "12345",0 dest db "00000",0 |
|||
![]() |
|
Picnic
I would really appreciate a hint.
|
|||
![]() |
|
revolution
Which system are you using? Perhaps "svc 0", or the parameters you are passing, or the file format, is the problem because the copy code appears to be fine. Also the the note above about using "adr" instead of "mov" to get your code relocatable. And use the "processor" directive to avoid any silliness with incompatible CPUs.
|
|||
![]() |
|
Picnic
Hi revolution,
I have windows xp connected with my android phone (CPU:ARM Cortex A7, GPU:ARM Mali-400 MP1) via usb cable. typedef's code along with few other tiny scripts i wrote are working, but the code above outputs "Segmentation fault" at my phone's terminal window. How to workaround this? |
|||
![]() |
|
revolution
Did you try with ADR? Did you use the proper PROCESSOR setting?
|
|||
![]() |
|
Picnic
I used adr but the error remains. What can be the correct settings in my case, can you show me a processor setting example ?
I noticed that whenever i use strb i am getting a "Segmentation fault". p.s. I appreciate the assistance. |
|||
![]() |
|
revolution
Perhaps the Android system enforces the read only attribute you used?
Code: segment readable executable |
|||
![]() |
|
Picnic
Golden reply, thank you.
![]() I struggled enough and lost my temper for a while. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.