SCR/arm/mult-bin-loop.s

29 lines
403 B
ArmAsm
Raw Normal View History

2023-12-10 15:48:26 +01:00
.equ SYS_EXIT,93
.data
int1: .word 0xa2
int2: .word 0xb
.text
.globl _start
_start:
adr x1, int1
ldr w0, [x1]
uxtw x1, w0 // int1 is in x1
adr x2, int2
ldr w3, [x2]
uxtw x2, w3 // int2 is in x2
mov x0, #0 // result is in x0
loop:
cbz x2, exit
tbz x2, #0, next
add x0, x2, #0
next:
lsl x2, x2, #1
lsr x1, x1, #1
b loop
exit: mov x0,#0
mov w8,#SYS_EXIT
svc #0x0
.end