来源:中国一卡通网 作者:张敏 发布时间:2005-05-19 17:13:07 字体:[大 中 小]
关键字:关于非接触式IC智能(射频)卡及其读写设备内核技术的研究与应用开发(连载12)
摘 要:关于非接触式IC智能(射频)卡及其读写设备内核技术的研究与应用开发(连载12)
;----------------- the 1st sector -------------------- MOV 78h,#04h ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
COMPARE_05: CJNE A,#05H,COMPARE_06
lcall sector_01_common
MOV 78h,#05h ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
COMPARE_06: CJNE A,#06H,COMPARE_07
lcall sector_01_common
MOV 78h,#06h ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
COMPARE_07: CJNE A,#07H,COMPARE_08
lcall sector_01_common
MOV 78h,#07h ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
;----------------- the 2nd sector --------------------
COMPARE_08:
CJNE A,#08H,COMPARE_09
lcall sector_02_common
MOV 78h,#08h ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
COMPARE_09:
CJNE A,#09H,COMPARE_0A
lcall sector_02_common
MOV 78h,#09h ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
COMPARE_0A: CJNE A,#10H,COMPARE_0B
lcall sector_02_common
MOV 78h,#0ah ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
COMPARE_0B: CJNE A,#11H,COMPARE_0C
lcall sector_02_common
MOV 78h,#0bh ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
;-----------------the 3rd sector -------------------
COMPARE_0C: CJNE A,#12H,COMPARE_0D
lcall sector_03_common
MOV 78h,#0ch ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
COMPARE_0D: CJNE A,#13H,COMPARE_0E
lcall sector_03_common
MOV 78h,#0dh ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
COMPARE_0E: CJNE A,#14H,COMPARE_0F
lcall sector_03_common
MOV 78h,#0eh ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
COMPARE_0F: CJNE A,#15H,COMPARE_10
lcall sector_03_common
MOV 78h,#0fh ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
;---------------- the 4th sector------------------------
COMPARE_10: CJNE A,#16H,COMPARE_11
lcall sector_04_common
MOV 78h,#10h ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
(省略COMPARE_11 至COMPARE_3E 之程序,基本同上)
COMPARE_3f: CJNE A,#63H,read_x_block_exit
lcall sector_15_common
MOV 78h,#3fh ;READ'S Sect. NO.
lcall read_x_block
ljmp read_x_block_exit
;------------------------ end of 0--63 block setup ----------------------
;---------------- exit ------------------------
read_x_block_exit:
ret
;--------------------------------
;------------------------ DISP_BUF_right_MOVE -------------------------------
DISP_BUF_right_MOVE:
MOV 32H,33H
MOV 33H,34H
MOV 34H,35H
MOV 35H,37H
MOV 37H,38H
MOV 38H,39H
MOV 39H,3AH
RET
;--------------------- read_x_block--------------------------
read_x_block:
setb p2.5 ;MCM ON (-RST=1)
clr p2.4 ;MCM ON (-CS=0)
MOV R2,#01H ;SELECT REQUEST_STD
;MOV R2,#00H
lcall request ;request
lcall display
lcall h_display
lcall d500ms
clr p2.6
lcall init_disp_buf
lcall display
lcall h_display
lcall anticollision ;anticollision
lcall display
lcall h_display
lcall d500ms
clr p2.6
lcall init_disp_buf
lcall display
lcall h_display
lcall select ;select
lcall display
lcall h_display
lcall d500ms
clr p2.6
lcall init_disp_buf
lcall display
lcall h_display
lcall load_key ;load_key
lcall display
lcall h_display
lcall d500ms
lcall d500ms
clr p2.6
lcall init_disp_buf
lcall display
lcall h_display
mov 7eh,79h ;sel keyset0
mov 7dh,7ah ;
mov 7ch,#60h ;auth_1a instr. code
lcall authentication ;authentication
lcall display
lcall h_display
lcall d500ms
lcall d500ms
clr p2.6
lcall init_disp_buf
lcall display
lcall h_display
mov 7dh ,#50h ;the address for storing reading_data
mov 7ch,78h ;read sector & block
lcall read ;read
lcall display
lcall h_display
lcall d500ms
lcall d500ms
clr p2.6
lcall init_disp_buf
lcall display
lcall h_display
lcall halt ;halt
lcall display
lcall h_display
lcall d500ms
clr p2.6
lcall init_disp_buf
lcall display
lcall h_display
lcall disp_rd_blk ;display the reading_value
lcall clear_disp_rd_blk_in_cpu
clr p2.6
MOV A,#80H ;SOFTWARE_RESET MCM
MOV R0,#01H
MOVX @R0,A
LCALL D500MS
ret
;---------------------end of “read_x_block” ----------------------
;-----------------------------------------------------
sector_01_common:
MOV 7fh,#0AaH
MOV 7eh,#00H
MOV 7dh,#01h
MOV 7ch,#47H
MOV 79h,#80H
MOV 7ah, #81h
MOV 7bh, #60H
ret
;-----------------------------------------------------
sector_02_common:
MOV 7fh,#0AbH
MOV 7eh,#00H
MOV 7dh,#02h
MOV 7ch,#60H
MOV 79h,#80H
MOV 7ah, #82h
MOV 7bh, #60H
ret
;----------------------------------------------------
(省略sector_03_common 至sector_14_common 之程序,基本同上)
;----------------------------------------------------
sector_15_common:
MOV 7fh,#0AaH
MOV 7eh,#00H
MOV 7dh,#0fh
MOV 7ch,#60H
MOV 79h,#80H
MOV 7ah, #8fh
MOV 7bh, #60H
ret
;----------------------------------------------------
;end of this program.
END
;====================== End of This Program =========================
结 束 语
智能IC卡片及其读写设备之技术正处于成熟/发展其间,只要我们中国自己的微电子技术再提高一步,相信我国将能实现真正意义上的“金卡工程”,因为实现这一工程的软件和硬件完全可以“自给自足”, 金融,邮电,公交等国家主干行业将能抵御外国“侵略”,不依赖进口。笔者相信在国内ICC界同行的共同努力下,在国家金卡工程办公室领导小组的正确领导下,我国的国民经济将在得益于“金卡工程”的前提下,高速增长。
(全文完)