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

📄 smc_dtc_copypages256_end.hex

📁 HID-Ukey底层源码实现(st72651芯片) windows上层驱动
💻 HEX
字号:
 // *****************************************************************
 // * 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) Mon Sep 26 17:56:49 2005


 //===================================================================
 //
 //                    SMART MEDIA CARD
 //
 //===================================================================
  
 //----------------------
 // dtc_smc_copy_page.fsm
 //----------------------
  
 //--------------------------
 //init_write_number_of_block
 //--------------------------
  
 0xa0,   //   0 LD MSB 0
 0xb1,   //   1 LD LSB 1
 0x81,   //   2 LD X			// X<=1
  
 0xb0,   //   3 LD LSB 0
 0x85,   //   4 LD ADR_BUFFER01
 0x88,   //   5 LD CMP00
 0x9f,   //   6 LD BUFFER_MNGT
  
 //-----------------
 //init_dtc_ctrl_reg
 //-----------------
  
 0xa1,   //   7 LD MSB 1			// data_flash port = output   
 0xb9,   //   8 LD LSB 9			// DATA_FLASH Port driven by FCI 
 0x8d,   //   9 LD CTRL_FCI		// PARALLEL Port driven by FCI
  
 //-------------------------------
 //command_latch_cycle (Read1 CMD)
 //-------------------------------
  
 //      LD MSB 0
 //      LD LSB 0
 0xc5,   //   a LD A ADR_BUFFER01
 0x8c,   //   b LD DATA_FLASH
  
 //      LD MSB 0
 0xba,   //   c LD LSB 10
 0x90,   //   d LD DR_PARALLEL
 0xbb,   //   e LD LSB 11
 0x90,   //   f LD DR_PARALLEL
 0xb9,   //  10 LD LSB 9
 0x90,   //  11 LD DR_PARALLEL
 0xbb,   //  12 LD LSB 11
 0x90,   //  13 LD DR_PARALLEL
  
 //send address, set ALE high
 //------------------------------
 0xbe,   //  14 LD LSB 14
 0x90,   //  15 LD DR_PARALLEL
  
 //-------------------------
 // read_address_latch_cycle
 //-------------------------
  
 //read_address_latch_cycle_nb_Bytes
 //--------------------------------- 
  
 0xae,   //  16 LD	MSB 14
 0xb6,   //  17 LD	LSB 06
 0x84,   //  18 LD	ADR_BUFFER00	// buffer pointer 0 = 0x00E6
 0xdb,   //  19 LD	A DATA_BUFFER0
 0x82,   //  1a LD	Y		// Y = number of address bytes
 0x3c,   //  1b DECY
 0x26,   //  1c SUB16	ADR_BUFFER0	// send address from high byte to low byte
  
 // :loop_send_address
 //-----------------
 0xdb,   //  1d LD	A DATA_BUFFER0
 0x8c,   //  1e LD	DATA_FLASH	// Output the address bytes
 0xbc,   //  1f LD	LSB 12
 0x90,   //  20 LD	DR_PARALLEL	// ALE = 1, WE = 0
 0xbe,   //  21 LD	LSB 14
 0x90,   //  22 LD	DR_PARALLEL	// ALE = 1, WE = 1
 0x26,   //  23 SUB16	ADR_BUFFER0	// send address from high byte to low byte
 0x3c,   //  24 DECY
 // JP :loop_send_address
 0x68,   //  25 JP  -8
  
 0xba,   //  26 LD	LSB 10
 0x90,   //  27 LD	DR_PARALLEL	// ALE = 0, WE = 1
 //end of send address
 //---------------------
 //wait_read1_addr_ready
 //---------------------
 0xa3,   //  28 LD MSB 3
 0xb5,   //  29 LD LSB 5
 0x8c,   //  2a LD DATA_FLASH
  
 0xbb,   //  2b LD LSB 11
 0x90,   //  2c LD DR_PARALLEL
 0xb9,   //  2d LD LSB 9
 0x90,   //  2e LD DR_PARALLEL
 0xbb,   //  2f LD LSB 11
 0x90,   //  30 LD DR_PARALLEL
 0xba,   //  31 LD LSB 10
 0x90,   //  32 LD DR_PARALLEL
  
 // :wait_read1_addr_ready
 //---------------------
 //      NOP
 //      NOP
 //:read1_addr_no_timeout
 //---------------------
 0xd0,   //  33 LD A DR_PARALLEL
 0x33,   //  34 EXCHANGE
 0x28,   //  35 BCLR1			// test R/B
 // JP :wait_read1_addr_ready
 0x63,   //  36 JP  -3
  
 //send next command for copy operation 0x85
 //-------------------------------------------
 0xa8,   //  37 LD MSB 8
 0xb5,   //  38 LD LSB 5
 0x8c,   //  39 LD DATA_FLASH
  
 0xbb,   //  3a LD LSB 11
 0x90,   //  3b LD DR_PARALLEL
 0xb9,   //  3c LD LSB 9
 0x90,   //  3d LD DR_PARALLEL
 0xbb,   //  3e LD LSB 11
 0x90,   //  3f LD DR_PARALLEL
  
 //send address bytes
 0xbe,   //  40 LD LSB 14
 0x90,   //  41 LD DR_PARALLEL
  
 //send the address of destination block
 //--------------------------------------
 // :send_address
 //-------------
 0xae,   //  42 LD	MSB 14
 0xb6,   //  43 LD	LSB 06
 0x84,   //  44 LD	ADR_BUFFER00	// buffer pointer 0 = 0x00E6
 0xdb,   //  45 LD	A DATA_BUFFER0
 0x82,   //  46 LD	Y		// Y = number of address bytes
 0x3c,   //  47 DECY
 0x27,   //  48 ADDER16	ADR_BUFFER0	// send address from high byte to low byte
  
 // :loop_send_address1
 //-----------------
 0xdb,   //  49 LD	A DATA_BUFFER0
 0x8c,   //  4a LD	DATA_FLASH	// Output the address bytes
 0xbc,   //  4b LD	LSB 12
 0x90,   //  4c LD	DR_PARALLEL	// ALE = 1, WE = 0
 0xbe,   //  4d LD	LSB 14
 0x90,   //  4e LD	DR_PARALLEL	// ALE = 1, WE = 1
  
 0x27,   //  4f ADDER16	ADR_BUFFER0	// send address from high byte to low byte
 0x3c,   //  50 DECY
 // JP :loop_send_address1
 0x68,   //  51 JP  -8
  
 0xba,   //  52 LD	LSB 10
 0x90,   //  53 LD	DR_PARALLEL	// ALE = 0, WE = 1
 //end of send address
 //---------------------
  
 //chk if the first page is not from the start of coloumn
 //-------------------------------------------------------
 //chk the flag set in the 0xfd to get the no. of blocks
 //-------------------------------------------------------
 0xaf,   //  54 LD MSB 15
 0xbd,   //  55 LD LSB 13
 0x84,   //  56 LD ADR_BUFFER00
  
 0xc5,   //  57 LD A ADR_BUFFER01
 0x87,   //  58 LD ADR_BUFFER11
 0x86,   //  59 LD ADR_BUFFER10		// ADR1 = 0x0000
  
 0xdb,   //  5a LD A DATA_BUFFER0
 0x27,   //  5b ADDER16 ADR_BUFFER0
 0x27,   //  5c ADDER16 ADR_BUFFER0	// point ADR0 = 0x00ff
 0x38,   //  5d BSET1
 // JP :chk_nxt_bit
 0x46,   //  5e JP  6
  
 0x39,   //  5f BSET2
 // JP :2_block_ff
 0x4a,   //  60 JP  10
 0xa0,   //  61 LD MSB 0
 0xb0,   //  62 LD LSB 0
 //      JP :start_pgm_cycle
 0x60,   //  63 BRANCH :start_pgm_cycle
  
 // :chk_nxt_bit
 0x39,   //  64 BSET2
 // JP :3_block_ff
 0x49,   //  65 JP  9
  
 // :1_block_ff
 //--------------
 0xb2,   //  66 LD LSB 2
 0x8b,   //  67 LD CMP11			// only one block so CMP1 = 0x210 = 528 bytes
  
 0xa1,   //  68 LD MSB 1
 // JP :send_ff
 0x48,   //  69 JP  8
  
 // :2_block_ff
 //------------
 0xb4,   //  6a LD LSB 4
 0x8b,   //  6b LD CMP11
  
 0xa2,   //  6c LD MSB 2
 // JP :send_ff
 0x44,   //  6d JP  4
  
 // :3_block_ff
 //-----------
 0xb6,   //  6e LD LSB 6
 0x8b,   //  6f LD CMP11
  
 0xa3,   //  70 LD MSB 3			//CMP1 = 0x630
  
 // :send_ff
 0xb0,   //  71 LD LSB 0
 0x8a,   //  72 LD CMP10
  
 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 0xa8,   //  73 LD MSB 8
 0xb5,   //  74 LD LSB 5
 0x8c,   //  75 LD DATA_FLASH
  
 0xbb,   //  76 LD LSB 11
 0x90,   //  77 LD DR_PARALLEL
 0xb9,   //  78 LD LSB 9
 0x90,   //  79 LD DR_PARALLEL
 0xbb,   //  7a LD LSB 11
 0x90,   //  7b LD DR_PARALLEL
  
 //send address bytes
 0xbe,   //  7c LD LSB 14
 0x90,   //  7d LD DR_PARALLEL
  
 //send the address of destination block
 //--------------------------------------
 0xae,   //  7e LD	MSB 14
 0xb6,   //  7f LD	LSB 06
 0x84,   //  80 LD	ADR_BUFFER00	// buffer pointer 0 = 0x00E6
 0xdb,   //  81 LD	A DATA_BUFFER0
 0x82,   //  82 LD	Y		// Y = number of address bytes
 0x3c,   //  83 DECY
 0x27,   //  84 ADDER16	ADR_BUFFER0	// send address from high byte to low byte
  
 // :loop_send_address2
 //-----------------
 0xdb,   //  85 LD	A DATA_BUFFER0
 0x8c,   //  86 LD	DATA_FLASH	// Output the address bytes
 0xbc,   //  87 LD	LSB 12
 0x90,   //  88 LD	DR_PARALLEL	// ALE = 1, WE = 0
 0xbe,   //  89 LD	LSB 14
 0x90,   //  8a LD	DR_PARALLEL	// ALE = 1, WE = 1
  
 0x27,   //  8b ADDER16	ADR_BUFFER0	// send address from high byte to low byte
 0x3c,   //  8c DECY
 // JP :loop_send_address2
 0x68,   //  8d JP  -8
  
 0xba,   //  8e LD	LSB 10
 0x90,   //  8f LD	DR_PARALLEL	// ALE = 0, WE = 1
 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
 //write data on to page, generate 528 write pulses
 //------------------------------------------------
 //:gen_more_pulses
 //---------------
  
 // :write_dat_sec
 //-------------
 0xc4,   //  90 LD A ADR_BUFFER00
 0x8c,   //  91 LD DATA_FLASH
  
 0xb8,   //  92 LD LSB 8
 0x90,   //  93 LD DR_PARALLEL
  
 0xba,   //  94 LD LSB 10
 0x90,   //  95 LD DR_PARALLEL
  
 0x2f,   //  96 ADDER16 ADR_BUFFER1
 0xf,   //  97 CP ADR_BUFFER1<CMP1
 // JP :write_dat_sec
 0x68,   //  98 JP  -8
  
 //----------------------------
 // :Page_Pgm_command_latch_cycle
 //----------------------------
  
 // :start_pgm_cycle
 //----------------
 0xa1,   //  99 LD MSB 1
 0xb0,   //  9a LD LSB 0
 0x8c,   //  9b LD DATA_FLASH		// Send CMD: 0x10
  
 0xbb,   //  9c LD LSB 11
 0x90,   //  9d LD DR_PARALLEL
 0xb9,   //  9e LD LSB 9
 0x90,   //  9f LD DR_PARALLEL
 0xbb,   //  a0 LD LSB 11
 0x90,   //  a1 LD DR_PARALLEL
 0xba,   //  a2 LD LSB 10
 0x90,   //  a3 LD DR_PARALLEL
  
 //---------------------------
 // read_status & check_status
 //---------------------------
 // :wait_card_ready
 //---------------
 //      NOP
 //      NOP
 0xd0,   //  a4 LD A DR_PARALLEL
 0x33,   //  a5 EXCHANGE
 0x28,   //  a6 BCLR1			// test R/B
 // JP :wait_card_ready
 0x63,   //  a7 JP  -3
  
 //-------------------------------
 0xa7,   //  a8 LD MSB 7			// read_status_command_latch_cycle
 0xb0,   //  a9 LD LSB 0
 0x8c,   //  aa LD DATA_FLASH
  
 0xbb,   //  ab LD LSB 11
 0x90,   //  ac LD DR_PARALLEL
 0xb9,   //  ad LD LSB 9
 0x90,   //  ae LD DR_PARALLEL
 0xbb,   //  af LD LSB 11
 0x90,   //  b0 LD DR_PARALLEL
 0xba,   //  b1 LD LSB 10
 0x90,   //  b2 LD DR_PARALLEL
  
 // :init_read_status_seq
 //---------------------
 0xb9,   //  b3 LD LSB 9			// DATA_FLASH Port driven by FCI  
 0x8d,   //  b4 LD CTRL_FCI		// PARALLEL Port driven by FCI
  
 // :read_status_seq
 //----------------
 0xb2,   //  b5 LD LSB 2
 0x90,   //  b6 LD DR_PARALLEL
 0xba,   //  b7 LD LSB 10
 0x90,   //  b8 LD DR_PARALLEL
 0xcc,   //  b9 LD A DATA_FLASH		// load DATA_FLASH
  
 0x28,   //  ba BCLR1			// check_status
 // JP :no_error
 0x42,   //  bb JP  2
  
 // :error_status
 //------------
 0x7,   //  bc STATUS ERROR STOP
  
 // :no_error
 //------------
 //end_of_block
 //------------
  
 0xdb,   //  bd LD A DATA_BUFFER0		// ADR0 = 0x00ff, contains 2K page pointer
 0x8,   //  be CP A=>X
 // JP :dec_512_page
 0x42,   //  bf JP  2
  
 // :stop
 0x5,   //  c0 STATUS STOP		// if 0 then stop
 //-------------------------------
 //-------------------------------
 // :dec_512_page
  
 0xa0,   //  c1 LD MSB 0
 0xb4,   //  c2 LD LSB 4
 0x82,   //  c3 LD Y
  
 0x26,   //  c4 SUB16 ADR_BUFFER0
 0xdb,   //  c5 LD A DATA_BUFFER0
 0x2,   //  c6 CLC
 0x2c,   //  c7 SUB8 Y			// decrement by 4
 0x9b,   //  c8 LD DATA_BUFFER0
  
 //---------------
 //:increment_page
 //--------------- 
 //// Decrease the page number and increase the page address
 0xae,   //  c9 LD MSB 14
 0xb3,   //  ca LD LSB 3
 0x82,   //  cb LD Y
  
 // :next_page
 //-----------------------------------
 0xc0,   //  cc LD A <Y>
 0x2,   //  cd CLC
 0x25,   //  ce ADDER8 X
 0x80,   //  cf LD <Y>			// Increase the page address and save it back
 0xae,   //  d0 LD MSB 14
 0xb9,   //  d1 LD LSB 9
 0x82,   //  d2 LD Y
 0xc0,   //  d3 LD A <Y>
 0x2,   //  d4 CLC
 0x25,   //  d5 ADDER8 X
 0x80,   //  d6 LD <Y>
 0x3c,   //  d7 DECY			//Y = 0xe8
 // JP :end_of_page
 0x5f,   //  d8 JP  31
  
 // :last_page
 //---------------
 0x26,   //  d9 SUB16 ADR_BUFFER0		// ADR0 =0xfe
 0xdb,   //  da LD A DATA_BUFFER0
 0x9,   //  db CP A<X
 // JP :stop
 0x7c,   //  dc JP  -28
  
 // :partial_page_pgm
 //-----------------
 0x26,   //  dd SUB16 ADR_BUFFER0		// ADR0 = 0xfd
 0x38,   //  de BSET1
 // JP :chk_nxtbit
 0x43,   //  df JP  3
  
 0x39,   //  e0 BSET2
 // JP :2_block_extra
 0x4a,   //  e1 JP  10
  
 // :chk_nxtbit
 0x39,   //  e2 BSET2
 // JP :1_block_extra
 0x4e,   //  e3 JP  14
  
 // :3_block_extra
 0xb3,   //  e4 LD LSB 3
 0x9b,   //  e5 LD DATA_BUFFER0
  
 0xb2,   //  e6 LD LSB 2
 0x8b,   //  e7 LD CMP11			// col 1
  
 0xa1,   //  e8 LD MSB 1
 0xb,   //  e9 CP ALWAYS
 // JP :end1
 0x46,   //  ea JP  6
  
 // :2_block_extra
 0xb2,   //  eb LD LSB 2
 0x9b,   //  ec LD DATA_BUFFER0
  
 0xb4,   //  ed LD LSB 4
 0x8b,   //  ee LD CMP11			// col 1
  
 0xa2,   //  ef LD MSB 2
  
 // :end1

⌨️ 快捷键说明

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