SCR/SCR2.1/ngwalang-number-weight.s
2023-12-10 15:48:26 +01:00

23 lines
314 B
ArmAsm

.equ SYS_EXIT ,93
.data
int: .word -1
.text
.globl _start
_start:
adr x4, int
ldr w3, [x4]
sxtw x2, w3
mov x0, #0
loop: cbz x2, exit
tbz x2, #0, next
add x0, x0, x1
next: lsr x2, x2, #1
mov x1, 1
b loop
exit: mov x0, #0
mov w8,#SYS_EXIT
svc #0x0
.end