BUT2/SCR/SCR1.2/TP16-ARM/TP19.s~

28 lines
354 B
ArmAsm
Raw Permalink Normal View History

2023-10-23 13:23:36 +02:00
.equ SYS_EXIT,93
.data
int1: .word 0xa2
int2: .word 0xb
.text
.globl _start
_start:
adr x3,int1
ldr w4,[x3]
uxtw x1,w4 // int1 is in x1
adr x3,int2
ldr w5,[x3]
uxtw x2,w5 // int2 is in x2
mov x0,#0 // result is in x0
loop: cbz x2,exit
tbz x2,next
add x0,x0,x1
next:
lsl x1,x1,#1
lsr x2,x2,#1
b loop
exit: mov x0,#0
mov w8,#SYS_EXIT
svc #0x0
.end