GETKEY:         MOV A,#0FFH                     ;;;;;扫描8X8键盘子程序
                MOV P1,A                        ;;;;;占用资源ACC,35H,36H
                CLR P2.7
                CLR P2.6
                MOV P3,#00H
                MOV A,P1
                JNB ACC.0,P10M
                JNB ACC.1,P11M
                JNB ACC.2,P12M
                JNB ACC.3,P13M
                JNB ACC.4,P14M
                JNB ACC.5,P15M
                JNB ACC.6,P16M
                JNB ACC.7,P17M
                RET
P10M:           LCALL D5MS
                MOV A,P1
                JB ACC.0,OUT0
                LJMP K10
P11M:           LCALL D5MS
                MOV A,P1
                JB ACC.1,OUT0
                LJMP K11
P12M:           LCALL D5MS
                MOV A,P1
                JB ACC.2,OUT0
                LJMP K12
P13M:           LCALL D5MS
                MOV A,P1
                JB ACC.3,OUT0
                LJMP K13
P14M:           LCALL D5MS
                MOV A,P1
                JB ACC.4,OUT0
                LJMP K14
P15M:           LCALL D5MS
                MOV A,P1
                JB ACC.5,OUT0
                LJMP K15
P16M:           LCALL D5MS
                MOV A,P1
                JB ACC.6,OUT0
                LJMP K16
P17M:           LCALL D5MS
                MOV A,P1
                JB ACC.7,OUT0
                LJMP K17
OUT0:           RET
K10:            SETB P2.7
                SETB P2.6
                MOV P3,#0FFH
                CLR P1.0
                MOV 36H,#00H
                LCALL SCAN
                RET
K11:            SETB P2.7
                SETB P2.6
                MOV P3,#0FFH
                CLR P1.1
                MOV 36H,#08H
                LCALL SCAN
                RET
K12:            SETB P2.7
                SETB P2.6
                MOV P3,#0FFH
                CLR P1.2
                MOV 36H,#10H
                LCALL SCAN
                RET
K13:            SETB P2.7
                SETB P2.6
                MOV P3,#0FFH
                CLR P1.3
                MOV 36H,#18H
                LCALL SCAN
                RET
K14:            SETB P2.7
                SETB P2.6
                MOV P3,#0FFH
                CLR P1.4
                MOV 36H,#20H
                LCALL SCAN
                RET
K15:            SETB P2.7
                SETB P2.6
                MOV P3,#0FFH
                CLR P1.5
                MOV 36H,#28H
                LCALL SCAN
                RET
K16:            SETB P2.7
                SETB P2.6
                MOV P3,#0FFH
                CLR P1.6
                MOV 36H,#30H
                LCALL SCAN
                RET
K17:            SETB P2.7
                SETB P2.6
                MOV P3,#0FFH
                CLR P1.7
                MOV 36H,#38H
                LCALL SCAN
                RET
SCAN:           JNB P2.6,P26M
                JNB P2.7,P27M
                JNB P3.2,P32M
                JNB P3.3,P33M
                JNB P3.4,P34M
                JNB P3.5,P35M
                JNB P3.6,P36M
                JNB P3.7,P37M
OUT1:           RET
P26M:           LCALL D5MS
                JB P2.6,OUT1
                MOV A,36H
                ADD A,#07H
                MOV 35H,A
                RET
P27M:           LCALL D5MS
                JB P2.7,OUT1

                MOV A,36H
                ADD A,#06H
                MOV 35H,A
                RET
P32M:           LCALL D5MS
                JB P3.2,OUT1

                MOV A,36H
                ADD A,#00H
                MOV 35H,A
                RET
P33M:           LCALL D5MS
                JB P3.3,OUT1

                MOV A,36H
                ADD A,#01H
                MOV 35H,A
                RET
P34M:           LCALL D5MS
                JB P3.4,OUT1

                MOV A,36H
                ADD A,#02H
                MOV 35H,A
                RET
P35M:           LCALL D5MS
                JB P3.5,OUT1

                MOV A,36H
                ADD A,#03H
                MOV 35H,A
                RET
P36M:           LCALL D5MS
                JB P3.6,OUT1

                MOV A,36H
                ADD A,#04H
                MOV 35H,A
                RET
P37M:           LCALL D5MS
                JB P3.7,OUT1

                MOV A,36H
                ADD A,#05H
                MOV 35H,A
                RET
