flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Keyboard Interrupt Problem

Goto page Previous  1, 2, 3, 4
Author
Thread Post new topic Reply to topic
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 16 Dec 2007, 02:18
And exactly why non of the actual OSes can do anything of this? Even the Internet part, whatever you wanted to say can be done by using custom TCP/IP driver plus perhaps some changes on drivers of the other layers.

The rest you described seems to be achievable by simple processes running at ring-3, it is still OK (perhaps) to talk about this on an OS since the userland is sometimes considered part of the OS (that is the reason for why Linux is considered only a kernel and not an OS at times).

What is clear however, is that you not explained at all how to solve what you called limited C language compatibilities, only provided a wish list of software that you would like to be arranged altogether but that specifies too few details that almost any existing OS can provide what you want.

[edit]BTW, could we make some efforts to keep on topic at least on non Heap forums on future? The thread talks about keyboard handling and now is ending up on non detailed "OS design"[/edit]
Post 16 Dec 2007, 02:18
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
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
Post 16 Dec 2007, 02:33
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
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! Wink


Description: finally, i have my keyboard irq ready to use.
at your own risk ;-)

Download
Filename: keymap.zip
Filesize: 8.42 KB
Downloaded: 521 Time(s)

Post 16 Dec 2007, 07:15
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
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
Post 17 Dec 2007, 08:14
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
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.
Post 17 Dec 2007, 13:29
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
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.
Post 02 Jan 2008, 03:57
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
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
Post 02 Jan 2008, 04:06
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
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?
Post 02 Jan 2008, 04:11
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
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.
Post 02 Jan 2008, 04:34
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
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 !
Post 02 Jan 2008, 08:37
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20416
Location: In your JS exploiting you and your system
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.
Post 02 Jan 2008, 08:47
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
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
Post 29 Jan 2008, 21:47
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4060
Location: vpcmpistri
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
set matches the PC & XT make/break scan code set and is the one
listed here. Scan code sets are selected by writing the value F0
to the keyboard via the 8042 (port 60h). The following is a brief
description of the scan code sets (see the PS/2 Technical Reference
manuals for more information on scan code sets 2 and 3):

/ set 1, each key has a base scan code. Some keys generate
extra scan codes to generate artificial shift states. This
is similar to the standard scan code set used on the PC and XT.
/ set 2, each key sends one make scan code and two break scan
codes bytes (F0 followed by the make code). This scan code
set is available on the IBM AT also.
/ set 3, each key sends one make scan code and two break scan
codes bytes (F0 followed by the make code) and no keys are
altered by Shift/Alt/Ctrl keys.
/ typematic scan codes are the same as the make scan code
Post 30 Jan 2008, 01:27
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4060
Location: vpcmpistri
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.
Post 03 Feb 2008, 06:55
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:  
Goto page Previous  1, 2, 3, 4

< 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.