ra/naloga_08/naloga_08.txt

163 lines
1.5 KiB
Plaintext
Raw Normal View History

2024-01-03 21:52:01 +00:00
@ Vaja 1
.text
.org 0x20
stev1: .space 4
stev2: .word 123
stev3: .word 456
.global _start
_start:
@ stev2 -> r2
adr r0, stev2
ldr r2, [r0]
@ stev3 -> r3
adr r0, stev3
ldr r3, [r0]
@ r2 = r3
mov r2, r3
@ r2 > r3
cmp r2, r3
bhi dalje
mov r1, r3
dalje:
@ r1 -> stev1
adr r0, stev1
str r1, [r0]
@ Vaja 2
.text
.org 0x20
stev1: .space 4
stev2: .word 123
stev3: .word 456
.global _start
_start:
@ stev2 -> r2
adr r0, stev2
ldr r2, [r0]
@ stev3 -> r3
adr r0, stev3
ldr r3, [r0]
@ r2 = r3
mov r2, r3
@ r2 < r3
cmp r2, r3
blo dalje
mov r1, r3
dalje:
@ r1 -> stev1
adr r0, stev1
str r1, [r0]
@ Vaja 3a
.text
.org 0x20
stev1: .space 4
stev2: .word 123
stev3: .word 456
.global _start
_start:
@ stev2 -> r2
adr r0, stev2
ldrs r2, [r0]
@ stev3 -> r3
adr r0, stev3
ldrs r3, [r0]
@ r2 = r3
mov r2, r3
@ r2 > r3
cmp r2, r3
bgt dalje
mov r1, r3
dalje:
@ r1 -> stev1
adr r0, stev1
str r1, [r0]
@ Vaja 3b
.text
.org 0x20
stev1: .space 4
stev2: .word 123
stev3: .word 456
.global _start
_start:
@ stev2 -> r2
adr r0, stev2
ldrs r2, [r0]
@ stev3 -> r3
adr r0, stev3
ldrs r3, [r0]
@ r2 = r3
mov r2, r3
@ r2 > r3
cmp r2, r3
blt dalje
mov r1, r3
dalje:
@ r1 -> stev1
adr r0, stev1
str r1, [r0]
@ Vaja 4
.text
.org 0x20
.global _start
_start:
zanka:
cmp r1, r2
blo l1
beq l2
sub r1, r2
b zanka
l1:
sub r2, r1
b zanka
l2: