flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Keyboard Interrupt Problem Goto page Previous 1, 2, 3, 4 |
Author |
|
edfed 16 Dec 2007, 02:33
you know what? if you all find actual oses good, it's your right.
if i code in asm, it's to become independant of any os. no os. just a style in asm, from file system to object programming. that's all. and code at ring3 cannot modify win98 while running, real time windows modification, without restart, in asm, with a system debugger and modify the general algoryhtm for drawing windows... and i want to learn asm i prefer effort of asm coding, than api windows or C based OS dependant applications |
|||
16 Dec 2007, 02:33 |
|
edfed 16 Dec 2007, 07:15
Hi, coding all the 3 nights, i finally obtain a little virtual keyboard.
this keyboard interrupt is not to be limited. This int can be loaded in your dos or else code, for real mode only. simple: Code: org 100h ; org 7c00h jmp @f include 'int9.inc' ;int9.inc have two dependencies, scancode.inc and lookuptable.inc @@: call newint9 mov eax,key.enter call getkey ;the easy getkey function cmp al,10 ;ten key repeat? je please_enter cmp byte[key+key.esc],0 jne exit ... exit: call oldint9 ret this int9 is designed for easy game, OS and user interface enjoy!
|
|||||||||||
16 Dec 2007, 07:15 |
|
edfed 17 Dec 2007, 08:14
updated and no more bugs.
i hope many coder will adopt it this int9 is a good alternative for game programming. it's easy to obtain the status of one or more keys. keyboard internal circuitry limit the combinaison of keys, nobody can fix it. with this int, you can know the time you're pushing the last key. two structures are given: the key.map, including the bios equivalent buffer and flags the scancode equates, only for frensh keyboard, but can be easy adapted to other keyboards. Just Do It |
|||
17 Dec 2007, 08:14 |
|
Dex4u 17 Dec 2007, 13:29
There a built in game keyboard in DexOS that can take multi-keypress at the same time. As normal if someone is holding a key down the other person can not press theres.
|
|||
17 Dec 2007, 13:29 |
|
edfed 02 Jan 2008, 03:57
how many keys can you push at the same time?
mine can see 8 keys maximum ... and some key combinaisons more than 3 keys don't work... due to keyboard int9 errors or keyboard controler limits? i don't know... all in all, a keyboard is only a scaned switch-matrix... 8242 is the dedicated µC. standard. pause key is boring. "extented.shift.numlock ; extented./shift./numlock" "too_much_key_press" code becomes a 80h error code, cleaning the keytable. all error codes are 80h-ed 80h code jump to the cleaner. there are differences between boot and dos run.. insert, numlock, shiftlock, scrollock flags... On dos, it's ok. On boot, it is blinking instead of toogling. |
|||
02 Jan 2008, 03:57 |
|
Dex4u 02 Jan 2008, 04:06
The number of keys (in my games keyboard code) is only limited by the keyboard controller limits.
You have a array of 128 bytes You test for key press or release, Something like this: Code: ; THIS IS HOOKED TO KEYBOARD IRQ mov bx,ax ; ax = scan code and bx,007Fh ; switch high bit of BX to zero and al,80h ; check high bit of port value jz PressRelease: ; high bit = 1: "release" code mov [KeyDown+bx],00h ; write 00 to "down" array element jmp DoneGKPress: mov [ScanCode2],bl ; high bit = 0: "press" code mov [KeyDown+bx],01h ; write 01 to "down" array element;SOME MORE CODE HEREKeyDown rb 128 Then in game you can test whats at ScanCode + KeyDown to see if its a 0x00 or 0x01 Last edited by Dex4u on 02 Jan 2008, 04:25; edited 1 time in total |
|||
02 Jan 2008, 04:06 |
|
edfed 02 Jan 2008, 04:11
how many?
because it's never the same. all keyboard controlers seem to have different limits, laptop, notebook, whitekeyboard, oldAT keyboard, ... they don't work the same with my int 9 is the case for yours? |
|||
02 Jan 2008, 04:11 |
|
Dex4u 02 Jan 2008, 04:34
The game i have tested it on, is a simple two player pong game, so theres only 5 keys and you can not test up and down for the same side.
So i can not say for sure. I may write a game keyboard demo for my OS to test it ,if i get a spare min. |
|||
02 Jan 2008, 04:34 |
|
edfed 02 Jan 2008, 08:37
good idea.
and making a real time key assignment? hum... i don't know if you know Gens+. Gens+ is THE sega MD,SG,GG emulator.writen in C and ASM. in this prgram, key assignment is : hit a key for A B C start etc... i tested it with various key combinaison, and some don't works. so, the conclusion is: hardware keyboard controller is limited.. not like PIANO that can play all notes simultaneouslly. synthesiser commonlly have a polyphony of 32 notes. if key contoller is designed differenttly, then, we canmae a very easy software driver,but they prefer to make bad "cheap" hardware and "good" expensive software. 2008, when i think about, it's only a date...a number. 74150, able to know the state of 1 signal / 16 16 to 1 multiplexer. with 2 74150 and a µP, we can know the state of any key one 16*16 switch-matrix. the µP can be a µC and then no need of 74150. only one chip can control the keyboard. 8*8=256 ; ; ; ; up to 256 keys with 2*8bit ports, we can know the state of 1key /256. scaning algoryhtm is simple... one port is an output port the other is zeroed with pull down resistors, and is an input port if one key is pushed, then the corresponding lines are shunted... by the way, the input port receive a bit B = 1 then, the input port is <> 0, and launch an interrupt with an irq, irq are not only for computer's µP then , scan the all 256 keys. to scan, simply set a bit on the output port and read the input port bits that are 1 are shunted with the line. all this is fast, less than 1ms, btw, can be executed 1000 times/second by the dedicated µC. how much €$£ to build a hand made ps/2 compatible keyboard, with some extra features? like different scancodes and real multikey press mangement... happy new year, good health, enjoy ! |
|||
02 Jan 2008, 08:37 |
|
revolution 02 Jan 2008, 08:47
edfed: Don't forget the diodes to overcome the "corner" problem where 3 keys at the vertices of a square also make a fourth key appear to be pressed.
You can find an old keyboard with the diodes there already and put in your own 8051 replacement MCU with your own code. Very cheap and easy to replace only one chip. |
|||
02 Jan 2008, 08:47 |
|
edfed 29 Jan 2008, 21:47
does anybody have a serious document about keyboard controller modes?
usually, mode 1 is used by all computers, but there are also mode 2 & mode 3. as i don't find an easy to use referece, helppc is good, but obsolete, and prehistoric, i ask this on the board. thanks bitrake. edit: not really needed, but i read somewhere the mode 3 is simpler to control. as mode 1, the default one, have some strange extended keys, in mode 3, each key have it's own make code, and break code is always prefixed by 0F0h. Last edited by edfed on 30 Jan 2008, 01:40; edited 1 time in total |
|||
29 Jan 2008, 21:47 |
|
bitRAKE 30 Jan 2008, 01:27
http://www.phatcode.net/res/236/files/html/keyboard_commands.html
Quote: - The PS/2 models have three make/break scan code sets. The first |
|||
30 Jan 2008, 01:27 |
|
bitRAKE 03 Feb 2008, 06:55
http://www.computer-engineering.org/ps2keyboard/scancodes3.html
Yeah, set 3 is very simple - I have read it was the set for mainframe terminal use. Nice bit of info: http://www.computer-engineering.org/ps2keyboard/ Set 1 clearly has lower overhead with regard to number of interrupts needed for a given sequence of keys! A couple more instructions within the handler is well worth the benefit of reduced characters across the interface. |
|||
03 Feb 2008, 06:55 |
|
Goto page Previous 1, 2, 3, 4 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.