From 5aee58cb4a7849078614ea6f0ec7e3a15a1443d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C5=A1per=20Dobrovoljc?= Date: Tue, 12 Dec 2023 17:19:11 +0100 Subject: [PATCH] naloga_8 --- naloga_08/vaja_01.s | 32 ++++++++++++++++++++++++++++++++ naloga_08/vaja_02.s | 32 ++++++++++++++++++++++++++++++++ naloga_08/vaja_03_a.s | 32 ++++++++++++++++++++++++++++++++ naloga_08/vaja_03_b.s | 32 ++++++++++++++++++++++++++++++++ naloga_08/vaja_04.s | 19 +++++++++++++++++++ 5 files changed, 147 insertions(+) create mode 100644 naloga_08/vaja_01.s create mode 100644 naloga_08/vaja_02.s create mode 100644 naloga_08/vaja_03_a.s create mode 100644 naloga_08/vaja_03_b.s create mode 100644 naloga_08/vaja_04.s diff --git a/naloga_08/vaja_01.s b/naloga_08/vaja_01.s new file mode 100644 index 0000000..952b5ff --- /dev/null +++ b/naloga_08/vaja_01.s @@ -0,0 +1,32 @@ +.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] diff --git a/naloga_08/vaja_02.s b/naloga_08/vaja_02.s new file mode 100644 index 0000000..de68f85 --- /dev/null +++ b/naloga_08/vaja_02.s @@ -0,0 +1,32 @@ +.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] diff --git a/naloga_08/vaja_03_a.s b/naloga_08/vaja_03_a.s new file mode 100644 index 0000000..61a66e8 --- /dev/null +++ b/naloga_08/vaja_03_a.s @@ -0,0 +1,32 @@ +.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] diff --git a/naloga_08/vaja_03_b.s b/naloga_08/vaja_03_b.s new file mode 100644 index 0000000..9315179 --- /dev/null +++ b/naloga_08/vaja_03_b.s @@ -0,0 +1,32 @@ +.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] diff --git a/naloga_08/vaja_04.s b/naloga_08/vaja_04.s new file mode 100644 index 0000000..dcbe0c3 --- /dev/null +++ b/naloga_08/vaja_04.s @@ -0,0 +1,19 @@ +.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: