i want to write a simple character printing program using NASM plz help !
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i want to write a simple character printing program using NASM plz help !
I am a newbie is asm !
i tried a code to accept a character and print the same !
i can accept it with following code but its not working with printing that character
i use NASM version 2.07
code:
Code:
segment .data
msg1: db 'Enter a key',10
msg1len: equ $-msg1
msg2: db 'the key entred is',10
msg2len: equ $-msg2
segment .text
global _start
_start:
mov eax,4
mov ebx,1
mov ecx,msg1
mov edx,msg1len
int 80h
call getchar
call putchar
mov eax,1
mov ebx,0
int 80h
getchar:
pushad
pushfd
mov eax, 3
mov ebx, 0
mov ecx, esi
mov edx, 2
int 80h
popfd
popad
ret
putchar:
pushad
pushfd
mov eax,4
mov ebx,1
mov ecx,esi
mov edx,2
int 80h
popfd
popad
ret
I'm not familiar with system call parameters under Linux, so can't help you with most of your program, but what are the "mov ecx,esi"'s for? YOu don't do anything with ESI in the rest of the program, as far as I can see - are you hoping it'll have some particular value which the "int 80h" will need?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.