Compare commits

..

2 Commits

Author SHA1 Message Date
Gašper Dobrovoljc
5aee58cb4a
naloga_8 2023-12-12 17:19:11 +01:00
Gašper Dobrovoljc
f14b5c4907
naloga_06 2023-12-12 17:19:06 +01:00
9 changed files with 241 additions and 0 deletions

48
naloga_06/naloga_06.txt Normal file
View File

@ -0,0 +1,48 @@
1. naloga
.text
.org 0x20
.align
.global _start
_start: @ stanje zastavic register nepred. pred.
movs r0, #0 @ N = 0, Z = 1 0x00000000 0 0
subs r0, r0, #1 @ N=1,Z=0,C=0,V=0 0xffffffff maks -1
adds r0, r0, #2 @ N=0,Z=0,C=1,V=0 0x00000001 1 1
end: b end
2. naloga
.text
.org 0x20
.align
.global _start
_start: @ stanje zastavic register nepred. pred.
movs r0, #1 @ N = 0, Z = 0 0x00000001 1 1
subs r0, r0, #1 @ N=0,Z=1,C=1,V=0 0x00000000 0 0
subs r0, r0, #1 @ N=1,Z=0,C=0,V=0 0xffffffff maks -1
end: b end
3. naloga
.text
.org 0x20
STEV1: .hword -10
STEV2: .byte 0x64
STEV3: .byte -2
.align
.global _start
_start:
adr r0, STEV2
ldrsb r2, [r0]
adr r0, STEV3
ldrsb r3, [r0]
add r2, r2, r3
adr r0, STEV1
ldrsh r1, [r0]
sub r1, r2, r1
strh r1, [r0]
end: b end

11
naloga_06/vaja_01.s Normal file
View File

@ -0,0 +1,11 @@
.text
.org 0x20
.align
.global _start
_start:
movs r0, #0
subs r0, r0, #1
adds r0, r0, #2
end:
b end

11
naloga_06/vaja_02.s Normal file
View File

@ -0,0 +1,11 @@
.text
.org 0x20
.align
.global _start
_start:
movs r0, #1
subs r0, r0, #1
subs r0, r0, #1
end:
b end

24
naloga_06/vaja_03.s Normal file
View File

@ -0,0 +1,24 @@
.text
.org 0x20
STEV1: .hword -10
STEV2: .byte 0x64
STEV3: .byte -2
.align
.global _start
_START:
adr r0, STEV2
ldrsb r2, [r0]
adr r0, STEV3
ldrsb r3, [r0]
add r2, r2, r3
adr r0, STEV1
ldrsh r1, [r0]
sub r1, r2, r1
strh r1, [r0]
END:
b end

32
naloga_08/vaja_01.s Normal file
View File

@ -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]

32
naloga_08/vaja_02.s Normal file
View File

@ -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]

32
naloga_08/vaja_03_a.s Normal file
View File

@ -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]

32
naloga_08/vaja_03_b.s Normal file
View File

@ -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]

19
naloga_08/vaja_04.s Normal file
View File

@ -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: