initial commit
This commit is contained in:
32
armv6/tutorial/conditionaljump.s
Normal file
32
armv6/tutorial/conditionaljump.s
Normal file
@@ -0,0 +1,32 @@
|
||||
@ <intstruction> <destination> , <operand>, <operand>
|
||||
|
||||
.global _start
|
||||
|
||||
/*
|
||||
CMP R1. R2
|
||||
if R1 < R2 then N is enabled
|
||||
if R1 > R2 then N is disabled
|
||||
if R1 == R2 then Z is enabled
|
||||
*/
|
||||
|
||||
_start:
|
||||
MOV R1, #20
|
||||
MOV R2, #10
|
||||
CMP R1, R2
|
||||
BEQ values_equal
|
||||
BGT values_greater
|
||||
|
||||
values_less:
|
||||
MOV R0, #2
|
||||
B end
|
||||
|
||||
values_equal:
|
||||
MOV R0, #1
|
||||
B end
|
||||
|
||||
values_greater:
|
||||
MOV R0, #3
|
||||
|
||||
end:
|
||||
MOV R7, #1 @ exit to terminal
|
||||
SWI 0 @ system reads R7 after interrupt
|
||||
Reference in New Issue
Block a user