Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- section .data
- userMsg db 'Please enter a number: '
- lenUserMsg equ $-userMsg
- dispMsg db 'You have entered: '
- lenDispMsg equ $-dispMsg
- section .bss
- num resb 5
- section .text
- global _start
- _start:
- ; User prompt
- mov eax, 4
- mov ebx, 1
- mov ecx, userMsg
- mov edx, lenUserMsg
- int 80h
- ; Read and store the user input
- mov eax, 3 ; system call (sys_read)
- mov ebx, 2
- mov ecx, num
- mov edx, 5
- int 80h
- ; Output the message
- mov eax, 4 ; system call number (sys_write)
- mov ebx, 1
- mov ecx, dispMsg
- mov edx, lenDispMsg
- int 80h
- ; Output the number entered
- mov eax, 4
- mov ebx, 1
- mov ecx, num
- mov edx, 5
- int 0x80
- ; Exit code
- mov eax, 1 ; system call number (sys_exit)
- mov ebx, 0
- int 80h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement