今天用一個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
?
評論
查看更多