www.pudn.com > hpbios.rar > AMOUSE.ASM
; []===========================================================[]
;
; NOTICE: THIS PROGRAM BELONGS TO AWARD SOFTWARE INTERNATIONAL(R)
; INC. IT IS CONSIDERED A TRADE SECRET AND IS NOT TO BE
; DIVULGED OR USED BY PARTIES WHO HAVE NOT RECEIVED
; WRITTEN AUTHORIZATION FROM THE OWNER.
;
; []===========================================================[]
;
;----------------------------------------------------------------------------
;Rev Date Name Description
;----------------------------------------------------------------------------
;990222 RAY Use ML 6.x to compile
ifdef MASM611 ;990222
.MODEL SMALL, BASIC ;990222
OPTION PROC: PRIVATE ;990222
endif ;MASM611 ;990222
PAGE 60,132
TITLE AMOUSE.ASM - PS/2 mouse BIOS(IRQ12) service handler
.286
.XLIST
INCLUDE BIOS.CFG
INCLUDE COMMON.MAC
INCLUDE EXTDATA.EQU
INCLUDE 8042.EQU
INCLUDE 8259.EQU
extrn out_8042:near
extrn out_8042_full:near
.LIST
G_RAM SEGMENT AT 0H
ORG 04H*4
INCLUDE SEG_0.INC
ORG 400H
INCLUDE G_RAM.INC
G_RAM ENDS
DGROUP GROUP FCODE
FCODE SEGMENT PARA PUBLIC 'CODE'
ASSUME CS:DGROUP
;*****************************************************************************
; Procedure Name: dis_kc_ms
; disable auxiliary device output buffer full interrupt bit in keyboard
; controller command byte
; Saves:
; Inputs: cl = command byte
; al = data byte
; Output: cf = 1 : keyboard controller error
; cf = 0 : successful
; Destroy: ax, cx
;
;*****************************************************************************
public DIS_KC_MS
DIS_KC_MS PROC NEAR
mov cl,WRITE_CMD ; set command byte
mov al,65h ; forced value
call Send_Command_to_KC
jnz short dkm_err ; error if input buffer full
clc
jmp short dkm_ret
dkm_err:
stc
dkm_ret:
ret
DIS_KC_MS ENDP
;*****************************************************************************
; Procedure Name: en_kc_ms
; enable auxiliary device output buffer full interrupt bit in keyboard
; controller command byte
; Saves:
; Inputs: cl = command byte
; al = data byte
; Output: cf = 1 : keyboard controller error
; cf = 0 : successful
; Destroy: ax, cx
;*****************************************************************************
public EN_KC_MS
EN_KC_MS PROC NEAR
mov cl,WRITE_CMD ; set command byte
mov al,47h ; forced value
call Send_Command_to_KC
jnz short ekm_err ; error if input buffer full
clc
jmp short ekm_ret
ekm_err:
stc
ekm_ret:
ret
EN_KC_MS ENDP
;*****************************************************************************
; Procedure Name: out_aux
; Output a command to 8042 port 64h for auxiliary device (CL)
; Output a data to 8042 port 60h for auxiliary device (AL)
; Saves:
; Inputs: cl = command byte
; al = data byte
; Output: zf = 0 : keyboard controller error
; zf = 1 : successful
; Destroy: ax, bh, cx
;*****************************************************************************
public out_aux
out_aux proc near
mov cl,0D4h ;Command in CL, Data in AL
call Send_Command_to_KC
ret
out_aux endp
;*******************************************************************************
;* Procedure Name: Send_Command_to_KC
;* Call by OUT_AUX,
;*
;* Inputs: cl = command byte
;* al = data byte
;* Output: zf = 0 : keyboard controller error
;* zf = 1 : successful
;* Destroy: ax, bh, cx
;*
;*******************************************************************************
Send_Command_to_KC Proc Near
push bx ; save BX
mov ah,20h ; try again count
push cx
push ax
Try_Again:
cli ; Disable interrupts
pop ax ; restore ax,cx
pop cx
push cx
push ax
mov al,cl ;Save command
call out_8042
jnz short Can_Not_Complete_Command
in al,stat8042 ;Read status
jmp $+2 ;IO delay
and al,OBF_MS ; AUX OBF+ KB OBF
cmp al,OBF_MS ; MOUSE Data ?
jz short Clear_Aux_OBF
test al,OBF_8042 ; Keyboard OBF ?
jz short Ready_to_Send ; Jump if zero
sti ; Enable interrupts
pop ax
dec ah
push ax
jnz short Try_Again ; Loop if zf=0, cx>0
jmp short can_not_complete_command
Clear_AUX_OBF:
in al,DATA8042 ; error recover
and byte ptr ds:pdflg_1,0F8h ;Clear package index
Ready_to_Send:
pop ax
push ax
out DATA8042,al ;Send data
xor ah,ah ;Set zero flag
sti
Can_Not_Complete_Command:
pop ax
pop cx
pop bx ; restore BX
ret
Send_Command_to_KC EndP
;*****************************************************************************
; Procedure Name: out_aux_full
; Check for 8042 auxiliary device output buffer full
; Saves:
; Inputs: none
; Output: al = status register value
; zf = 0 : auxiliary device output buffer full
; zf = 1 : no auxiliary device output buffer full
; Destroy: ax, cx
; Author: Ken Chen
; Date: 06/21/90
;
; Rev | Name | Date | TPR# | Description
; ------+-------+---------------+-------+-------------------------------------
; 1.00 | Ken | 06/21/90 | NEW | Initial revision
;
;*****************************************************************************
PUBLIC OUT_AUX_FULL
OUT_AUX_FULL PROC NEAR
call out_8042_full
jz short no_aux_full
test al,OBF_AUX
no_aux_full:
ret
OUT_AUX_FULL ENDP
Public Dummy_IRQ12_Handler
Dummy_IRQ12_Handler:
push ax
cli
in al,DATA8042 ; get mouse data
mov al,END_OF_INT
out B8259,al ; EOI to slave 8259
NEWIODELAY
out A8259,al ; EOI to master 8259
pop ax
iret
FCODE ENDS
END