📄 kbm_defs.asm
字号:
;========================================================================
; 010/15/98 bth
;
; changed ps2_active_flagC to ps2_tx_flagC and moved macros out of this file.
;
;========================================================================
; 01/14/98 v0.1 hth
;
; 02/10/99 added mouse_packet_lenV for 3d mouse support
;========================================================================
;##### START Module kbm_defs #####
;## Keyboard Mouse Definitions
;## Rev 0.10 - Initial Release
;*****
;***** This file contains constant, RAM variable and MACRO definitions for the
;***** Cypress PS/2 mouse interface code (kb_mouse). The following conventions are
;***** used:
;***** Names for literal constants are identified by the suffix "C"
;***** Names for RAM variables are identified by the suffix "V"
;***** Macro names are all upper case (e.g., SETC vs. Setc)
;*****
;***** References to microcontroller I/O registers use the names defined in the main
;***** keyboard code.
;**********
; Mouse I/O definitions
;**********
IO_mouse_port: equ 3 ;mouse is on port 3
ps2_clkC: equ 10h ;PS/2 clock is bit 6
ps2_dataC: equ 20h ;PS/2 data is bit 7
MP_configC: equ cfh ;all other bits of port 3 are written as 1's
P3_PS2_MASK: equ (ps2_clkC | ps2_dataC) ; bits[7:6] for PS/2 data and clock
ps2_InhibitC: equ (ps2_dataC | MP_configC) ;PS/2 inhibit (CLK=0, DATA=1)
ps2_StartC: equ MP_configC ;PS/2 Xmit Start condx (CLK=0, DATA=0)
ps2_Data0C: equ (ps2_clkC | MP_configC) ;PS/2 data 0
ps2_Data1C: equ (ps2_clkC | ps2_dataC | MP_configC) ;PS/2 data 1
;**********
; Mouse Constant definitions
;**********
ps2_timeoutC: equ 25 ;ps/2 timeout period in mS
mouse_reset_timoutC: equ 50 ;reset response timeout period in "ps2_timoutC"
mouse_data_sizeC: equ 3 ;mouse data packet size in bytes
;*** PS/2 Mouse Command & Response definitions
CMD_EnblC: equ 0f4h ;Mouse Enable
CMD_DsblC: equ 0f5h ;Mouse Disable
CMD_ResetC: equ 0ffh ;Mouse Reset
CMD_PollC: equ 0ebh ;Mouse data poll command
CMD_RemoteC: equ 0f0h ;Place mouse in Remote mode
CMD_StreamC: equ 0eah ;Place mouse in Stream mode
RESP_DiagOKC: equ 0aah ;Diagnostic Success response
RESP_ResendC: equ 0feh ;Resend response (resend from mouse)
RESP_AckC: equ 0fah ;ACK response
RESP_ErrorC: equ 0fch ;Error response
;**********
; Mouse RAM Allocations
;**********
mouse_mScntV: equ mouse_RAM_baseC+0 ;1mS timeout counter
mouse_flagsV: equ mouse_RAM_baseC+1 ;various flag bits, as detailed below
mouse_idV: equ mouse_RAM_baseC+2 ;mouse report ID
mouse_packetV: equ mouse_RAM_baseC+3 ;received mouse packet storage (4 bytes)
last_mouse_packetV:equ mouse_RAM_baseC+7 ;previous received mouse packet storage (1 byte)
mouse_work0V: equ mouse_RAM_baseC+8 ;work register 0
mouse_delayV: equ mouse_RAM_baseC+9 ;delay-generator work register
ps2_stateV: equ mouse_RAM_baseC+10 ;PS/2 bus state variable
mouse_dataV: equ mouse_RAM_baseC+11 ;mouse xmit/rcv data working register
mouse_resendV: equ mouse_RAM_baseC+12 ;mouse xmit resend data holding register
mouse_stateV: equ mouse_RAM_baseC+13 ;mouse state variable
mouse_connect_stateV: equ mouse_RAM_baseC+14 ;
mouse_packet_lenV: equ mouse_RAM_baseC+15
mouse_poll_intervalV: equ mouse_RAM_baseC+16
mouse_send_flagV: equ mouse_RAM_baseC+17
mouse_ramsizeC: equ 18 ;size of mouse RAM
;********** Mouse Flags Byte (mouse_flagsV) bit definitions
mouse_conx_flagC: equ 1 ;bit 0: Mouse Connected
ps2_parity_flagC: equ 2 ;bit 1: parity flag
ps2_tfail_flagC: equ 4 ;bit 2: PS/2 transmission failure flag
ps2_tx_flagC: equ 8 ;bit 3: PS/2 transmit complete flag
mouse_rcv_flagC: equ 10h ;bit 4: Mouse data received flag
ps2_rfail_flagC: equ 20h ;bit 5: PS/2 receive failure flag
ps2_timout_flagC: equ 40h ;bit 6: PS/2 bus timeout flag
mouse_suspend_flagC: equ 80h ;bit 7: Mouse suspend flag
;* all ps2 error flags
ps2_error_flagsC: equ (ps2_tfail_flagC | ps2_rfail_flagC | ps2_timout_flagC)
;**********
; Macro Definitions
;***********
;*****
; SETC
; Sets C bit
;*****
;MACRO SETC
; cpl A ;Set C-bit
; cpl A ;
;*** END MACRO SETC
;ENDM
;##### END Module mouse_defs #####
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -