flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Non-x86 architectures > [fasmarm] rpi lower16 upper16

Author
Thread Post new topic Reply to topic
shailesh



Joined: 13 Mar 2017
Posts: 2
[fasmarm] rpi lower16 upper16
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: 14469
Location: ?                               Posts: 6699
Assuming you are using 32-bit code then:

Code:
macro movlit reg,value {
  movw reg,(valueand 0xffff
  movt reg,(valueshr 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: 14469
Location: ?                               Posts: 6699
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.