今天用一个DGUS II的屏模拟了一下键盘加密(类似于网银加密键盘),很简单也很实用。具体视频和说明请参照http://bbs.elecfans.com/user/3035995/articles/。来看下效果吧~
图1:第一次录入
图2:第二次录入
图3:第三次录入
代码如下:
ORG 1000H
GOTO START
NOP
NOP
NOP
ORG 1080H
START:
LDWR R0,5000H
LDADR STRING
MOVC R100,64
MOVXR R100,0,32
LDWR R20,5AA5H
LDWR R22,0000H;上电禁用掉数据录入控件
LDWR R24,0100H
LDWR R26,0000H
LDWR R0,00B0H
MOVXR R20,0,4
MAIN:
CALL ANYA_CHUFA
CALL CK_LURU
CALL CK_CHANGE
GOTO MAIN
;====================
;====================
ANYA_CHUFA:
LDWR R0,1F00H
MOVXR R10,1,1
IJNE R11,0,1
RET
LDWR R0,00B0H
LOOP: MOVXR R10,1,1
IJNE R10,0,LOOP ;开启本条指令
IJNE R11,0,LOOP
LDWR R20,5AA5H
LDWR R22,0000H
LDWR R24,0100H
LDWR R26,0001H
LDWR R0,00B0H
MOVXR R20,0,4
LOOP1: MOVXR R10,1,1
IJNE R10,0,LOOP1 ;模拟触发本条指令
IJNE R11,0,LOOP1
LDWR R20,5AA5H
LDWR R22,0004H
LDWR R24,100
LDWR R26,100
LDWR R0,00D4H
MOVXR R20,0,4
LDWR R10,0
LDWR R0,1F00H
MOVXR R10,0,1
RET
;====================================
;====================================
CK_LURU:
LDWR R0,1F01H
MOVXR R10,1,1
IJNE R11,0,1
RET
LDWR R10,1
LDWR R0,1F02H
MOVXR R10,0,1
RET
;============================
CK_CHANGE:
LDWR R0,1F02H;检查标志位是不是1
MOVXR R10,1,1
IJNE R11,0,1
RET
LDWR R0,1F01H;在标志位是1的情况下检查是不是在录入状态
MOVXR R10,1,1
IJNE R11,1,1
RET;录入状态直接返回
LDWR R0,1F02H;标志位清零
LDWR R10,0
MOVXR R10,0,1
LDWR R0,5011H
MOVXR R10,1,1
DEC R10,1,1
IJNE R11,1,1
LDWR R10,12
MOVXR R10,0,1
LDWR R0,5000H;录入过程中调用的界面更改
MOVXR R10,1,32
LDWR R0,00B4H
MOVXR R10,0,32
LDWR R10,5AA5H;更改该条触控指令
LDWR R12,0000H
LDWR R14,0100H
LDWR R16,0003H
LDWR R0,00B0H
MOVXR R10,0,4
; LDWR R0,00B0H
LOOP3: MOVXR R10,1,1
IJNE R10,0,LOOP3
IJNE R11,0,LOOP3
LDWR R20,5AA5H
LDWR R22,0000H
LDWR R24,0100H
LDWR R26,0000H;禁用该条指令
LDWR R0,00B0H
MOVXR R20,0,4
CK_CHANGE_RET:
NOP
RET
;=======================================
STRING:
DB 00H,00H,00H,00H,00H,00H,01H,03H,00H,B5H,FFH,00H,FFH,00H,FDH,00H,FEH,20H,00H,01H,08H,00H,01H,6AH,01H,5DH,00H,00H,00H,10H,00H,01H,FEH,01H,00H,0CH,00H,62H,01H,4CH,01H,7EH,02H,A5H,00H,62H,01H,4CH,FEH,00H,00H,00H,00H,00H,00H,00H,00H,00H,5AH,1FH,01H,00H,01H,00H
评论
查看更多