flat assembler
Message board for the users of flat assembler.
Index
> DOS > keyboard handling |
Author |
|
Matrix 02 Mar 2005, 01:38
hello,
i have made functions that use keyboard directly, your code is not clear for me i have attached a keyboard information doc too, from ports.list Code: org $100 ;cli mainloop: call clearkey call readkeyboard push ax mov bl,1 mov bh,1 mov ch,15 mov dx,ax call writehexnibbles80x25z pop ax cmp al,1 jne mainloop ;sti int 20h readkeyboardrealtime: .wait: in al,$64 bt ax,0 jnc .wait in al,$60 ret readkeyboard: in al,$60 ret waitkeyboardchange: ; does not wait busy, (windows and other) uses al,bl in al,$60; because buffer ready bit is cleared after reading mov bl,al .wait2: in al,$60 cmp al,bl jz .wait2 ret 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 writehexnibbles80x25z: ; EDX = 32 bit input bl=x bh=y ch=color ( writes 8 nibbles from input ) push es ; does not remove leading zeroes mov ax,$b800 mov es,ax xor ax,ax xchg al,bh mov di,ax shl di,2 add di,ax shl di,4 add di,bx shl di,1 mov cl,8 .roll1: rol edx,4 mov al,dl and al,$f cmp al,10 sbb al,69h das mov ah,ch stosw dec cl ;or cl,cl jnz .roll1 pop es ret if you don't need that performance, just use bios function readkey, or keycheck, i have posted some bios routines to this board, made with help by interrupt list basic read keyboard is Code: readkeyboard: in al,$60 ret this is all rigth if you don't care about busy (in most cases you should) i don't know why i couldn't find so accurate descriptions anywhere, i had to play lego from my info files to make these work all right
|
|||||||||||
02 Mar 2005, 01:38 |
|
vid 02 Mar 2005, 09:04
keyboard handling was well described in PCGPE (PC games programming encyclopedia) if i recall right. There are some special issues with shifts and pause/sysrq/scrolllock keys (they send more than one scan) also extended keys (gray ones) send some prefix before real scan code, which is E0 or E2 or something. Just look for some good description
|
|||
02 Mar 2005, 09:04 |
|
Cas 05 Apr 2005, 04:33
If you're willing to make a keyboard routine, maybe my old "Support" project will be useful to you. It is a timer+keyboard handler TSR, with source and all. Take a look.
_________________ «Earth is my country; science is my religion» - Christian Huygens |
|||||||||||
05 Apr 2005, 04:33 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.