assembly - ASM under ARM - Instruction mov -


i'm biginner asm language , know how can set value -1894025488 register r0 ?

if value "10", it's right

mov r0, #10 

hex -> 0a00a0e3

but, if value bigger "1024" "-1894025488", can't convert in hexa

mov r0, #-1894025488 

hex -> can't convert in hexa

can me ?

you need read on arm instructions in arm documentation, should become obvious that.

first off if have computer can convert number hex, shouldnt need to.

there 3 major arm instruction sets, arm, thumb , thumb2 extensions arm (ones have mov). each has different rules immediate values. if think wanting load 0x8f1b76f0 register, 32 bit number not ones or zeros. arm instructions 32 bits , thumb 16 or 16+16 (32). not possible put 32 bits of immediate plus opcode bits in mov , register , have fit in 32 bits, cant squeeze 32+n bits 32, mips have else. arm solution take advantage of barrel shifters have around 8 significant bits , can shift them various locations. example arm instruction can do

mov r0,#0x86000000 

because non-zero bits within group of 8 (10000110....) can shifted around. thumb though dont think works way not sure.

there shortcut

ldr r0,=0x8f1b76f0 

which meant let assembler fill in addresses label names can cheat , put value in there.

but have assembler generate pc relative load

ldr r0,temp ... temp : .word 0x8f1b76f0 

so proper way able load constant, , 3 instruction sets support pc relative word sized load.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -