⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smc_dtc_format256_end_old.hex

📁 HID-Ukey底层源码实现(st72651芯片) windows上层驱动
💻 HEX
📖 第 1 页 / 共 2 页
字号:
 // *****************************************************************
 // * 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 Mar 22 02:51:10 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
  
 //for 256mb
 //------------
  
 // :clear_cluster_pages
 //-------------------
  
 0xae,   //   0 LD	MSB 14
 0xb3,   //   1 LD	LSB 3
 0x84,   //   2 LD	ADR_BUFFER00	// buffer pointer 0 = 0x00E3
 0xdb,   //   3 LD	A DATA_BUFFER0
 0x2,   //   4 CLC
 0x25,   //   5 ADDER8	X		// increase the page address
 0x9b,   //   6 LD	DATA_BUFFER0	// and save it
  
 0xaf,   //   7 LD MSB 15
 0xbf,   //   8 LD LSB 15
 0x84,   //   9 LD ADR_BUFFER00
 0xdb,   //   a LD A DATA_BUFFER0
 0x2,   //   b CLC
 0x24,   //   c SUB8 X
 0x9b,   //   d LD DATA_BUFFER0
 0x8,   //   e CP	A=>X		// check the page counter
 // JP :chk_cmd
 0x42,   //   f JP  2
  
 // :time_to_go_home
 //--------------- On this point:
  
 0x5,   //  10 STATUS	STOP
  
 // :chk_cmd
 //--------
 0xca,   //  11 LD A CMP10
 0x33,   //  12 EXCHANGE //write 2nd cmd is 0x10 and read 2nd cmd is 0x30
 0x29,   //  13 BCLR2
 // JP :save_page_counter
 0x45,   //  14 JP  5
  
 //LD MSB 10
 //LD LSB 10    //branch to next read page operation
 //BRANCH :loop_read_all_pages
 // JP :time_to_go_home
 0x65,   //  15 JP  -5
  
  
 //entry point for read spare area and read all zeros
 //---------------------------------------------------
 0xa0,   //  16 LD MSB 0 //<<entry point for read and check spare
 0xb,   //  17 CP ALWAYS
 // JP :load_cmd_read_spare1
 0x47,   //  18 JP  7
  
 //LD MSB 15             //<<entry point for write
 //LD LSB 15
 //LD ADR_BUFFER00
 //LD A DATA_BUFFER0   //commented because CMP00 is used below
  
 // :save_page_counter
 //------------------
 //LD CMP00
 0xa8,   //  19 LD MSB 8 
 0xb0,   //  1a LD LSB 0
 0x8b,   //  1b LD CMP11
 0xa1,   //  1c LD MSB 1
 0xb,   //  1d CP ALWAYS
 // JP :load_cmd_2
 0x49,   //  1e JP  9
  
  
 // :load_cmd_read_spare1
 0xb0,   //  1f LD LSB 0
 0x8b,   //  20 LD CMP11
 0xa3,   //  21 LD MSB 3
 //CP ALWAYS             //commented for 2.1 version
 // JP :load_cmd_2
 0x45,   //  22 JP  5
  
 0xa6,   //  23 LD MSB 6 // <<entry point for erase
 0xb0,   //  24 LD LSB 0
 0x8b,   //  25 LD CMP11
 0xad,   //  26 LD MSB 13
  
 // :load_cmd_2
 0x8a,   //  27 LD CMP10
  
 // :send_address
 0xa0,   //  28 LD	MSB 0
 0x85,   //  29 LD	ADR_BUFFER01	// clear the high byte of the pointer 0
 0xb1,   //  2a LD	LSB 1
 0x81,   //  2b LD	X		// X = 1
 0xae,   //  2c LD	MSB 14
 0xb6,   //  2d LD	LSB 6
 0x84,   //  2e LD	ADR_BUFFER00	// buffer pointer 0 = 0x00E6
  
 // :save_addr_bytes
 //-----------------
 0xdb,   //  2f LD	A DATA_BUFFER0
 0x26,   //  30 SUB16	ADR_BUFFER0
 0x82,   //  31 LD	Y		// Load number of addres bytes
 0x3c,   //  32 DECY
  
 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
  
 // :send_cmd
 //---------
 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
  
 //INCY
 //LD A Y
 //CP A=>X
 //JP :latch_address
  
 //CP ALWAYS
 //JP :end_of_second_cmd
  
 // :latch_address
  
 //// Send two byte less if this is an erase operation
 //      DECY                    //added for 2 cmd send
 0xca,   //  43 LD	A CMP10
 0x33,   //  44 EXCHANGE
 0x2b,   //  45 BCLR4
 // JP :Send_Address_Bytes
 0x43,   //  46 JP  3
 0x3c,   //  47 DECY //added for 256mb
 0x3c,   //  48 DECY
  
 // :Send_Address_Bytes
 //------------------
 0xdb,   //  49 LD	A DATA_BUFFER0
 0x26,   //  4a SUB16	ADR_BUFFER0
 0x8c,   //  4b LD	DATA_FLASH	// Send the address byte
 0xbc,   //  4c LD	LSB 12
 0x90,   //  4d LD	DR_PARALLEL	// WE = 0, ALE = 1
 0xbe,   //  4e LD	LSB 14
 0x90,   //  4f LD	DR_PARALLEL	// WE = 1, ALE = 1
 // :Next_Address_Byte
 //-----------------          
 0x3c,   //  50 DECY
 // JP :Send_Address_Bytes
 0x68,   //  51 JP  -8
  
 0xba,   //  52 LD	LSB 10
 0x90,   //  53 LD	DR_PARALLEL	// WE = 1, CLE = 0, ALE = 0, RD = 1
  
 0xca,   //  54 LD A CMP10 //if it is a write cmd
 0x33,   //  55 EXCHANGE
 0x29,   //  56 BCLR2
 // JP :chk_first_cmd
 0x45,   //  57 JP  5
  
 // :send_nxt_read_cmd
 //------------------
 0xca,   //  58 LD A CMP10
 0xb,   //  59 CP ALWAYS
 // JP :send_cmd2
 0x58,   //  5a JP  24
  
 // :end_of_second_cmd
 //------------------
  
 0x5,   //  5b STATUS STOP
  
 // :chk_first_cmd
 //--------------
 0xcb,   //  5c LD A CMP11
 0x33,   //  5d EXCHANGE
 0x2b,   //  5e BCLR4
 // JP :end_of_second_cmd
 0x64,   //  5f JP  -4
  
 // :write_all_zeros
 //---------------           
 0xa4,   //  60 LD MSB 4
 0xb0,   //  61 LD LSB 0
 0x88,   //  62 LD	CMP00			// CMP0 = 0x0840// CMP10 is the 2nd CMD
  
 0xa0,   //  63 LD	MSB 0
 0x84,   //  64 LD	ADR_BUFFER00		// buffer pointer 0 = 0x0000
 0x87,   //  65 LD ADR_BUFFER11
  
 0xb8,   //  66 LD LSB 8
 0x89,   //  67 LD CMP01 
  
 // :loop_write_zeros
 0xb0,   //  68 LD	LSB 0
 0x8c,   //  69 LD	DATA_FLASH
 0xb8,   //  6a LD	LSB 8
 0x90,   //  6b LD	DR_PARALLEL		// WE = 0
 0xba,   //  6c LD	LSB 10
 0x90,   //  6d LD	DR_PARALLEL		// WE = 1
 0x27,   //  6e ADDER16	ADR_BUFFER0
 0xd,   //  6f CP	ADR_BUFFER0<CMP0
 // JP :loop_write_zeros
 0x68,   //  70 JP  -8
  
 //      SUB16 ADR_BUFFER0
 //      LD ADR_BUFFER00     //point to 0xe0
  
 //      LD A DATA_BUFFER0
 //      LD DATA_BUFFER0
 //      LD CMP00
  
 // :send_write_erase_cmd
 //<<entry for erase second
 0xca,   //  71 LD	A CMP10			// get the 2nd CMD
 // :send_cmd2
 //-----------                                     
 //LD Y                            //save to chk the cmd
 0x8c,   //  72 LD	DATA_FLASH

⌨️ 快捷键说明

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