0% found this document useful (0 votes)
375 views11 pages

8042 Keyboards's Micro Controller (From IBM Technical Reference Manual)

This document describes initializing the 8042 keyboard controller. It contains the following steps: 1. Send a self-test command and wait for the test to complete. Check the self-test result. 2. Send a test interface command and wait for the test to complete. The result should be 00. 3. Send a keyboard reset command, echo command, and enable keyboard command while waiting for buffers to empty. 4. Clear the output buffer and return, having initialized the keyboard controller.

Uploaded by

Umbe Sullaterra
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
375 views11 pages

8042 Keyboards's Micro Controller (From IBM Technical Reference Manual)

This document describes initializing the 8042 keyboard controller. It contains the following steps: 1. Send a self-test command and wait for the test to complete. Check the self-test result. 2. Send a test interface command and wait for the test to complete. The result should be 00. 3. Send a keyboard reset command, echo command, and enable keyboard command while waiting for buffers to empty. 4. Clear the output buffer and return, having initialized the keyboard controller.

Uploaded by

Umbe Sullaterra
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

8042 Keyboard Controller (From IBM Technical Reference Manual)

Keyboard Commands

Initializing the 8042 Keyboard Controller


STATUS_PORT KBD_OUT_BUF KBD_INPT_BUF KBD_CMD_BUF KBD_DATA_BUF PORT_A PORT_B OUT_BUF_FULL INPT_BUF_FULL SYS_FLAG CMD_DATA KEYBD_INH TRANS_TMOUT RCV_TMOUT PARITY_EVEN INH_KEYBOARD KBD_ENA KBD_DIS EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU 064H 060H 060H 064H 060H 060H 061H 01H 02H 04H 08H 10H 20H 40H 80H 10H 0AEH 0ADH 0F1H 0F4H 0F7H 0FEH 0FFH 0EDH 0AAH 0FAH 0FFH 0FEH 0F0H 010H 020H 040H

; Keyboard Commands KB_MENU EQU KB_ENABLE EQU KB_MAKEBREAK EQU KB_ECHO EQU KB_RESET EQU KB_LED_CMD EQU ; Keyboard responses KB_OK EQU KB_ACK EQU KB_OVERRUN EQU KB_RESEND EQU KB_BREAK EQU KB_FA EQU KB_FE EQU KB_PR_LED EQU

;**************************************************************** ;INITKBD ; This procedure intializes the 8042 ;**************************************************************** INITKBD PROC PUSH PUSH PUSH KBD1: SUB IN TEST LOOPNZ MOV OUT KBD2: SUB IN TEST LOOPZ IN CMP JNE MOV OUT KBD3: SUB IN TEST LOOPZ IN CMP JNE FAR AX DX CX CX, CX AL, STATUS_PORT AL, INPT_BUF_FULL KBD1 AL, 0AAH KBD_CMD_BUF, AL CX, CX AL, STATUS_PORT AL, OUT_BUF_FULL KBD2 AL, KBD_OUT_BUF AL, 055H KBDF AL, 0ABH KBD_CMD_BUF, AL CX, CX AL, STATUS_PORT AL, OUT_BUF_FULL KBD3 AL, KBD_OUT_BUF AL, 000H KBDF ; wait for input buffer empty

;Send self test command ; Wait for test to complete

;Check self test result

;Send test Interface command ; wait for test to complete

;Display Interface test results ;Should be 00 ;Send command byte ;Wait until input buffer ;is not full ;Send command byte

KBD4:

MOV AL, 060H OUT KBD_CMD_BUF, AL SUB CX, CX IN AL, STATUS_PORT TEST AL, INPT_BUF_FULL LOOPNZ KBD4 MOV OUT AL, 01101001B KBD_DATA_BUF, AL CX, CX AL, STATUS_PORT AL, INPT_BUF_FULL KBD5 AL, 0FFH KBD_DATA_BUF,AL DLY1 CX, CX AL, STATUS_PORT AL, OUT_BUF_FULL KBD6 AL, KBD_OUT_BUF AL, 0EEH KBD_DATA_BUF,AL DLY1

KBD5:

SUB IN TEST LOOPNZ MOV OUT CALL

;Wait until input buffer is not full

; Send Keyboard Reset command

KBD6:

SUB IN TEST LOOPZ IN MOV OUT CALL

;Wait until output buffer is full

; Send Echo EE Command

KBD7:

SUB IN TEST LOOPZ IN CALL CMP JNE MOV OUT

CX, CX AL, STATUS_PORT AL, OUT_BUF_FULL KBD7 AL, KBD_OUT_BUF DLY1 AL, 0EEH KBDF AL, 0F4H KBD_DATA_BUF, AL CX, CX AL, STATUS_PORT AL, OUT_BUF_FULL KBD8 AL, KBD_OUT_BUF CX DX AX

;Wait until output buffer is full

; Read Echo from Keyboard

; Enable the Keyboard

KBD8:

SUB IN TEST LOOPZ IN POP POP POP RET

;Wait until output buffer is full

; Clear the output buffer

KBDF:

MOV AL, 0FFH AL2DPLY JMP $ ENDP

INITKBD

;******************************************** C8042 PROC FAR OUT STATUS_PORT, AL C42: SUB IN TEST LOOPNZ RET ENDP CX, CX AL, STATUS_PORT AL, INPT_BUF_FULL C42

C8042

You might also like