ra/naloga_05/naloga_05.txt
2023-12-03 20:29:29 +01:00

273 lines
2.5 KiB
Plaintext

@ Naloga 1
@ add 32-bit
.text
.org 0x20
stev1: .word 10
stev2: .word 5
rez: .space 4
.global _start
_start:
adr r0, stev1
ldr r1, [r0]
adr r0, stev2
ldr r2, [r0]
add r1, r2
adr r0, rez
str r1, [r0]
@ sub 32-bit
.text
.org 0x20
stev1: .word 10
stev2: .word 5
rez: .space 4
.global _start
_start:
adr r0, stev1
ldr r1, [r0]
adr r0, stev2
ldr r2, [r0]
sub r1, r2
adr r0, rez
str r1, [r0]
@ add 16-bit
.text
.org 0x20
stev1: .hword 10
stev2: .hword 5
rez: .space 2
.align
.global _start
_start:
adr r0, stev1
ldrh r1, [r0]
adr r0, stev2
ldrh r2, [r0]
add r1, r2
adr r0, rez
str r1, [r0]
@ sub 16-bit
.text
.org 0x20
stev1: .hword 10
stev2: .hword 5
rez: .space 2
.align
.global _start
_start:
adr r0, stev1
ldrh r1, [r0]
adr r0, stev2
ldrh r2, [r0]
sub r1, r2
adr r0, rez
str r1, [r0]
@ add 8-bit
.text
.org 0x20
stev1: .byte 10
stev2: .byte 5
rez: .space 1
.align
.global _start
_start:
adr r0, stev1
ldrb r1, [r0]
adr r0, stev2
ldrb r2, [r0]
add r1, r2
adr r0, rez
str r1, [r0]
@ sub 8-bit
.text
.org 0x20
stev1: .byte 10
stev2: .byte 5
rez: .space 1
.align
.global _start
_start:
adr r0, stev1
ldrb r1, [r0]
adr r0, stev2
ldrb r2, [r0]
sub r1, r2
adr r0, rez
str r1, [r0]
@ Naloga 2
.text
.org 0x20
stev1: .word 0x50
stev2: .word 100
stev3: .word 0x2f
.align
.global _start
_start:
adr r0, stev3
ldr r3, [r0]
adr r0, stev2
ldr r2, [r0]
adr r0, stev1
ldr r1, [r0]
add r2, r3
sub r1, r2, r1
str r1, [r0]
@ Naloga 3
.text
.org 0x20
stev1: .word 0x12345678
stev2: .byte 128
.align
stev3: .hword 0xf123
.align
.global _start
_start:
adr r0, stev1
ldr r1, [r0]
adr r0, stev2
ldrb r2, [r0]
ldrsb r3, [r0]
adr r0, stev3
ldrh r4, [r0]
ldrsh r5, [r0]
@ Naloga 4
@ a
.text
.org 0x20
stev1: .byte 15
stev2: .byte 130
.align
.global _start
_start:
adr r0, stev2
ldrb r2, [r0]
adr r0, stev1
ldrb r1, [r0]
add r1, r2
str r1, [r0]
@ b
.text
.org 0x20
stev1: .byte 15
stev2: .byte 130
.align
.global _start
_start:
adr r0, stev2
ldrsb r2, [r0]
adr r0, stev1
ldrsb r1, [r0]
add r1, r2
str r1, [r0]
@ c
.text
.org 0x20
stev1: .word 128
stev2: .byte 128
.align
.global _start
_start:
adr r0, stev2
ldrb r2, [r0]
adr r0, stev1
ldrb r1, [r0]
add r1, r2
str r1, [r0]