smc_dtc_format_end.hex

来自「HID-Ukey底层源码实现(st72651芯片) windows上层驱动」· HEX 代码 · 共 493 行 · 第 1/2 页

HEX
493
字号
 // *****************************************************************
 // * NOTICE: The information contained in this file is proprietary *
 // * to SGS-THOMSON Microelectronics and is being made available   *
 // * to ST customers under strict non-disclosure agreements.       *
 // * Use or disclosure of this information is permissible only     *
 // * under the terms of the existing non-disclosure agreement.     *
 // *****************************************************************

 // Written by Christophe BRICOUT
 // Created by MPmanCompiler.exe (v3.0) Sat Sep 27 16:15:06 2003


 //===================================================================
 //
 //                    SMART MEDIA CARD
 //
 //===================================================================
  
 //---------------
 // smc_dtc_format
 //---------------
  
 // Check spare area
 //	call send_cmd_address with CMD 0x50 & 0x00
 //	call init_read_spare without any param
 //		on error, goto next cluster
 // Erase the cluster
 //	call send_cmd_address with CMD 0x60 & 0xD0
 //	call read_status without any param
 //		on error, mark this cluster as bad and goto next cluster
 // Write all 0's to the cluster
 //	call send_cmd_00 without any param
 //	call write_zero_to_all_pages with CMD 0x80 & 0x10
 // Read all 0's
 //	call send_cmd_address with CMD 0x00 & 0x40
 //		on error, mark this cluster as bad and goto next cluster
 //	call read_check_cluster without any param
 //		on error, mark this cluster as bad and goto next cluster
 // Erase the cluster
 //	call send_cmd_address with CMD 0x60 & 0xD0
 //	call read_status without any param
 //		on error, mark this cluster as bad and goto next cluster
  
  
 // :clear_cluster_pages
 //-------------------
  
 0xca,   //   0 LD	A CMP10		// it is either 0x10 for write or 0xD0 for erase
 0x33,   //   1 EXCHANGE
 0x3b,   //   2 BSET4
 // JP :time_to_go_home
 0x4d,   //   3 JP  13
  
 0xae,   //   4 LD	MSB 14
 0xb5,   //   5 LD	LSB 5
 0x84,   //   6 LD	ADR_BUFFER00	// buffer pointer 0 = 0x00E5
 0xdb,   //   7 LD	A DATA_BUFFER0
 0x2,   //   8 CLC
 0x25,   //   9 ADDER8	X		// increase the page address
 0x9b,   //   a LD	DATA_BUFFER0	// and save it
  
 0x2,   //   b CLC
 0xc8,   //   c LD	A CMP00		// get the page counter
 0x24,   //   d SUB8	X
 0x8,   //   e CP	A=>X		// check the page counter
 // JP :save_page_counter
 0x57,   //   f JP  23
  
 // :time_to_go_home
 //--------------- On this point:
 //	After ERASE	CMP11 = 0x60 (1st CMD)		ADR0 = 0x00E4 or 0x00E3
 //			CMP10 = 0xD0 (2nd CMD)		ADR1 = xxxx
 //	After WRITE	
 //			CMP11 = 0x02 (for compare write 0x0210 bytes)
 //			CMP10 = 0x10 (2nd CMD)
 //			ADR0 = 0x00E4 or 0x00E3
 //			ADR1 = 0x0210 (after compare write 0x210 bytes)
 0x5,   //  10 STATUS	STOP
  
 //--------------------------------------------------------
 //	START ADDRESS FOR send sequential read command
 //--------------------------------------------------------
 // :send_cmd_00
 //-----------
 0xa0,   //  11 LD	MSB 0
 0xb,   //  12 CP	ALWAYS
  
  
 // JP :pre_send_cmd_address0
 0x55,   //  13 JP  21
  
 //------------------------------------------------------------------
 //		START ADDRESS FOR 1st step of erasing
 //------------------------------------------------------------------
 // :send_cmd_for_erase
 0xa6,   //  14 LD	MSB 6
 0xb0,   //  15 LD	LSB 0
 0x8b,   //  16 LD	CMP11		// 1st CMD of ERASE = 0x60
 0xad,   //  17 LD	MSB 13		// 2nd CMD of ERASE = 0xD0
 0xb,   //  18 CP	ALWAYS
 // JP :pre_send_cmd_address
 0x52,   //  19 JP  18
  
 //------------------------------------------------------------------
 //		START ADDRESS FOR 1st step of check spare area
 //------------------------------------------------------------------
 // :send_cmd_for_check
 0xa5,   //  1a LD	MSB 5
 0xb,   //  1b CP	ALWAYS		// 1st CMD of READ SPARE = 0x50, 2nd CMD = 0x50 too
 // JP :send_cmd_for_read_1
 0x42,   //  1c JP  2
  
 //------------------------------------------------------------------
 //		START ADDRESS FOR 1st step of reading 0's
 //------------------------------------------------------------------
 // :send_cmd_for_read
 0xa0,   //  1d LD	MSB 0
 // :send_cmd_for_read_1
 0xb0,   //  1e LD	LSB 0
 0x8b,   //  1f LD	CMP11		// 1st CMD of READ = 0x00
  
 0xb,   //  20 CP	ALWAYS
 // JP :pre_send_cmd_address
 0x4a,   //  21 JP  10
  
 //------------------
 // :write_zero_to_all_pages
 //-----------------------
 0xaf,   //  22 LD	MSB 15
 0xbf,   //  23 LD	LSB 15
 0x84,   //  24 LD	ADR_BUFFER00	// buffer pointer 0 = 0x00FF, points to page counter
 0xdb,   //  25 LD	A DATA_BUFFER0
 // :save_page_counter
 //-----------------
 0x88,   //  26 LD	CMP00		// save the page counter in CMP00
 0xa8,   //  27 LD	MSB 8
 // :pre_send_cmd_address0
 0xb0,   //  28 LD	LSB 0
 0x8b,   //  29 LD	CMP11		// 1st CMD of WRITE All 0's = 0x80
 0xa1,   //  2a LD	MSB 1		// 2nd CMD of WRITE All 0's = 0x10
 // :pre_send_cmd_address
 0x8a,   //  2b LD	CMP10
  
 //------------------------------------------------------------------
 //		START ADDRESS FOR send command and address
 //	0x1637 is the command, either 0x50, 0x60 or 0x80
 //	0x1638 is the 2nd cmd, either 0x00, 0xD0 or 0x10
 //	0x1639 is the page number
 //	0x1636 is the number of address bytes, either 3 or 4
 //	0x1633-0x1635: The address bytes
 //------------------------------------------------------------------
 // :send_cmd_address
 //---------------- CHECK	ERASE WRITE READ
 // CMD11 = 1st CMD  0x50  0x60  0x80  0x00
 // CMD10 = 2nd CMD  0x50  0xD0  0x10  0x00
 0xa0,   //  2c LD	MSB 0
 0x85,   //  2d LD	ADR_BUFFER01	// clear the high byte of the pointer 0
 0xb1,   //  2e LD	LSB 1
 0x81,   //  2f LD	X		// X = 1
 0xae,   //  30 LD	MSB 14
 0xb6,   //  31 LD	LSB 6
 0x84,   //  32 LD	ADR_BUFFER00	// buffer pointer 0 = 0x00E6
  
 0xa1,   //  33 LD	MSB 1		//data_flash port = output
 0xb9,   //  34 LD	LSB 9		//DATA_FLASH Port driven by FCI  
 0x8d,   //  35 LD	CTRL_FCI	//PARALLEL Port driven by FCI
  
 0xcb,   //  36 LD	A CMP11		// get the 1st command
 0x8c,   //  37 LD	DATA_FLASH	// output the command
  
 0xa0,   //  38 LD	MSB 0
 0xba,   //  39 LD	LSB 10
 0x90,   //  3a LD	DR_PARALLEL	// WE = 1, CLE = 0
 0xbb,   //  3b LD	LSB 11
 0x90,   //  3c LD	DR_PARALLEL	// WE = 1, CLE = 1
 0xb9,   //  3d LD	LSB 9
 0x90,   //  3e LD	DR_PARALLEL	// WE = 0, CLE = 1
 0xbb,   //  3f LD	LSB 11
 0x90,   //  40 LD	DR_PARALLEL	// WE = 1, CLE = 1
 0xba,   //  41 LD	LSB 10
 0x90,   //  42 LD	DR_PARALLEL	// WE = 1, CLE = 0
  
  
  
  
 0xcb,   //  43 LD	A CMP11
 0x8,   //  44 CP	A=>X		// check 1st CMD is 0?
 // JP :latch_address
 0x44,   //  45 JP  4
 0xca,   //  46 LD	A CMP10
 0x8,   //  47 CP	A=>X		// check 2nd CMD is 0?
 // JP :non_write_go_back
 0x5d,   //  48 JP  29
  
 //--------------------------------------------------
 //             START ADDRESS FOR address_latch_cycle
 //--------------------------------------------------
 // :latch_address
 0xa0,   //  49 LD	MSB 0
 0xbe,   //  4a LD	LSB 14
 0x90,   //  4b LD	DR_PARALLEL	// ALE = 1, WE = 1
  
 0xdb,   //  4c LD	A DATA_BUFFER0	// buffer pointer 0 = 0x00E6
 0x26,   //  4d SUB16	ADR_BUFFER0
 0x82,   //  4e LD	Y		// Y = number of address bytes
 0x3c,   //  4f DECY
 0xca,   //  50 LD	A CMP10		// get the 2nd CMD
 0x33,   //  51 EXCHANGE
 0x3b,   //  52 BSET4			// check the 2nd cmd, skip send CA0-7 0 on ERASE (0xD0)
 // JP :send_next_addrss_byte
 0x48,   //  53 JP  8
  
 0xc5,   //  54 LD	A ADR_BUFFER01	// clear A as the first byte, it is always 0
  
 // :loop_send_address
 // -----------------
 0x8c,   //  55 LD	DATA_FLASH
 0xa0,   //  56 LD	MSB 0
 0xbc,   //  57 LD	LSB 12
 0x90,   //  58 LD	DR_PARALLEL	// ALE = 1, WE = 0
 0xbe,   //  59 LD	LSB 14
 0x90,   //  5a LD	DR_PARALLEL	// ALE = 1, WE = 1
  
 // :send_next_addrss_byte
 //---------------------
 0xdb,   //  5b LD	A DATA_BUFFER0	// buffer pointer 0 = 0x00E5, 0x00E4, 0x00E3(only for 4 bytes address)
 0x26,   //  5c SUB16	ADR_BUFFER0
  
 0x3c,   //  5d DECY
 // JP :loop_send_address
 0x69,   //  5e JP  -9
  
 0xba,   //  5f LD	LSB 10		// recover the interface lines
 0x90,   //  60 LD	DR_PARALLEL	// RD = 1, WE = 1
  
 0xcb,   //  61 LD	A CMP11		// get the 1st CMD
 0x33,   //  62 EXCHANGE
 0x3b,   //  63 BSET4			// test the 1st command is the 0x80
 // JP :write_all_zeros
 0x42,   //  64 JP  2
  
 // for non-write command, go back
 //---------------------------------
 // :non_write_go_back
 0x5,   //  65 STATUS	STOP
  
 // :write_all_zeros

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?