Documente Academic
Documente Profesional
Documente Cultură
Download
http://cs.uwc.ac.za/~ahenney/qemu.zip.
https://sourceforge.net/projects/rpiqemuwindows/files/latest/d
ownload
myAssemblerfile.s
@myAssemblyfile.s
.global main
main:
mov r0, #2
bx lr
Instruction Syntax
<operation>{cond}{flags} Rd,Rn,Operand2
<operation> - A three-letter mnemonic, e.g. MOV or ADD.
{cond} - An optional two-letter condition code, e.g. EQ or
CS.
{flags} - An optional additional flags. e.g. S.
Rd - The destination register.
Rn - The first source register.
Operand2 - A flexible second operand.
Compile, Link, Run and Display
Compile
as -o myAssemblerfile.o myAssemblerfile.s
Link
gcc –o myAssemblerprogram myAssemblerfile.o
Run
./myAssemblerprogram
Display
./myAssemblerprogram ; echo $?
Practical Hints
Question 1 a
mov r2, #4
add r0, r1, r2
Question 1b
gcd:
cmp r0, r1 @ compare r0 and r1
subgt r0, r0, r1@ if r0 > r1, r0 = r0 - r1
sublt r1, r1, r0 @ if r0 < r1, r1 = r1 - r0
bne gcd @ if r0 != r1, repeat
Practical Due Date