flat assembler
Message board for the users of flat assembler.

flat assembler > Non-x86 architectures > [fasmarm] rpi lower16 upper16

Author
Thread Post new topic Reply to topic
shailesh



Joined: 13 Mar 2017
Posts: 2
Hello,

does fasmarm have any support for extracting the upper16 and lower16 bits to write a macro to load a register with a 32 bit value directly?

Regards,
Shailesh
Post 13 Mar 2017, 09:49
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15977
Location: Qo'noS
Assuming you are using 32-bit code then:
Code:
macro movlit reg,value {
  movw reg,(value) and 0xffff
  movt reg,(value) shr 16
}

movlit r0,0x12345678    
Post 13 Mar 2017, 09:59
View user's profile Send private message Visit poster's website Reply with quote
shailesh



Joined: 13 Mar 2017
Posts: 2
Thanks! Worked like a charm. The and and shr commands are, I am assuming, compiler specific. Can I find info about them in the fasm documentation? It wold be interesting to see what other commands I can use for implementing macros.
Post 13 Mar 2017, 13:10
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15977
Location: Qo'noS
fasmarm uses all the same operators as fasm. You'll need to check the fasm documentation for the basic assembler things and the specific fasmarm documentation for the ARM related stuff.

In essence you'll get:

and
or
xor
not
shl
shr
bsr
*
/
+
-
etc.

See the fasm manual for the precedence rules.
Post 13 Mar 2017, 13:38
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2018, Tomasz Grysztar.

Powered by rwasa.