Created
January 11, 2012 12:53
-
-
Save sanjibnarzary/1594520 to your computer and use it in GitHub Desktop.
Character Input Output in ASM using NASM in UBUNTU Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;Author : Sanjib Narzary | |
;Institute: NIT Calicut | |
;Email: [email protected] | |
;Assembly Code | |
section .data | |
;New line string | |
NEWLINE: db 0xa, 0xd | |
LENGTH: equ $-NEWLINE | |
section .bss | |
INPT: resd 1 | |
section .text | |
global _start | |
_start: | |
;Read character | |
mov eax, 0x3 | |
mov ebx, 0x1 | |
mov ecx, INPT | |
mov edx, 0x1 | |
int 80h | |
;print character | |
mov eax, 0x4 | |
mov ebx, 0x1 | |
mov ecx, INPT | |
mov edx, 0x1 | |
int 80h | |
;Print new line after the output | |
mov eax, 0x4 | |
mov ebx, 0x1 | |
mov ecx, NEWLINE | |
mov edx, LENGTH | |
int 0x80 | |
;Terminate | |
mov eax, 0x1 | |
xor ebx, ebx | |
int 0x80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment