flat assembler
Message board for the users of flat assembler.

Index > DOS > Console input

Author
Thread Post new topic This topic is locked: you cannot edit posts or make replies.
Lord of Destiny



Joined: 25 Nov 2005
Posts: 2
Lord of Destiny
Hi guys. I'm just starting out (being very happy about a program displaying the ASCII charset; it's only 18 bytes!!!).

In the tutorial, I have learned how to use the interrupt 21h to display something in the console. But how to read something from the console? I need exactly one char, that means, when the user types one letter, the program should immediately continue without waiting for the user to press "Enter" or stuff like that.

Do you know how to do that (until "Appendix A" is finished).
Post 25 Nov 2005, 20:58
View user's profile Send private message Reply with quote
daluca



Joined: 05 Nov 2005
Posts: 86
daluca
you can use the bios interrupt 16h to do that
you just make:
Code:
;bla,bla,bla code
mov ah,0   ;function 0 of int 16h
int 16h
;bla,bla,bla continuation of code...

    

this int 16h waits for a key to be presed
after any key(except control keys like alt,ctrl,shift) is
presed this int returns the key code in ah and the char in al
so you can use it to now what key was pressed.
Post 26 Nov 2005, 07:22
View user's profile Send private message Reply with quote
tgo



Joined: 18 Nov 2005
Posts: 3
tgo
Next time you are unsure what function to use or how to load it you can check:

http://www.uv.tietgen.dk/staff/mlha/PC/Prog/ASM/INT/
Post 26 Nov 2005, 17:08
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
Lord of Destiny,
there is also standard input, input string, in dos, or you can make yourself own input functions using bios interrupt, or even via keyboard port $60
calling dos functions - input string

Input and Output String

tgo wrote:
Next time you are unsure what function to use or how to load it you can check:

http://www.uv.tietgen.dk/staff/mlha/PC/Prog/ASM/INT/


nice set of code collections,
additionally i whould note the usage of "Ralph Browns List of Interrupt files"
Post 26 Nov 2005, 18:52
View user's profile Send private message Visit poster's website Reply with quote
peter_rk



Joined: 17 Apr 2005
Posts: 13
Location: somewhere in the world?
peter_rk
You do not want to input whole string, just one character. This is my personal favorite way to to it, if just once:

Code:
        push    AX      ; Store original AX for later
        mov     AH,8    ; Function 8. Input, no echo.
        int     21h     ; call DOS.
        pop     AX      ; Return original. Now keep going...
    


Ralf Brown's Interrupt files are at http://www.ctyme.com/rbrown.htm. You should find the Interrupt> 21 list most helpful. READ or CHARACTER INPUT is likely what you search for.
Post 27 Nov 2005, 08:06
View user's profile Send private message Visit poster's website Reply with quote
Lord of Destiny



Joined: 25 Nov 2005
Posts: 2
Lord of Destiny
Thank you for your support.
Post 27 Nov 2005, 13:05
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic This topic is locked: you cannot edit posts or make replies.

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.