Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MPassignment1
; Enter your name as input and print it, using macros, procedure, loops. ; Rakesh Tiwari 3239 %macro print 2 mov rax, 1 mov rdi, 1 mov rsi, %1 mov rdx, %2 syscall %endmacro %macro scan 2 mov rax, 0 mov rdi, 0 mov rsi, %1 mov rdx, %2 syscall %endmacro section .data mssg1 db "Enter Your number : " mssg1_len: equ $-mssg1 mssg2 db "Your number is : " mssg2_len: equ $-mssg2 err db "Error" errlen equ $-err newline db 10 count db 5 section .bss num1 resb 17 temp resb 17 hex1 resq 5 section .text global _start _start: mov rsi, hex1 mov rcx, 5 nexts: push rcx push rsi print mssg1, mssg1_len scan num1, 17 print newline, 1 call ascii_hex pop rsi pop rcx mov [rsi], rbx add rsi, 8 loop nexts mov rsi, hex1 mov rcx, 5 nextd: mov rbx, [rsi] push rcx push rsi print mssg2, mssg2_len call display64 print newline, 1 pop rsi pop rcx add rsi, 8 loop nextd mov rax, 60 mov rdi, 0 syscall error: print err, errlen print newline, 1 mov rax, 60 mov rdi, 0 syscall ascii_hex: mov rsi, num1 mov rax, 0 mov rbx, 0 mov rcx, 16 next: rol rbx, 4 mov al, [rsi] cmp al, 29H jbe error cmp al, 47H jge error cmp al, 40H je error cmp al, 39H jbe sub30h sub al, 7H sub30h: sub al, 30H add bl, al inc rsi loop next ret display64: mov rsi, temp mov rcx,16 next1: ROL rbx, 4 mov al, bl AND al, 0FH CMP al, 9h jbe lab ADD al, 7H lab: ADD al, 30H mov [rsi], al inc rsi loop next1 print temp, 16 ret
run
|
edit
|
history
|
help
0
helloworld_fixed
fib.asm
Joker
ddffdfddfdfdf
intfunct_64
fdsfdsfdfs
khvfkhvh
dKleinhen Lab #1
mortgage
lab2_2.asm