Skip to contentSkip to conversation

Keyboard Input

DISCUSSION J.S.Souza 3 participants 4 messages May 8, 2002

lore
Share & tools
lore

J.S.Souza

author
#0 lore raw

I'm new to linux assembly although I have taken Assembly Programming in College (unfortunately DOS based). How is it possible to read input from the keyboard until the user hits the 'enter' key? Does using the read() syscall work? Also, how about reading only ONE character from user and returning control back to the program? Although I know C fairly well, I would rather use Assembly _only_ (if this is possible).

J.S.Souza

#1 lore raw

hello,

I wrote it here last week I think but I cant find it so once again.

Quoted 9 lines · J.S.Souza

Date: Wed, 8 May 2002 06:30:00 -0700
From: J.S.Souza <[email protected]>
To: [email protected]
Subject: Keyboard Input

I'm new to linux assembly although I have taken Assembly Programming in College (unfortunately DOS based). How is it possible to read input from the keyboard until the user hits the 'enter' key? Does using the read() syscall work?

yes via read syscall, file desc (handle) will be STDIN

Also, how about reading only ONE character from user and returning

Quoted 2 lines

control back to the program? Although I know C fairly well, I would rather use Assembly _only_ (if this is possible).

It depends on terminal settings, you have to set it via ioctl syscall I think it is ICANON atribute.

see example in asmutils package (sh.asm - tty_init to be more specific)

Regards
Rudolf

To konstantin:

I should put Q&A about this in FAQ and about vm86 too.

author
#3 lore raw
In reply to h-peter recktenwald
Quoted 10 lines · h-peter recktenwald

On Wed, 8 May 2002 06:30:00 -0700

Quoted 7 lines · J.S.Souza

I'm new to linux assembly although I have taken Assembly Programming in College (unfortunately DOS based). How is it possible to read input from the keyboard until the user hits the 'enter' key? Does using the read() syscall work? Also, how about reading only ONE character from user and returning control back to the program? Although I know C fairly well, I would rather use Assembly _only_ (if this is possible).

Quoted 6 lines
Quoted 1 line

J.S.Souza

=> http://home.snafu.de/phpr/initty.gz

regards,
hp

Not the easiest thing to do is it?
Why is it that something so seemingly simple has such a complex solution?

regards,
Jeff

#2 lore raw
In reply to J.S.Souza
Quoted 8 lines · On Wed, 8 May 2002 06:30:00 -0700 "J.S.Souza" <[email protected]> wrote:

I'm new to linux assembly although I have taken Assembly Programming in College (unfortunately DOS based). How is it possible to read input from the keyboard until the user hits the 'enter' key? Does using the read() syscall work? Also, how about reading only ONE character from user and returning control back to the program? Although I know C fairly well, I would rather use Assembly _only_ (if this is possible).

J.S.Souza

=> http://home.snafu.de/phpr/initty.gz

regards,
hp

Signature · 6 lines
Linux,Assembly,Forth: http://home.snafu.de/phpr/index-lx.shtml (en,de)
no abusive software patents http://petition.eurolinux.org/pr/pr17.html
-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html