flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Keyboard lights |
Author |
|
Chewy509 20 Jun 2005, 23:24
The LOST source (which you can now download), contains:
Lost/SRC/DRIVERS/8042.asm The file contains a function call setLEDs (down at the bottom). It reads the current bitmap of the LED status and tells the keyboard what LEDs should read. (The bitmap of the status is maintained by the driver). The code snippet is as: Code: Key_Shift_Stat dw 0 ;Key_Shift_Stat as follows: ; bit 15-9 reserved. ; bit 8 Capslock ; bit 7 Numlock ; bit 6 Scroll-lock ; bit 5 left Alt ; bit 4 right Alt/Alt Gr ; bit 3 left Ctrl ; bit 2 right Ctrl ; bit 1 left shift ; bit 0 right shift .SetLEDs: mov ax, [Key_Shift_Stat] shl ax, 02h and ah, 07h ;led status in %ah mov al, 0edh ; modify leds out 60h, al .S1: in al, 64h test al, 02h jnz .S1 mov al, ah out 60h, al ;set leds jmp .exit Just remember, the state of the LEDs has NO bearing on the state on the control logic used within the keyboard. Therefore it is possible for the actual state and the LEDs to come out of sync, if not handled correctly. |
|||
20 Jun 2005, 23:24 |
|
woody 21 Jun 2005, 00:57
Hi Chewy509.
Looking at mine and your code the only difference seems to be that your takeing the bits from a memory location then setting the LED's and my code just sets them directly. The chances are that I'am missing the point. Having tested the code again the lights come on then go off again. So I did a straight boot into windows and the same action didn't happen again, so it must have been my code. My main information source is 'The undocumented PC' and that has some code which seems to refernce a memory loction and does checks to see if the LED's are being updated. But my code has to run without any BIOS interrupts which his code seems to need (I think ) for adjusting the memory loction that holds the status of the LED's. Woody |
|||
21 Jun 2005, 00:57 |
|
Chewy509 21 Jun 2005, 03:22
Hi Woody,
This is a bit of a guess, but when you enable the keyboard, I believe some models will do a full reset (and thus clearing the LEDs). Enable the keyboard, and then toggle the LEDs? Also I noticed in your code, that you don't clear the high bits? AFIAK these should be 0. (Instead of 0xff, use 0x7). IIRC The Undocumented PC, is referencing the LED status info with the BIOS area (0x40:xx). |
|||
21 Jun 2005, 03:22 |
|
Octavio 21 Jun 2005, 09:52
Some keyboards don´t have leds, better use the screen.
|
|||
21 Jun 2005, 09:52 |
|
woody 21 Jun 2005, 11:13
Hi Chewy509, Octavio
I think to be honest most keyboards do have LED's and the way that I'am working is to make sure it works on my set up then get it to work on other machines (if you know what I saying). When it comes to setting the LED's 1=on and 0=off thats according "The Undocumented PC" on page 372. I thought a full reset would be on the machines post, but I will try it anyway. Thanks for your help. Woody |
|||
21 Jun 2005, 11:13 |
|
Tomasz Grysztar 21 Jun 2005, 11:16
Look also here: http://board.flatassembler.net/topic.php?t=3237
|
|||
21 Jun 2005, 11:16 |
|
woody 21 Jun 2005, 12:33
Thanks for the help Privalov
|
|||
21 Jun 2005, 12:33 |
|
woody 21 Jun 2005, 21:07
Hi all.
Problem sorted out now. Thanks for everybody's help Woody |
|||
21 Jun 2005, 21:07 |
|
Chewy509 21 Jun 2005, 23:19
woody wrote: Hi all. What was the issue, and how did you solve it? |
|||
21 Jun 2005, 23:19 |
|
THEWizardGenius 14 Jul 2005, 23:35
There is a memory location where BIOS stores the current values of the keyboard lights. BIOS does not update these unless it changes them. In real mode, if you change the keyboard lights, you should probably update these. In protected mode, putting a value here does nothing, so you have to update them through the keyboard registers yourself.
|
|||
14 Jul 2005, 23:35 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.