Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
accept and display 16 digit
%macro scall 4 mov rax,%1 mov rdi,%2 mov rsi,%3 mov rdx,%4 syscall %endmacro section .data m1 db "Enter the number =",10d,13d l1 equ $-m1 m2 db "The 2 digit number is =",10d,13d l2 equ $-m2 m3 db "",10d,13d l3 equ $-m3 section .bss num resb 20 array resb 200 char_ans resb 16 section .text global _start _start: ;------------------ACCEPT ARRAY SIZE------------------- scall 1,1,m1,l1 scall 0,0,num,17 call accept_proc mov rbp,array mov [rbp],bx ;----------------DISPLAY ARRAY ELEMENTS----------------------- scall 1,1,m2,l2 mov rax,rbx call display_proc ;-------------------------EXIT------------------------------------ mov rax,60 mov rdi,0 syscall ;------------------------ACCEPT PROCEDURE------------------------------ accept_proc: mov rsi,num mov rbx,0 mov rax,0 mov rcx,16 back: rol rbx,04 mov al,[rsi] cmp al,39h jbe next sub al,07h next: sub al,30h add rbx,rax inc rsi dec rcx jnz back ret ;--------------------------------DISPLAY PROCEDURE--------------------------- display_proc: mov rbp,char_ans mov rcx,16 up3: rol rax,04 mov dl,al and dl,0Fh cmp dl,09h jbe next1 add dl,07h next1: add dl,30h mov [rbp],dl inc rbp dec rcx jnz up3 scall 1,1,char_ans,17 scall 1,1,m3,l3 ret
run
|
edit
|
history
|
help
0
fib
dfsafdsafdsafdsfsd
Fib
dfsafdsfdsfsd
Group lab 1
lec4.asm
Lec4b
qw
Hex
Disition