?? combi.lst
字號:
0000 #define PORT1_LED_MASK 0b00000000 //no led drive on port 1
0080 #define PORT0_SWITCH_MASK 0b10000000 //switch input at pin [7] on port 0
0003 #define PORT1_SWITCH_MASK 0b00000011 //switch inputs at [1:0] on port 1
//comment the following lines if you do not want PS2 resolution and scaling commands to be implemented
//in the code.
002F #define ENABLE_RESOLUTION
0030 #define ENABLE_SCALING
//END OF USER DEFINES
//*************************************************************************************************
//*************************************************************************************************
//COMMON DECLARATIONS USED BY BOTH INTERFACES
#include "macros.h" //include macro definitions
#asm
;define special macros for manipulating PS2 clock and data.
;
MACRO READ_PS2_CLOCK_DATA
iord PORT2
ENDM
MACRO WRITE_PS2_CLOCK_DATA VALUE
mov A,(VALUE | a0h)
iowr USB_STATUS
ENDM
MACRO WRITE_ACC_PS2_CLOCK_DATA
or A,a0h
iowr USB_STATUS
and A,07h
ENDM
MACRO ASSERT_PS2_CLOCK
index drive_table
or A,a0h
iowr USB_STATUS
and A,07h
ENDM
MACRO DEASSERT_PS2_CLOCK
index drive_table
or A,a0h
iowr USB_STATUS
and A,07h
ENDM
;delay macro is the front-end for a call to the delay subroutine
;The fixed overhead of the macro plus the subroutine is 3 us,
;so this technique is good for delays of 4us or greater.
;
MACRO DELAY US
push A
mov A, (US-3)
call delay
ENDM
;
;clear carry
MACRO CLEARC
or A,0
ENDM
MACRO SETC
cpl
cpl
ENDM
;set carry
MACRO CARRY
push A
mov A, (US-3)
call delay
ENDM
#endasm
/*
** define port data and mode initial values for the 3 operating states -- normal, suspend, and suspend with remote
** wakeup -- based on the masks provided by the user
*/
/*
**normal operating mode
*/
0080 #define PORT0_INIT PORT0_SWITCH_MASK
0003 #define PORT1_INIT PORT1_SWITCH_MASK
0080 #define PORT0_MODE1_INIT PORT0_SWITCH_MASK
0003 #define PORT1_MODE1_INIT PORT1_SWITCH_MASK
0040 #define PORT0_MODE0_INIT PORT0_LED_MASK
0000 #define PORT1_MODE0_INIT PORT1_LED_MASK
/*
** suspend mode (no remote wakeup)
*/
0040 #define PORT0_SUSPEND PORT0_LED_MASK
0000 #define PORT1_SUSPEND PORT1_LED_MASK
0040 #define PORT0_MODE1_SUSPEND PORT0_LED_MASK
0000 #define PORT1_MODE1_SUSPEND PORT1_LED_MASK
0080 #define PORT0_MODE0_SUSPEND PORT0_SWITCH_MASK
0003 #define PORT1_MODE0_SUSPEND PORT1_SWITCH_MASK
/*
** remote wakeup
*/
0031 #define PORT0_RW (PORT0_LED_MASK | PORT0_SWITCH_MASK)
0032 #define PORT1_RW (PORT1_LED_MASK | PORT1_SWITCH_MASK)
0033 #define PORT0_MODE1_RW (PORT0_SWITCH_MASK | PORT0_LED_MASK)
0034 #define PORT1_MODE1_RW (PORT1_SWITCH_MASK | PORT1_LED_MASK)
0000 #define PORT0_MODE0_RW 0
0000 #define PORT1_MODE0_RW 0
0035 #define LEFT_SWITCH_ASSERTED (!(LEFT_SWITCH_PORT & LEFT_SWITCH_MASK))
0036 #define MIDDLE_SWITCH_ASSERTED (!(MIDDLE_SWITCH_PORT & MIDDLE_SWITCH_MASK))
0037 #define RIGHT_SWITCH_ASSERTED (!(RIGHT_SWITCH_PORT & RIGHT_SWITCH_MASK))
/*
** switches are debounced in a routine that is called every 4 msec. 10
** successive stable samples are required for a switch change to be reported.
*/
000A #define DEBOUNCE_COUNT 10 //10 identical samples must be taken to recognize switch changes
/*
** define a structure containing variables updated in the 1-msec interrupt
*/
typedef struct
{
char b1msCounter; //incremented inside 1msec interrupt for general timing
char b1msFlags; //flag set inside 1msec interrupt
0038 }ONE_MSEC_STATUS;
0001 #define ONE_MSEC_FLAG 1
/*
** Quadrature inputs are sampled inside the 128 usec interrupt and placed in a queue for later
** processing in the main loop.
**
*/
typedef struct
{
char near *headP; //head of queue
char near *tailP; //tail of queue
char bLen; //length of queue
0039 }QUEUE_STRUCT;
/*
** current state of each quadrature pair is stored to compare with the next sample.
**
*/
typedef struct
{
char bXstate; //current state of X optics
char bYstate; //current state of Y optics
char bZstate; //current state of Z optics
003A }OPTICS_STATE;
/*
** the order of the bytes in this structure is important! These bytes are in the
** proper order for a packet returned to a USB host in response to a Get_Report command.
*/
typedef struct
{
char bChange; //set to 1 if mouse state has changed
char bButtons; //current state of mouse buttons
signed char bXcount; //current accumulation of X counts
signed char bYcount; //current accumulation of Y counts
signed char bZcount; //current accumulation of Z counts
003B }MOUSE_STATE;
/*
** global variables used by both USB and PS2 interfaces
*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -