?? sleep.lst
字號:
< .const B_Com13 = 0x2000
< .const B_Com14 = 0x4000
< .const B_Com15 = 0x8000;
<
< .const P_Seg0 = 0x7100;
< .const P_Seg1 = 0x7101;
< .const P_Seg2 = 0x7102;
< .const P_Seg3 = 0x7103;
< .const P_Seg4 = 0x7104;
< .const P_Seg5 = 0x7105;
< .const P_Seg6 = 0x7106;
< .const P_Seg7 = 0x7107;
< .const P_Seg8 = 0x7108;
< .const P_Seg9 = 0x7109;
< .const P_Seg10 = 0x710A;
< .const P_Seg11 = 0x710B;
< .const P_Seg12 = 0x710C;
< .const P_Seg13 = 0x710D;
< .const P_Seg14 = 0x710E;
< .const P_Seg15 = 0x710F;
< .const P_Seg16 = 0x7110;
< .const P_Seg17 = 0x7111;
< .const P_Seg18 = 0x7112;
< .const P_Seg19 = 0x7113;
< .const P_Seg20 = 0x7114;
< .const P_Seg21 = 0x7115;
< .const P_Seg22 = 0x7116;
< .const P_Seg23 = 0x7117;
< .const P_Seg24 = 0x7118;
< .const P_Seg25 = 0x7119;
< .const P_Seg26 = 0x711A;
< .const P_Seg27 = 0x711B;
< .const P_Seg28 = 0x711C
< .const P_Seg29 = 0x711D
< .const P_Seg30 = 0x711E
< .const P_Seg31 = 0x711F
< .const P_Seg32 = 0x7120
< .const P_Seg33 = 0x7121
< .const P_Seg34 = 0x7122
< .const P_Seg35 = 0x7123
< .const P_Seg36 = 0x7124
< .const P_Seg37 = 0x7125
< .const P_Seg38 = 0x7126
< .const P_Seg39 = 0x7127
<
< //-----------------------------------------------------------------------------//
< //Line Control
< //Procedure : 1. Enable Line det.
< // 2. Latch line status
< // 3. Enable wakeup/int
< // 4. Set wakeup/int sources
< // 5. Sleep....
< //-----------------------------------------------------------------------------//
< .const P_LineDetCtrl = 0x702E; //(R/W)
<
< .const B_CMPOut = 0x0001; //
< .const B_EnLineIntWp = 0x0040; //
< .const B_EnLineDet = 0x0080; //
<
< .const P_LatchLine = 0x702F; //
<
< //-----------------------------------------------------------------------------//
< .const P_KeyScanCtrl = 0x703B;
< .const B_AKSEN = 0x0080; //0/1 - disable/enable auto key scan function
< .const B_HIZ1 = 0x0002; //0/1 - disable/enable normal key scan mode of P_Seg15~8
< .const B_HIZ0 = 0x0001; //0/1 - disable/enable normal key scan mode of P_Seg7~0
<
< .const P_KeyScanMode = 0x703A; //b0~b8 select IOAx as wakeup source
< .const P_KeyScanPort = 0x703C; //maually scan key
.include KeyScan.ASM
< //-----------------------------------------------------------------------
< //Program Name: KeyScan.ASM
< //Applied Body: SPT6604Aretf
< //Project Description: This is a simple demo code for key scan.
< //Compile: Sunplus u'nSP IDE
< //Programmer: WangXu,Worldplus
< //Current Version: V1.0
< //Written Date: 2002/10/30
< //-----------------------------------------------------------------------
< .public F_KeyScan
< .public F_KeyTimerService
< .public F_StartKeyScan
< //-----------------------------------------------------------------------
00000000 < .RAM
00000000 00 00 < RW_KeyScanFlag: .DW 0 //b0~b7 - read portA buffer
< //b8~11 - state machine
< //b12~15 - current scan line
<
00000001 00 00 00 00 < SW_KeyStatusBuf: .DW 0,0,0,0,0
00 00 00 00
00 00
< //5 words - for key status
< //the high byte represents corresponding key is changed from 'released' to 'pressed'
< //the low byte represents corresponding key is pressed
<
00000006 00 00 < RPtr_KeyQueueBuf: .DW 0 //b0~3 - read pointer
< //b4~7 - writer pointer
< //b8~11 - key queue size in use
< //b12~15- Key Bounce Timer
< .const KeyDebounceTime = 3*8192
<
00000007 00 00 00 00 < SW_KeyQueueBuf: .DW 0,0,0,0
00 00 00 00
0000000B 00 00 < RW_Date: .DW 0
0000000C 00 00 < RW_Time: .DW 0
< //-----------------------------------------------------------------------
0000506B < .code
< F_KeyTimerService:
0000506B 11 93 06 00 < r1 = [RPtr_KeyQueueBuf]
0000506D 09 C3 00 E0 < test r1,0xE000
0000506F 04 5E < jz ?L_KeyTimeOver
00005070 09 23 00 20 < r1-= 0x2000
00005072 19 D3 06 00 < [RPtr_KeyQueueBuf] = r1
< ?L_KeyTimeOver:
00005074 90 9A < retf
< //-----------------------------------------------------------------------
< // State and vector definitions for keyboard scan
< // The format is as follows:
< // V_StateVector .DW Address of Subroutine
< // .const S_StateName = State Number
< V_KeyScan:
00005075 80 50 < V_ReadKeyBeforeBounce: .DW F_ReadKeyBeforeBounce
< .const S_ReadKeyBeforeBounce = (V_ReadKeyBeforeBounce-V_KeyScan)*256
00005076 96 50 < V_ReadKeyAfterBounce: .DW F_ReadKeyAfterBounce
< .const S_ReadKeyAfterBounce = (V_ReadKeyAfterBounce-V_KeyScan)*256
00005077 D8 50 < V_KeyCodeMapping: .DW F_KeyCodeMapping
< .const S_KeyCodeMapping = (V_KeyCodeMapping-V_KeyScan)*256
< //----------------------------------------------------------------------------//
< F_KeyScan:
00005078 11 93 00 00 < r1 = [RW_KeyScanFlag]
0000507A 79 93 < r1 = r1 lsr 4
0000507B 79 93 < r1 = r1 lsr 4
0000507C 4F B2 < r1&= 0x000F
0000507D 09 03 75 50 < r1+= V_KeyScan
0000507F C1 9E < pc = [r1]
< //----------------------------------------------------------------------------//
< F_ReadKeyBeforeBounce: //the first read
00005080 0D 9B 00 70 < bp = P_IOA_Data
00005082 C5 92 < r1 = [bp]
00005083 5F 82 < r1^= 0x001F
00005084 5F B2 < r1&= 0x001F //b0~4 of r1 is result
00005085 12 95 00 00 < r2 = [RW_KeyScanFlag]
00005087 0A B5 00 F0 < r2&= 0xF000
00005089 0A A5 00 01 < r2|= S_ReadKeyAfterBounce
0000508B 1A A3 00 00 < [RW_KeyScanFlag] = r2|r1
0000508D 11 93 06 00 < r1 = [RPtr_KeyQueueBuf] //send debounce time
0000508F 09 B3 FF 1F < r1&= 0x1FFF
00005091 09 A3 00 60 < r1|= KeyDebounceTime
00005093 19 D3 06 00 < [RPtr_KeyQueueBuf] = r1
00005095 90 9A < retf
< //----------------------------------------------------------------------------//
< F_ReadKeyAfterBounce: //the second read after bounce time
00005096 11 93 06 00 < r1 = [RPtr_KeyQueueBuf]
00005098 09 C3 00 E0 < test r1,0xE000
0000509A 02 5E < jz ?L_BounceTimeOut
0000509B 0F 9F D2 50 < goto ?L_ReadKeyOver
< ?L_BounceTimeOut:
0000509D 0D 9B 00 70 < bp = P_IOA_Data
0000509F C5 92 < r1 = [bp]
000050A0 5F 82 < r1^= 0x001F
000050A1 5F B2 < r1&= 0x001F //b0~4 of R1 is result
000050A2 12 95 00 00 < r2 = [RW_KeyScanFlag]
000050A4 0A B7 1F 00 < r3 = r2 & 0x001F
000050A6 03 43 < cmp r1,r3
000050A7 0A 4E < jnz ?L_KeyStatusOk //ignore, not equal
000050A8 7A 9B < bp = r2 lsr 4
000050A9 7D 9B < bp = bp lsr 4
000050AA 7D 9B < bp = bp lsr 4 //the current scan line
000050AB 0D 0B 01 00 < bp+= SW_KeyStatusBuf
000050AD C5 A6 < r3|= [bp]
000050AE C5 86 < r3^= [bp] //'0' -- '1',the corresponding bit is '1'
000050AF 5B 97 < r3 = r3 LSL 4
000050B0 5B A3 < r1|= r3 LSL 4
000050B1 C5 D2 < [bp] = r1
< ?L_KeyStatusOk:
000050B2 11 93 00 00 < r1 = [RW_KeyScanFlag]
000050B4 09 03 00 10 < r1+= 0x1000
000050B6 09 B3 00 F0 < r1&= 0xF000
000050B8 09 43 00 50 < cmp r1,0x5000 //have all lines scanned?
000050BA 13 2E < jge ?L_KeyScanLineOver //check key and scan again
000050BB 40 A2 < r1|= S_ReadKeyBeforeBounce //check next line
000050BC 19 D3 00 00 < [RW_KeyScanFlag] = r1
< ?L_PrepareNextScanLine:
000050BE 79 93 < r1 = r1 lsr 4
000050BF 79 93 < r1 = r1 lsr 4
000050C0 79 93 < r1 = r1 lsr 4
000050C1 09 03 D3 50 < r1+= TW_ScanLine
000050C3 C1 92 < r1 = [r1]
000050C4 40 F1 < int off
000050C5 12 95 06 70 < r2 = [P_IOB_Buf]
000050C7 0A B5 E0 00 < r2&= 0x00E0
000050C9 01 A5 < r2|= r1
000050CA 1A D5 05 70 < [P_IOB_Data] = r2 //Set scan line
000050CC 43 F1 < int fiq,irq
000050CD 04 EE < jmp ?L_ReadKeyOver
< ?L_KeyScanLineOver:
000050CE 09 A3 00 02 < r1 |= S_KeyCodeMapping
000050D0 19 D3 00 00 < [RW_KeyScanFlag] = r1
< ?L_ReadKeyOver:
000050D2 90 9A < retf
< //-------------------------------------------------------------------------------
< TW_ScanLine:
000050D3 1E 00 < .DW 0x001F - 0x0001 // IOB0 = 0
000050D4 1D 00 < .DW 0x001F - 0x0002 // IOB1 = 0
000050D5 1B 00 < .DW 0x001F - 0x0004 // IOB2 = 0
000050D6 17 00 < .DW 0x001F - 0x0008 // IOB3 = 0
000050D7 0F 00 < .DW 0x001F - 0x0010 // IOB4 = 0
< //----------------------------------------------------------------------------//
< F_KeyCodeMapping:
000050D8 40 92 < r1 = 0x0000 //r1 - column number
< ?L_SearchKeyLoop:
000050D9 09 0B 01 00 < bp = r1+SW_KeyStatusBuf
000050DB C5 94 < r2 = [bp]
000050DC 0A C5 00 1F < test r2,0x1F00
000050DE 05 4E < jnz ?L_FindKeyChanged //key is changed to be pressed from release
000050DF 41 02 < r1+= 0x0001
000050E0 45 42 < cmp r1,0x0005
000050E1 49 3E < jl ?L_SearchKeyLoop
000050E2 0F 9F 29 51 < goto ?L_ReStartScanKey
< ?L_FindKeyChanged: //r1 - column number
000050E4 7A 97 < r3 = r2 lsr 4
000050E5 7B 97 < r3 = r3 lsr 4
000050E6 5F B6 < r3&= 0x001F
000050E7 5F 86 < r3^= 0x001F
000050E8 02 B7 < r3&= r2
000050E9 02 5E < jz ?L_ChangePressSameKey
000050EA 0F 9F 29 51 < goto ?L_ReStartScanKey
< ?L_ChangePressSameKey:
< //----------------------------------------------------------------------------
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -