flat assembler
Message board for the users of flat assembler.

Index > DOS > I want to flush keys from keyboard buffer

Author
Thread Post new topic Reply to topic
vhanla



Joined: 20 May 2004
Posts: 30
Location: Peru
vhanla
I am programming a game, and all of you know that most games uses
keyboard, so I read from 60h port and the problem I have is when i try to delete the last key in buffer, But i dont like to change interrupts using int9
bcoz I don't like to use int21h... that is to start a game from booting from my floppy

Please help if it's posible to do this...

_________________
I'm just trying to start, help me!!!
Post 12 Jul 2004, 20:32
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4
Hi ,If i get what you mean, you do not want to use int 21h because you want to boot your game from a floppy (eg: dos is not on the floppy)?.
If so here is the code to "set int vector" & "get int vector" with out useing Dos int's.
Code:
;----------------------------------------------------------------------------; set interrupt vector_func25:       ; cmp al, 19h               ; do not allow to change int 19h (for rebooting)       ; je near int21_error        cli        xor ah, ah        shl ax, 2        push si        push bx        push es        mov si, ax        xor bx, bx        mov es, bx        mov word [es:si], dx             ; offset        mov bx, ds        mov word [es:si+2], bx                ; segment        pop es        pop bx        pop si        sti    jmp int21_exit;----------------------------------------------------------------------------; get interrupt vector_func35:        push ds        push si     xor ah, ah        shl ax, 2        mov si, ax        xor bx, bx        mov ds, bx             ; DS = 0        mov bx, word [ds:si+2]  ; segment        push bx        mov bx, word [ds:si]    ; offset        pop es                      ; get segment        pop si        pop ds   jmp int21_exit;--------------------------------------------------------------------------       int21_exit: ret;----------------------------------------------------------------------------    


If you want a good keyboard handler, take a look at my game here: http://www.falconrybells.co.uk/
get the zip file called "pong.zip" you can do multiple key press, with the keyboard handler.

ASHLEY4.
Post 13 Jul 2004, 02:27
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
i think you want to flush bios buffer. There is a functions which reads key from buffer without removing it, and if there is none it doesn't (!) wait. Use that one to find if there is some key in BIOS buffer and while there is any, use normal BIOS read key to remove it.

I don't recall numbers of these services, but you can easily find them in any list.
Post 13 Jul 2004, 19:17
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
i will help you Smile

Code:
clearkey:   ;Clears keystroke buffer directly ( $0040:$001A := $0040:$001C )
push ds
push es
 mov ax,$40
 mov es,ax
 mov ds,ax
 mov di,$1a
 mov si,$1c
 movsw
pop es
pop ds
ret

    


here are some more codes :
http://board.flatassembler.net/topic.php?t=2186

MATRIX
Post 09 Sep 2004, 17:26
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.