* CDOS 386 keyboard handling
@ 2021-01-06 16:49 LE LIEGARD, Stephane via
0 siblings, 0 replies; only message in thread
From: LE LIEGARD, Stephane via @ 2021-01-06 16:49 UTC (permalink / raw)
To: qemu-devel, seabios; +Cc: JEGU, Francois, GOMEZ, JEAN CHRISTOPHE
[-- Attachment #1.1: Type: text/plain, Size: 3194 bytes --]
Hello,
Host : centos 7
Guest : Concurrent DOS 386 v3.00 (problem also happen on DOS 3.0)
QEMU : v5.1.0
Virtualbox : v6.1.14
Seabios : seabios-rel-1.13.0
I first started to run some tests to debug the alt-gr behavior, and I ended up noticing something strange.
This issue is the same as this one: https://bugs.launchpad.net/qemu/+bug/1574246
So I have an old computer with CDOS installed directly on it (i486-DX2 processeur), and I have to virtualize it with QEMU. Lets call this computer “antique”.
When I run the command ‘n’ in cdos, I select French and I install AZERTY 102 keys 8 bit keyboard.
Then when i press alt-gr + 3, on antique and vbox it display ‘#’, but on QEMU ,it doesn’t, it print the gibberish ^@ sequence.
So VBox handle keyboard input properly, but not qemu.
I investigated to see if the problem was how QEMU interpret the alt-gr, and I thought it was, because the flags set in registers AH and AL when I press alt-gr are the same as when I press Alt (AH=0x2, AL=0x8) according to this site:
http://helppc.netcore2k.net/table/bda : AH – 40:18 AL – 40:17
So I launched qemu and vbox in debug mode, with gdb for qemu and the included debbuger for vbox. By breaking on 0xF000:0xFFF0 and inspecting the IVT, I could see that CDOS replaces the IRQ handler because the address stored at 0x24 (irq 9) change after I resume execution, and when I inspect the machine code at 0xAF:0x618 (address of the IRQ 9 stored in 0x24 after cdos has started), it’s the same on qemu and vbox.
The behavior and scancodes received are the same on QEMU and VBox in the CDOS irq 1 handler. I break on the respective BIOS irq 1 handler, called from the CDOS irq 1 handler, and at this point the byte read on 0x60 differs. Exemple for alt-gr, so 0xE038:
* …
* %000000000000113f e4 60 in AL, 060h // CDOS read 0xE0 from port 0x60
* …
* CDOS call bios handler
* …
* %00000000000fe987 e4 60 in AL, 060h // VBOX bios read 0xE0, QEMU bios read 0x38
* …
I didn’t see any command from CDOS irq 1 handler that would tell the PS2 controller to refeed the last byte read on the port 0x60, and all the BIOS does before the read is to deactivate the keyboard by writing 0xAD to port 0x64, so I think the issue could be from how the ps2 controller is emulated on QEMU. Somehow, VBOX knows that it has to keep the value in it’s output buffer after the first read, or maybe some kind of timer, idk.
I join to this mail the asm of the CDOS irq 1 handler that I extracted from the debugger.
If someone could help me to create a fix, even not official, that we could use on our project.
Thanks a lot.
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
[-- Attachment #1.2: Type: text/html, Size: 11511 bytes --]
[-- Attachment #2: irq1_cdos_handler --]
[-- Type: application/octet-stream, Size: 28782 bytes --]
: IRQ1 handler
%0000000000001108 fa cli
%0000000000001109 fc cld
%000000000000110a 1e push DS
%000000000000110b 2e 8e 1e 06 00 mov ds, [cs:00006h]
%0000000000001110 fe 06 8c 10 inc byte [0108ch]
%0000000000001114 50 push ax
%0000000000001115 f6 06 c5 1e ff test byte [01ec5h], 0ffh // if ([01ec5h] != 0)
%000000000000111a 74 05 je +005h (01121h) // {
%000000000000111c b0 ad mov AL, 0adh // reg al = 0xad; disable keyboard command
%000000000000111e e8 09 04 call 0152ah // :CALL1 wait for ps/2 controller to not be busy, then disable keyboard
%0000000000001121 1e push DS // } Sauvegarde registre DS
%0000000000001122 2b c0 sub ax, ax // ax = 0;
%0000000000001124 8e d8 mov ds, ax // DS = 0;
%0000000000001126 8c c8 mov ax, cs
%0000000000001128 39 06 26 00 cmp word [00026h], ax // Check that CS register match the segment of Keyboard interrupt handler ([0x26])
%000000000000112c 1f pop DS // restaure registre DS
%000000000000112d 75 10 jne +010h (0113fh) // Si le segment du keyboard handler != CS : jump + 0x10;
%000000000000112f f6 06 c5 1e ff test byte [01ec5h], 0ffh // if ([01ec5h] != 0)
%0000000000001134 74 09 je +009h (0113fh) // {
%0000000000001136 e4 64 in AL, 064h // al = inb 0x64; // récupère le status register du kb controller
%0000000000001138 a8 01 test AL, 001h // if !(al & 0x1) // si pas de data dispo sur 0x60
%000000000000113a 75 03 jne +003h (0113fh) //
%000000000000113c e9 ea 00 jmp +000eah (01229h) // jpm +0xea;
%000000000000113f e4 60 in AL, 060h // } lit scancode du port 0x60
// ??? signification des 3 check suivants ???
%0000000000001141 80 3e ac 19 00 cmp byte [019ach], 000h // if ( byte [019ach] == 0 )
%0000000000001146 74 2e je +02eh (01176h) // jump +0x2e;
%0000000000001148 f6 06 ae 19 02 test byte [019aeh], 002h // if ( byte [0x19ae] & 0x2 == 0 )
%000000000000114d 74 27 je +027h (01176h) // jump +0x27;
%000000000000114f f6 06 92 10 01 test byte [01092h], 001h // if ( byte [0x1092] & 0x1 == 0 )
%0000000000001154 74 12 je +012h (01168h) // jump +0x12; JUMP sur 'a'!!!!!! vbox jump sur alt-gr, mais pas QEMU !!!!!!
// gère le ALT
%0000000000001156 3c 38 cmp AL, 038h
%0000000000001158 75 05 jne +005h (0115fh)
%000000000000115a 80 0e 93 10 08 or byte [01093h], 008h // [0x1093] contient les modifiers status: bit 3 (0x8) représente ALT
%000000000000115f 3c b8 cmp AL, 0b8h
%0000000000001161 75 05 jne +005h (01168h)
%0000000000001163 80 26 93 10 f7 and byte [01093h], 0f7h // reset ALT modifier sur 0xB8
// check si 0xE0 (scancode étendu, alt-gr, right ctrl,...)
%0000000000001168 80 26 92 10 fe and byte [01092h], 0feh // unset bit 0 de [0x1092]
%000000000000116d 3c e0 cmp AL, 0e0h // if (scancode étendu)
%000000000000116f 75 05 jne +005h (01176h) //
%0000000000001171 80 0e 92 10 01 or byte [01092h], 001h // set bit 0 de [0x1092] :
%0000000000001176 3c fa cmp AL, 0fah // if AL == ACK
%0000000000001178 75 03 jne +003h (0117dh) // jump +0xac
%000000000000117a e9 ac 00 jmp +000ach (01229h)
%000000000000117d 80 3e 8c 10 01 cmp byte [0108ch], 001h // if not first byte of a sequence:
%0000000000001182 75 35 jne +035h (011b9h) // jump +0x35;
%0000000000001184 51 push cx
%0000000000001185 06 push ES
%0000000000001186 50 push ax
%0000000000001187 56 push si
%0000000000001188 57 push di
%0000000000001189 80 3e de 45 04 cmp byte [045deh], 004h // ??
%000000000000118e 73 14 jnc +014h (011a4h) // Did not jump for 'a' key press
%0000000000001190 1e push DS
%0000000000001191 1e push DS
%0000000000001192 07 pop ES // move DS to Extra Segment
%0000000000001193 b8 40 00 mov ax, 00040h // segment in bios data area for hardware
%0000000000001196 8e d8 mov ds, ax
%0000000000001198 be 17 00 mov si, 00017h // si : pointeur de debut de zone source dans les operations de transfert
%000000000000119b bf 94 10 mov di, 01094h // di : pointeur de destination dans les operations de transfert
%000000000000119e b9 27 00 mov cx, 00027h // cx : nombre d'octet à copier via movsb
%00000000000011a1 f3 a4 rep movsb // copy 27 bytes from DS:SI to ES:DI, so from 40:17 to CC00:1094
// 40:17 a 40:1E contient les data relative au clavier (40:17 status flag 0 et 40:18 flag 1, 40:19 alternate storage for keypad // entry,40:1E buffer,
%00000000000011a3 1f pop DS
%00000000000011a4 b8 40 00 mov ax, 00040h
%00000000000011a7 8e c0 mov es, ax // set ES to 0x40
%00000000000011a9 be 94 10 mov si, 01094h
%00000000000011ac bf 17 00 mov di, 00017h
%00000000000011af b9 27 00 mov cx, 00027h
%00000000000011b2 f3 a4 rep movsb // copy the previous 27 bytes copied from CC00:1094 to 40:17 ??? why copy forth and back
%00000000000011b4 5f pop di
%00000000000011b5 5e pop si
%00000000000011b6 58 pop ax
%00000000000011b7 07 pop ES
%00000000000011b8 59 pop cx
%00000000000011b9 a8 80 test AL, 080h // test if extended scancode ? 0x80 = 0b1000 0000
%00000000000011bb 75 03 jne +003h (011c0h)
%00000000000011bd e9 9a 00 jmp +0009ah (0125ah)
%00000000000011c0 b8 40 00 mov ax, 00040h
%00000000000011c3 8e d8 mov ds, ax
%00000000000011c5 a1 1c 00 mov ax, word [0001ch] // copy from 40:1c (contain offset to keyboard buffer tail) to ax
%00000000000011c8 2e 8e 1e 06 00 mov ds, [cs:00006h] // 0xcc00 to ds
%00000000000011cd a3 8a 10 mov word [0108ah], ax // copy $'offset to keyboard buffer tail' to [0x108a]
%00000000000011d0 58 pop ax
%00000000000011d1 1f pop DS
%00000000000011d2 9c pushfw
%00000000000011d3 2e ff 1e 7a 0e call far [cs:00e7ah] // cs=0xAF -> call 0x196A
%00000000000011d8 fa cli
%00000000000011d9 fc cld
%00000000000011da 1e push DS
%00000000000011db 50 push ax
%00000000000011dc b8 40 00 mov ax, 00040h
%00000000000011df 8e d8 mov ds, ax
%00000000000011e1 a1 1c 00 mov ax, word [0001ch]
%00000000000011e4 2e 8e 1e 06 00 mov ds, [cs:00006h]
%00000000000011e9 3b 06 8a 10 cmp ax, word [0108ah]
%00000000000011ed 75 4a jne +04ah (01239h)
%00000000000011ef 80 3e 8c 10 01 cmp byte [0108ch], 001h
%00000000000011f4 75 2c jne +02ch (01222h)
%00000000000011f6 57 push di
%00000000000011f7 56 push si
%00000000000011f8 51 push cx
%00000000000011f9 06 push ES
%00000000000011fa 1e push DS
%00000000000011fb 1e push DS
%00000000000011fc 07 pop ES
%00000000000011fd b8 40 00 mov ax, 00040h
%0000000000001200 8e d8 mov ds, ax
%0000000000001202 be 17 00 mov si, 00017h
%0000000000001205 bf 94 10 mov di, 01094h
%0000000000001208 b9 27 00 mov cx, 00027h
%0000000000001208 b9 27 00 mov cx, 00027h
%000000000000120b f3 a4 rep movsb
%000000000000120d 1f pop DS
%000000000000120e e8 13 6a call 07c24h // :CALL2
%0000000000001211 b8 40 00 mov ax, 00040h
%0000000000001214 8e c0 mov es, ax
%0000000000001216 bf 17 00 mov di, 00017h
%0000000000001219 b9 27 00 mov cx, 00027h
%000000000000121c f3 a4 rep movsb
%000000000000121e 07 pop ES
%000000000000121f 59 pop cx
%0000000000001220 5e pop si
%0000000000001221 5f pop di
%0000000000001222 fe 0e 8c 10 dec byte [0108ch]
%0000000000001226 58 pop ax
%0000000000001227 1f pop DS
%0000000000001228 cf iret
// Gère AL = 0xFA : the ACK response from keyboard following a command sent
%0000000000001229 2e 8e 1e 06 00 mov ds, [cs:00006h]
%000000000000122e fe 0e 8c 10 dec byte [0108ch]
%0000000000001232 58 pop ax
%0000000000001233 1f pop DS
%0000000000001234 2e ff 2e 7a 0e jmp far [cs:00e7ah] // cs=0xAF -> jmp far [0x196A] -> jmp far f000:e987 : possible adress of BIOS int_09 ?
%0000000000001239 80 3e 8c 10 01 cmp byte [0108ch], 001h
%000000000000123e 75 10 jne +010h (01250h)
%0000000000001240 8c 16 7e 10 mov [0107eh], ss
%0000000000001244 89 26 80 10 mov word [01080h], sp
%0000000000001248 2e 8e 16 06 00 mov ss, [cs:00006h]
%000000000000124d bc 7e 10 mov sp, 0107eh
%0000000000001250 06 push ES
%0000000000001251 53 push bx
%0000000000001252 51 push cx
%0000000000001253 52 push dx
%0000000000001254 55 push bp
%0000000000001255 56 push si
%0000000000001256 57 push di
%0000000000001257 e9 c0 01 jmp +001c0h (0141ah)
%000000000000125a 80 3e 8c 10 01 cmp byte [0108ch], 001h
%000000000000125f 74 17 je +017h (01278h)
%0000000000001261 b0 61 mov AL, 061h
%0000000000001263 e6 20 out 020h, AL
%0000000000001265 f6 06 c5 1e ff test byte [01ec5h], 0ffh
%000000000000126a 74 05 je +005h (01271h)
%000000000000126c b0 ae mov AL, 0aeh
%000000000000126e e8 b9 02 call 0152ah
%0000000000001271 fe 0e 8c 10 dec byte [0108ch]
%0000000000001275 58 pop ax
%0000000000001276 1f pop DS
%0000000000001277 cf iret
%0000000000001278 8c 16 7e 10 mov [0107eh], ss
%000000000000127c 89 26 80 10 mov word [01080h], sp
%0000000000001280 2e 8e 16 06 00 mov ss, [cs:00006h]
%0000000000001285 bc 7e 10 mov sp, 0107eh
%0000000000001288 06 push ES
%0000000000001289 53 push bx
%000000000000128a 51 push cx
%000000000000128b 52 push dx
%000000000000128c 55 push bp
%000000000000128d 56 push si
%000000000000128e 57 push di
%000000000000128f a2 88 10 mov byte [01088h], AL
%0000000000001292 a2 91 10 mov byte [01091h], AL
%0000000000001295 8b d8 mov bx, ax
%0000000000001297 b8 40 00 mov ax, 00040h
%000000000000129a 8e c0 mov es, ax
%000000000000129c 26 8a 26 17 00 mov ah, byte [es:00017h]
%00000000000012a1 8a c3 mov al, bl
%00000000000012a3 f6 c4 04 test ah, 004h
%00000000000012a6 74 23 je +023h (012cbh)
%00000000000012a8 3c 46 cmp AL, 046h
%00000000000012aa 75 47 jne +047h (012f3h)
%00000000000012ac f6 06 c5 1e ff test byte [01ec5h], 0ffh
%00000000000012b1 74 10 je +010h (012c3h)
%00000000000012b3 26 f6 06 96 00 10 test byte [es:00096h], 010h
%00000000000012b9 74 08 je +008h (012c3h)
%00000000000012bb 26 f6 06 96 00 02 test byte [es:00096h], 002h
%00000000000012c1 74 30 je +030h (012f3h)
%00000000000012c3 c6 06 8d 10 ff mov byte [0108dh], 0ffh
%00000000000012c8 e9 ef 01 jmp +001efh (014bah)
%00000000000012cb 3c 37 cmp AL, 037h
%00000000000012cd 75 24 jne +024h (012f3h)
%00000000000012cf f6 06 c5 1e ff test byte [01ec5h], 0ffh
%00000000000012d4 74 12 je +012h (012e8h)
%00000000000012d6 26 f6 06 96 00 10 test byte [es:00096h], 010h
%00000000000012dc 74 0a je +00ah (012e8h)
%00000000000012de 26 f6 06 96 00 02 test byte [es:00096h], 002h
%00000000000012e4 75 07 jne +007h (012edh)
%00000000000012e6 eb 0b jmp +00bh (012f3h)
%00000000000012e8 f6 c4 03 test ah, 003h
%00000000000012eb 74 06 je +006h (012f3h)
%00000000000012ed a2 85 10 mov byte [01085h], AL
%00000000000012f0 e9 c7 01 jmp +001c7h (014bah)
%00000000000012f3 3c 45 cmp AL, 045h
%00000000000012f5 75 16 jne +016h (0130dh)
%00000000000012f7 26 f6 06 96 00 01 test byte [es:00096h], 001h
%00000000000012fd 74 06 je +006h (01305h)
%00000000000012ff 26 80 26 96 00 fe and byte [es:00096h], 0feh
%0000000000001305 f6 c4 04 test ah, 004h
%0000000000001308 74 03 je +003h (0130dh)
%000000000000130a e9 ad 01 jmp +001adh (014bah)
%000000000000130d 50 push ax
%000000000000130e 80 e4 0c and ah, 00ch
%0000000000001311 80 fc 0c cmp ah, 00ch
%0000000000001314 58 pop ax
%0000000000001315 75 24 jne +024h (0133bh)
%0000000000001317 3c 53 cmp AL, 053h
%0000000000001319 75 0d jne +00dh (01328h)
%000000000000131b f6 06 62 0f 01 test byte [00f62h], 001h
%0000000000001320 74 03 je +003h (01325h)
%0000000000001322 e9 9c 01 jmp +0019ch (014c1h)
%0000000000001325 e9 91 fd jmp -0026fh (010b9h)
%0000000000001328 3c 3b cmp AL, 03bh
%000000000000132a 72 0f jc +00fh (0133bh)
%000000000000132c 3c 3f cmp AL, 03fh
%000000000000132e 77 0b jnbe +00bh (0133bh)
%0000000000001330 2c 3b sub AL, 03bh
%0000000000001332 a2 ad 19 mov byte [019adh], AL
%0000000000001335 e8 71 04 call 017a9h
%0000000000001338 e9 86 01 jmp +00186h (014c1h)
%000000000000133b 3c 4b cmp AL, 04bh
%000000000000133d 72 5a jc +05ah (01399h)
%000000000000133f 3c 53 cmp AL, 053h
%0000000000001341 77 56 jnbe +056h (01399h)
%0000000000001343 80 eb 4b sub bl, 04bh
%0000000000001346 2a ff sub bh, bh
%0000000000001348 d1 e3 sal bx, 1
%000000000000134a 2e ff a7 5f 08 jmp word [cs:bx+0085fh]
%000000000000134f 99 cwd
%0000000000001350 09 71 08 or word [bx+di+008h], si
%0000000000001353 a9 08 b2 test ax, 0b208h
%0000000000001356 09 99 09 99 or word [bx+di-066f7h], bx
%000000000000135a 09 99 09 a9 or word [bx+di-056f7h], bx
%000000000000135e 08 b2 09 80 or byte [bp+si-07ff7h], dh
%0000000000001362 fc cld
%0000000000001363 04 75 add AL, 075h
%0000000000001365 33 f6 xor si, si
%0000000000001367 06 push ES
%0000000000001368 b4 30 mov AH, 030h
%000000000000136a ff 74 29 push word [si+029h]
%000000000000136d a1 b0 30 mov ax, word [030b0h]
%0000000000001370 86 e0 xchg al, ah
%0000000000001372 a3 b0 30 mov word [030b0h], ax
%0000000000001375 ba dd 03 mov dx, 003ddh
%0000000000001378 ee out DX, AL
%0000000000001379 8a 16 ac 2c mov dl, byte [02cach]
%000000000000137d e8 e0 23 call 03760h
%0000000000001380 a1 b2 30 mov ax, word [030b2h]
%0000000000001383 86 e0 xchg al, ah
%0000000000001385 a3 b2 30 mov word [030b2h], ax
%0000000000001388 3a 67 42 cmp ah, byte [bx+042h]
%000000000000138b 75 03 jne +003h (01390h)
%000000000000138d 88 47 42 mov byte [bx+042h], al
%0000000000001390 ba d4 03 mov dx, 003d4h
%0000000000001393 e8 9f 1c call 03035h
%0000000000001396 e9 21 01 jmp +00121h (014bah)
%0000000000001399 80 3e ac 19 00 cmp byte [019ach], 000h
%000000000000139e 74 32 je +032h (013d2h)
%00000000000013a0 f6 06 ae 19 02 test byte [019aeh], 002h
%00000000000013a5 74 2b je +02bh (013d2h)
%00000000000013a7 f6 06 8f 10 01 test byte [0108fh], 001h
%00000000000013ac 74 24 je +024h (013d2h)
%00000000000013ae f6 c4 40 test ah, 040h
%00000000000013b1 74 1f je +01fh (013d2h)
%00000000000013b3 3c 3a cmp AL, 03ah
%00000000000013b5 75 03 jne +003h (013bah)
%00000000000013b7 e9 07 01 jmp +00107h (014c1h)
%00000000000013ba 3c 36 cmp AL, 036h
%00000000000013bc 74 04 je +004h (013c2h)
%00000000000013be 3c 2a cmp AL, 02ah
%00000000000013c0 75 10 jne +010h (013d2h)
%00000000000013c2 26 f6 06 96 00 02 test byte [es:00096h], 002h
%00000000000013c8 75 08 jne +008h (013d2h)
%00000000000013ca 26 80 26 17 00 bf and byte [es:00017h], 0bfh
%00000000000013d0 eb 39 jmp +039h (0140bh)
%00000000000013d2 3c 39 cmp AL, 039h
%00000000000013d4 74 24 je +024h (013fah)
%00000000000013d6 3c 56 cmp AL, 056h
%00000000000013d8 74 20 je +020h (013fah)
%00000000000013da 3c 38 cmp AL, 038h
%00000000000013dc 74 2d je +02dh (0140bh)
%00000000000013de 3c 36 cmp AL, 036h
%00000000000013e0 74 29 je +029h (0140bh)
%00000000000013e2 77 40 jnbe +040h (01424h)
%00000000000013e4 3c 2a cmp AL, 02ah
%00000000000013e6 74 23 je +023h (0140bh)
%00000000000013e8 3c 1d cmp AL, 01dh
%00000000000013ea 74 1f je +01fh (0140bh)
%00000000000013ec 3c 35 cmp AL, 035h
%00000000000013ee 75 0a jne +00ah (013fah)
%00000000000013f0 26 f6 06 96 00 02 test byte [es:00096h], 002h
%00000000000013f6 74 02 je +002h (013fah)
%00000000000013f8 eb 1a jmp +01ah (01414h)
%00000000000013fa 80 3e ac 19 00 cmp byte [019ach], 000h
%00000000000013ff 74 13 je +013h (01414h)
%0000000000001401 f6 06 ae 19 02 test byte [019aeh], 002h
%0000000000001406 74 0c je +00ch (01414h)
%0000000000001408 e9 2e 01 jmp +0012eh (01539h)
%000000000000140b 9c pushfw
%000000000000140c 2e ff 1e 7a 0e call far [cs:00e7ah]
%0000000000001411 e9 cb 00 jmp +000cbh (014dfh)
%0000000000001414 9c pushfw
%0000000000001415 2e ff 1e 7a 0e call far [cs:00e7ah]
%000000000000141a 8b 16 86 10 mov dx, word [01086h]
%000000000000141e e8 f2 f7 call 00c13h
%0000000000001421 e9 bb 00 jmp +000bbh (014dfh)
%0000000000001424 3c 53 cmp AL, 053h
%0000000000001426 75 4a jne +04ah (01472h)
%0000000000001428 26 f6 06 96 00 02 test byte [es:00096h], 002h
%000000000000142e 75 e4 jne -01ch (01414h)
%0000000000001430 f6 c4 20 test ah, 020h
%0000000000001433 74 07 je +007h (0143ch)
%0000000000001435 f6 c4 03 test ah, 003h
%0000000000001438 74 07 je +007h (01441h)
%000000000000143a eb d8 jmp -028h (01414h)
%000000000000143c f6 c4 03 test ah, 003h
%000000000000143f 74 d3 je -02dh (01414h)
%0000000000001441 f6 06 ae 19 02 test byte [019aeh], 002h
%0000000000001446 74 cc je -034h (01414h)
%0000000000001448 80 3e ac 19 04 cmp byte [019ach], 004h
%000000000000144d 74 1e je +01eh (0146dh)
%000000000000144f 80 3e ac 19 05 cmp byte [019ach], 005h
%0000000000001454 74 17 je +017h (0146dh)
%0000000000001456 80 3e ac 19 08 cmp byte [019ach], 008h
%000000000000145b 74 10 je +010h (0146dh)
%000000000000145d f6 06 2e 1c ff test byte [01c2eh], 0ffh
%0000000000001462 74 b0 je -050h (01414h)
%0000000000001464 80 3e ac 19 02 cmp byte [019ach], 002h
%0000000000001469 74 02 je +002h (0146dh)
%000000000000146b 75 a7 jne -059h (01414h)
%000000000000146d b0 2c mov AL, 02ch
%000000000000146f e9 e8 02 jmp +002e8h (0175ah)
%0000000000001472 80 3e ac 19 07 cmp byte [019ach], 007h
%0000000000001477 75 9b jne -065h (01414h)
%0000000000001479 f6 06 2e 1c ff test byte [01c2eh], 0ffh
%000000000000147e 75 94 jne -06ch (01414h)
%0000000000001480 3c 37 cmp AL, 037h
%0000000000001482 75 90 jne -070h (01414h)
%0000000000001484 b0 5e mov AL, 05eh
%0000000000001486 e9 d1 02 jmp +002d1h (0175ah)
%0000000000001489 26 f6 06 96 00 02 test byte [es:00096h], 002h
%000000000000148f 75 0e jne +00eh (0149fh)
%0000000000001491 80 e4 0f and ah, 00fh
%0000000000001494 3a 26 82 10 cmp ah, byte [01082h]
%0000000000001498 75 05 jne +005h (0149fh)
%000000000000149a a2 83 10 mov byte [01083h], AL
%000000000000149d eb 1b jmp +01bh (014bah)
%000000000000149f e9 f7 fe jmp -00109h (01399h)
%00000000000014a2 f6 c4 04 test ah, 004h
%00000000000014a5 74 f8 je -008h (0149fh)
%00000000000014a7 3c 53 cmp AL, 053h
%00000000000014a9 74 07 je +007h (014b2h)
%00000000000014ab 80 3e a7 2c 00 cmp byte [02ca7h], 000h
%00000000000014b0 74 ed je -013h (0149fh)
%00000000000014b2 f6 c4 08 test ah, 008h
%00000000000014b5 75 e8 jne -018h (0149fh)
%00000000000014b7 a2 84 10 mov byte [01084h], AL
%00000000000014ba 8b 16 86 10 mov dx, word [01086h]
%00000000000014be e8 52 f7 call 00c13h
%00000000000014c1 e4 61 in AL, 061h
%00000000000014c3 8a e0 mov ah, al
%00000000000014c5 0c 80 or AL, 080h
%00000000000014c7 e6 61 out 061h, AL
%00000000000014c9 8a c4 mov al, ah
%00000000000014cb eb 00 jmp +000h (014cdh)
%00000000000014cd e6 61 out 061h, AL
%00000000000014cf b0 61 mov AL, 061h
%00000000000014d1 e6 20 out 020h, AL
%00000000000014d3 f6 06 c5 1e ff test byte [01ec5h], 0ffh
%00000000000014d8 74 05 je +005h (014dfh)
%00000000000014da b0 ae mov AL, 0aeh
%00000000000014dc e8 4b 00 call 0152ah
%00000000000014df 80 3e 8c 10 01 cmp byte [0108ch], 001h
%00000000000014e4 75 25 jne +025h (0150bh)
%00000000000014e6 fc cld
%00000000000014e7 1e push DS
%00000000000014e8 1e push DS
%00000000000014e9 07 pop ES
%00000000000014ea b8 40 00 mov ax, 00040h
%00000000000014ed 8e d8 mov ds, ax
%00000000000014ef be 17 00 mov si, 00017h
%00000000000014f2 bf 94 10 mov di, 01094h
%00000000000014f3 94 xchg sp, ax
%00000000000014f4 10 b9 27 00 adc byte [bx+di+00027h], bh
%00000000000014f8 f3 a4 rep movsb
%00000000000014fa 1f pop DS
%00000000000014fb e8 26 67 call 07c24h // :CALL2
%00000000000014fe b8 40 00 mov ax, 00040h
%0000000000001501 8e c0 mov es, ax
%0000000000001503 bf 17 00 mov di, 00017h
%0000000000001506 b9 27 00 mov cx, 00027h
%0000000000001509 f3 a4 rep movsb
%000000000000150b 5f pop di
%000000000000150c 5e pop si
%000000000000150d 5d pop bp
%000000000000150e 5a pop dx
%000000000000150f 59 pop cx
%0000000000001510 5b pop bx
%0000000000001511 07 pop ES
%0000000000001512 80 3e 8c 10 01 cmp byte [0108ch], 001h
%0000000000001517 75 08 jne +008h (01521h) ????????????????????????????? error in the debugger ? +08 = 0x1525
%0000000000001518 08 8e 16 7e or byte [bp+07e16h], cl
%000000000000151c 10 8b 26 80 adc byte [bp+di-07fdah], cl
%0000000000001520 10 fe adc dh, bh
%0000000000001522 0e push CS
%0000000000001523 8c 10 mov [bx+si], ss
%0000000000001525 58 pop ax
%0000000000001526 ff 2e 24 00 jmp far [00024h] // contains 0618 00af -> loop on IRQ1 handler at 0x1108
:CALL1 // attend que le PS/2 controller soit inactif puis désactive le clavier
%000000000000152a 50 push ax
%000000000000152b 51 push cx
%000000000000152c 2b c9 sub cx, cx
%000000000000152e e4 64 in AL, 064h
%0000000000001530 a8 02 test AL, 002h // set ZF to 1 if AL & 0x2 == 0; if input buffer empty: ZF = 1
%0000000000001532 e0 fa loopne -006h (0152eh) // loop if ZF != 1; loop if input buffer NOT empty, so if PS/2 controller busy
%0000000000001534 59 pop cx
%0000000000001535 58 pop ax // al = 0xAD = disable keyboard
%0000000000001536 e6 64 out 064h, AL // disable keyboard
%0000000000001538 c3 retn
:FAR
%000000000000196a 87 e9 xchg cx, bp
%000000000000196c 00 f0 add al, dh
%000000000000196e 33 c0 xor ax, ax
%0000000000001970 c3 retn
:CALL2
%0000000000007c24 52 push dx
%0000000000007c25 8a 16 de 45 mov dl, byte [045deh]
%0000000000007c29 80 fa 04 cmp dl, 004h
%0000000000007c2c 73 05 jnc +005h (07c33h)
%0000000000007c2e be 94 10 mov si, 01094h
%0000000000007c31 eb 0b jmp +00bh (07c3eh)
%0000000000007c33 e8 b9 ff call 07befh // :CALL3
%0000000000007c36 8b 44 17 mov ax, word [si+017h]
%0000000000007c39 be df 45 mov si, 045dfh
%0000000000007c3c 89 04 mov word [si], ax
%0000000000007c3e 5a pop dx
%0000000000007c3f c3 retn
:CALL3
%0000000000007bef 32 f6 xor dh, dh
%0000000000007bf1 8b f2 mov si, dx
%0000000000007bf3 d1 e6 sal si, 1
%0000000000007bf5 8b b4 56 24 mov si, word [si+02456h]
%0000000000007bf9 8a 44 0a mov al, byte [si+00ah]
%0000000000007bfc 8a f0 mov dh, al
%0000000000007bfe fe c8 dec al
%0000000000007c00 32 e4 xor ah, ah
%0000000000007c02 8b f0 mov si, ax
%0000000000007c04 d1 e6 sal si, 1
%0000000000007c06 8b b4 33 3d mov si, word [si+03d33h]
%0000000000007c0a c3 retn
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-06 16:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 16:49 CDOS 386 keyboard handling LE LIEGARD, Stephane via
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.