flat assembler
Message board for the users of flat assembler.

Index > Main > How to read the keyboards inputs in a variable???

Author
Thread Post new topic Reply to topic
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu
hello,

what have I to do, if I want to write something with my keyboard and the computer should write it in a variable??? I mean like MSDOS, you give an input, press <enter> and the computer saves the input to work with it.

JOACHIM NEU
Post 23 Dec 2003, 15:24
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
ehm, i mean assembler isnt best language to learn uch things. It is quite complicated without some library
Post 23 Dec 2003, 20:06
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu
Isn't it possible???

Can't you do it with IN al,dx??

But what portnumber is keyboard???

JOACHIM NEU
Post 23 Dec 2003, 21:32
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
vid wrote:
ehm, i mean assembler isnt best language to learn uch things. It is quite complicated without some library


Of course you are not right. In DOS it is very easy to use keyboard input:

Code:
    xor  ah, ah
    int  16h         ; this will wait until key is pressed and will return ASCII code in AL and Scan code in AH
    


You should download some BIOS/DOS interrupt reference, because there are many functions like this.

In Windows the window that have keyboard focus receives messages like WM_CHAR, WM_KEYDOWN and WM_KEYUP and can get the input, but in Windows it is more easy to use controls such as "EDIT" for handling user input.
Post 24 Dec 2003, 15:57
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu
hello,

I'll do it with function 01 from int 21h. I'm going to code an OS like DOS, INTs went also without DOS, don't they???

JOACHIM NEU
Post 24 Dec 2003, 19:48
View user's profile Send private message Visit poster's website Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
Some INTs come with DOS, while others (BIOS interrupts) are avaible without it. And int 0x21 is a DOS interrupt, so you can't use it without this system.
Post 24 Dec 2003, 19:54
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
btw, port number is 60 (i hope, this number is only some flashback from DOS times), but it is little more complicated this way. only lower 7 bits are used for key scan code, uppoer bit is 0 when key is pressed, 1 when released. Before extended (grey) key prefix 0E0h is sent. And some keys (pause, sys request, shifts) are done in more complicated way. However, i think using ports is best way for OS.
Post 24 Dec 2003, 21:18
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld
i've used

Code:
mov  ah,10h
int  16h    


it's better 'cause it's returns extended key-pressed code
Post 25 Dec 2003, 04:34
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu
hello,

if I write:

Code:
mov ah,10h
int 16h
    


there comes an errorwindow. Also with:

Code:
mov dx,60h
in al,dx
    


What should I do now???

JOACHIM NEU
Post 25 Dec 2003, 09:52
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
Well, no-can-do, when you compile as EXE, but it works, when just compiling COM's
Post 25 Dec 2003, 20:48
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv
What error is it?
Post 26 Dec 2003, 03:02
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
mike.dld: are yousure BIOS handles printsreen and SYS request?
Post 26 Dec 2003, 19:44
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu
hello,
may it come from, that I have an AMD Athlon XP and no Pentium??? Because at the computer of my sister with P3 it works...

JOACHIM NEU
Post 28 Dec 2003, 10:43
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.