📄 main.lis
字号:
.module main.c
.area text(rom, con, rel)
0000 .dbfile ./main.c
0000 .dbfunc e main _main fV
0000 _main::
0000 .dbline -1
0000 .dbline 61
0000 ; //----------------------------------------------------------------------------
0000 ; // C main line
0000 ; //----------------------------------------------------------------------------
0000 ;
0000 ; #include <m8c.h> // part specific constants and macros
0000 ; #include "PSoCAPI.h" // PSoC API definitions for all User Modules
0000 ;
0000 ; #include "main.h"
0000 ; #include "timer.h"
0000 ; #include "USB_mk.h"
0000 ; #include "port.h"
0000 ; #include "int_func.h"
0000 ; #include "debug.h"
0000 ;
0000 ; #define PORT0_UNUSED_PINS 0xFF //@@all pins of port0 is unused
0000 ; #define RED_LED 0x8
0000 ; #define PORT1_UNUSED_PINS 0x84 // Pins 2,and 7
0000 ;
0000 ; BOOL shouldSuspend;//@@a flag indicated suspend
0000 ; BOOL shouldprotect;//@@a flag indicated protect is necessary or not
0000 ; UINT16 protect_counter;//inorder to send a broke code and clear USB keyboard's first byte to protect the system
0000 ;
0000 ; APP_TX_PACKET report_packet;
0000 ; APP_TX_PACKET_KB report_packet_kb;
0000 ;
0000 ; INT8 get_int1_new;
0000 ; INT8 reg_int1_new;
0000 ; BOOL shouldstartms;//@@a flag indicated mouse timer start is necessary or not
0000 ; INT8 ms_timer;
0000 ; UINT8 get_ms0;
0000 ; UINT8 get_ms1;
0000 ; UINT8 get_ms2;
0000 ; UINT8 get_ms3;
0000 ; UINT8 get_ms4;
0000 ;
0000 ;
0000 ; INT8 get_int0_new;
0000 ; INT8 reg_int0_new;
0000 ; BOOL shouldstartkb;//@@a flag indicated keyboard timer start is necessary or not
0000 ; INT8 kb_timer;
0000 ; UINT8 get_kb0;
0000 ; UINT8 get_kb1;
0000 ; UINT8 get_kb2;
0000 ; UINT8 get_kb3;
0000 ; UINT8 get_kb4;
0000 ; UINT8 get_kb5;
0000 ; UINT8 get_kb6;
0000 ; UINT8 get_kb7;
0000 ; BOOL R_GUI;
0000 ; BOOL R_ALT;
0000 ; BOOL R_SHIFT;
0000 ; BOOL R_CTRL;
0000 ; BOOL L_GUI;
0000 ; BOOL L_ALT;
0000 ; BOOL L_SHIFT;
0000 ; BOOL L_CTRL;
0000 ;
0000 ; static void mk_init( void );//local function,can't be got out this file
0000 ; void mk_report_init( void );
0000 ; void main()
0000 ; {
0000 .dbline 62
0000 ; debug_turn_on_led();
0000 10 push X
0001 7C0000 xcall _debug_turn_on_led
0004 20 pop X
0005 .dbline 63
0005 ; M8C_ClearWDT;// Clear Watchdog
0005 62E300 mov REG[0xe3],0
0008 .dbline 64
0008 ; shouldSuspend = FALSE;
0008 552000 mov [_shouldSuspend],0
000B .dbline 65
000B ; OSC_CR0 = 0x1B;//24MHZ CPU
000B 7110 or F,0x10 ; iopage = 1
000D 62E01B mov REG[0xe0],27
0010 70EF and F,0xEF ; iopage = 0
0012 .dbline 66
0012 ; M8C_EnableGInt;
0012 7101 or F, 01h
0014
0014 .dbline 67
0014 ; M8C_EnableWatchDog;//Enable WDT
0014 41FFEF and REG[0xff],-17
0017 .dbline 68
0017 ; MSTIMER_EnableInt();// Enable timer interrupt
0017 10 push X
0018 7C0000 xcall _MSTIMER_EnableInt
001B 20 pop X
001C .dbline 69
001C ; mk_init();
001C 901E xcall _mk_init
001E .dbline 71
001E ;
001E ; int0_initialize();
001E 10 push X
001F 7C0000 xcall _int0_initialize
0022 .dbline 72
0022 ; int1_initialize();
0022 7C0000 xcall _int1_initialize
0025 20 pop X
0026 .dbline 73
0026 ; P02CR = 0x30;//0011 0000,INT0 is occur on falling edge
0026 620730 mov REG[0x7],48
0029 .dbline 74
0029 ; P03CR = 0x30;//0011 0000,INT1 is occur on falling edge
0029 620830 mov REG[0x8],48
002C .dbline 75
002C ; INT_MSK0 = 0x22;//0010 0010,INT0 and INT1 is enabled
002C 62E022 mov REG[0xe0],34
002F .dbline 76
002F ; debug_turn_off_led();
002F 7C0000 xcall _debug_turn_off_led
0032 .dbline 79
0032 ;
0032 ; // Main loop
0032 ; for ( ;; )
0032 L3:
0032 .dbline 80
0032 .dbline 82
0032 62E300 mov REG[0xe3],0
0035 .dbline 84
0035 7C0000 xcall _usb_idle
0038 .dbline 85
0038 .dbline 79
0038 .dbline 79
0038 8FF9 xjmp L3
003A X0:
003A .dbline -2
003A L2:
003A .dbline 0 ; func end
003A 8FFF jmp .
003C .dbend
003C .dbfunc s mk_init _mk_init fV
003C _mk_init:
003C .dbline -1
003C .dbline 100
003C ; {
003C ; // Clear Watchdog
003C ; M8C_ClearWDT;
003C ; //Execute USB idle routine
003C ; usb_idle();//this function transmit USB signals
003C ; } // end for (;;)
003C ; }
003C ;
003C ; //--------------------------------------------------------------------------
003C ; //
003C ; // Function: mk_init
003C ; //
003C ; // Description:
003C ; /// This function initializes all components of the mouse and keyboard application.
003C ; ///
003C ; /// Returns:
003C ; /// void
003C ; //
003C ; //--------------------------------------------------------------------------
003C ; static void mk_init( void )
003C ; {
003C .dbline 101
003C ; port_init();
003C 7C0000 xcall _port_init
003F .dbline 102
003F ; port_drive_off( PORT0_UNUSED_PINS );// Drive all the unused pins to outputs for power savings.
003F 50FF mov A,-1
0041 08 push A
0042 7C0000 xcall _port_drive_off
0045 38FF add SP,-1
0047 .dbline 103
0047 ; P1DATA &= ~PORT1_UNUSED_PINS;
0047 41017B and REG[0x1],123
004A .dbline 104
004A ; usb_init();// Initialized the USB UM
004A 7C0000 xcall _usb_init
004D .dbline 105
004D ; timer_init();
004D 7C0000 xcall _timer_init
0050 .dbline 106
0050 ; mk_report_init();
0050 9001 xcall _mk_report_init
0052 .dbline -2
0052 .dbline 107
0052 ; }
0052 L7:
0052 .dbline 0 ; func end
0052 7F ret
0053 .dbend
0053 .dbfunc e mk_report_init _mk_report_init fV
0053 _mk_report_init::
0053 .dbline -1
0053 .dbline 113
0053 ;
0053 ; //--------------------------------------------------------------------------
0053 ; //@@mouse_report_init
0053 ; //--------------------------------------------------------------------------
0053 ; void mk_report_init( void )
0053 ; {
0053 .dbline 114
0053 ; get_int1_new=0x00;
0053 551C00 mov [_get_int1_new],0
0056 .dbline 115
0056 ; reg_int1_new=0x01;
0056 551B01 mov [_reg_int1_new],1
0059 .dbline 116
0059 ; get_int0_new=0x00;
0059 551300 mov [_get_int0_new],0
005C .dbline 117
005C ; reg_int0_new=0x01;
005C 551201 mov [_reg_int0_new],1
005F .dbline 118
005F ; ms_timer=0x00;
005F 551900 mov [_ms_timer],0
0062 .dbline 119
0062 ; kb_timer=0x00;
0062 551000 mov [_kb_timer],0
0065 .dbline 120
0065 ; R_GUI = FALSE;
0065 550700 mov [_R_GUI],0
0068 .dbline 121
0068 ; R_ALT = FALSE;
0068 550600 mov [_R_ALT],0
006B .dbline 122
006B ; R_SHIFT = FALSE;
006B 550500 mov [_R_SHIFT],0
006E .dbline 123
006E ; R_CTRL = FALSE;
006E 550400 mov [_R_CTRL],0
0071 .dbline 124
0071 ; L_GUI = FALSE;
0071 550300 mov [_L_GUI],0
0074 .dbline 125
0074 ; L_ALT = FALSE;
0074 550200 mov [_L_ALT],0
0077 .dbline 126
0077 ; L_SHIFT = FALSE;
0077 550100 mov [_L_SHIFT],0
007A .dbline 127
007A ; L_CTRL = FALSE;
007A 550000 mov [_L_CTRL],0
007D .dbline 128
007D ; protect_counter=0x0000;
007D 551E00 mov [_protect_counter+1],0
0080 551D00 mov [_protect_counter],0
0083 .dbline 129
0083 ; shouldprotect = FALSE;
0083 551F00 mov [_shouldprotect],0
0086 .dbline -2
0086 .dbline 130
0086 ; }
0086 L8:
0086 .dbline 0 ; func end
0086 7F ret
0087 .dbend
0087 .dbfunc e mouse_get_report _mouse_get_report fc
0087 ; check_ms -> X+5
0087 ; regy_ms0 -> X+4
0087 ; regx_ms0 -> X+3
0087 ; ysign -> X+2
0087 ; xsign -> X+1
0087 ; mouse_report_valid -> X+0
0087 _mouse_get_report::
0087 .dbline -1
0087 10 push X
0088 4F mov X,SP
0089 3808 add SP,8
008B .dbline 139
008B ;
008B ; //--------------------------------------------------------------------------
008B ; // mouse_get_report
008B ; //
008B ; /// This function polls the optics, wheel and buttons for potential events to
008B ; /// send over the radio. It also builds the packet payload.
008B ; //--------------------------------------------------------------------------
008B ; BOOL mouse_get_report( void )
008B ; {
008B .dbline 140
008B ; BOOL mouse_report_valid = FALSE;
008B 560000 mov [X+0],0
008E .dbline 149
008E ; UINT8 xsign;
008E ; UINT8 ysign;
008E ;
008E ; UINT8 regx_ms0;
008E ; UINT8 regy_ms0;
008E ;
008E ; UINT8 check_ms;
008E ;
008E ; get_int1_new = GET_INT1_NEW();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -