%macro scall 4 mov rax, %1 mov rdi, %2 mov rsi, %3 mov rdx,%4 syscall %endmacro section .data arr times 5 db 0 msg2 db "sum =" msg2len equ $-msg2 count db 5 temp1 db 0 newline db " ",0ah section .bss sum resb 2 num resb 3 temp resb 2 section .text global _start _start: mov rbp, arr NEXTNUM: scall 0,0,num,3 mov rcx,0 mov rax,0 mov rsi, num UP: mov cl, byte[rsi] cmp cl, 0ah je PACKED cmp cl,39h jbe DOWN sub cl,07h DOWN: sub cl,30h rol al,4 add al, cl inc rsi jmp UP PACKED: mov byte[rbp],al inc rbp dec byte[count] jnz NEXTNUM mov rsi, arr mov ax ,00h mov bx, 00h mov cx, 5 UP2: mov bl,byte[rsi] add ax,bx jnc SKIP inc ah SKIP: inc rsi dec cx jnz UP2 mov word[sum],ax scall 1,1, msg2,msg2len call disp scall 1,1,newline,1 EXIT: scall 60,0,0,0 disp: mov bp, 4 mov ax, word[sum] UP3:rol ax, 4 mov [temp],ax and ax,0fh cmp al,09 jbe DOWN1 add al,07 DOWN1: add al, 30h mov [temp1],al scall 1,1,temp1,1 mov ax,word[temp] dec bp jnz UP3 ret
To embed this project on your website, copy the following code and paste it into your website's HTML: