📄 smc_dtc_upload256_end.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) Sat Mar 22 22:04:00 2003
//===================================================================
//
// SMART MEDIA CARD
//
//===================================================================
//------------
// smc_dtc_up
//------------
//------------------------------------------------------------------
// START ADDRESS FOR read data to USB
// ST7: Give a 3 or 4 bytes address, number of pages
// 0x1632 - 0x1635 = The address, big endien (0x00E2-0x00E5)
// 0x163F = Number of pages (counter), it should be 0 on exit
// On return: Counter = 0 means no error
// Counter !=0 means ECC error on that page
//------------------------------------------------------------------
// :init_command_address
// LD MSB 1 // data_flash port = output
// LD LSB 9 // DATA_FLASH Port driven by FCI
// LD CTRL_FCI // PARALLEL Port driven by FCI
0xa0, // 0 LD MSB 0
0xbf, // 1 LD LSB 15
0x91, // 2 LD DDR_PARALLEL // PA3-0 as output, PA4 as input
0x92, // 3 LD OR_PARALLEL // PA3=/RD, PA2=ALE, PA1=/WE, PA0=CLE
0xaf, // 4 LD MSB 15
0x83, // 5 LD MASK // MASK = 0xFF
0x31, // 6 XOR // A = 0
0x85, // 7 LD ADR_BUFFER01 // clear the high byte of ADR0
// LD A ADR_BUFFER01 // clear A as the first byte, it is always 0
//for 256mb
//----------
0x86, // 8 LD ADR_BUFFER10 // clear low byte of ADR1
0x8a, // 9 LD CMP10 // clear low byte of CMP1
0x9f, // a LD BUFFER_MNGT // clear SEGment offset for using Y on ECC check
0xb1, // b LD LSB 1
0x81, // c LD X // X = 1
0x87, // d LD ADR_BUFFER11
//--------
// :next_page256
//--------------
0xa1, // e LD MSB 1 // data_flash port = output
0xb9, // f LD LSB 9 // DATA_FLASH Port driven by FCI
0x8d, // 10 LD CTRL_FCI // PARALLEL Port driven by FCI
0xc5, // 11 LD A ADR_BUFFER01
0x8c, // 12 LD DATA_FLASH // command Read(1), sequential read
// LD LSB 1
// LD X // X = 1
// LD ADR_BUFFER11
////// Output the sequential read command (0x00)
0xba, // 13 LD LSB 10
0x90, // 14 LD DR_PARALLEL // WE = 1, CLE = 0
0xbb, // 15 LD LSB 11
0x90, // 16 LD DR_PARALLEL // WE = 1, CLE = 1
0xb9, // 17 LD LSB 9
0x90, // 18 LD DR_PARALLEL // WE = 0, CLE = 1
0xbb, // 19 LD LSB 11
0x90, // 1a LD DR_PARALLEL // WE = 1, CLE = 1
0xba, // 1b LD LSB 10
0x90, // 1c LD DR_PARALLEL // WE = 1, CLE = 0
//--------------------------------------------------
// START ADDRESS FOR address_latch_cycle
//--------------------------------------------------
// LD A ADR_BUFFER01 // clear A as the first byte, it is always 0,for 256mb
// LD ADR_BUFFER10 // clear low byte of ADR1
// LD CMP10 // clear low byte of CMP1
// LD BUFFER_MNGT // clear SEGment offset for using Y on ECC check
// :send_address
0xae, // 1d LD MSB 14
0xb6, // 1e LD LSB 06
0x84, // 1f LD ADR_BUFFER00 // buffer pointer 0 = 0x00E6
0xdb, // 20 LD A DATA_BUFFER0
0x82, // 21 LD Y // Y = number of address bytes
0x3c, // 22 DECY
0xbc, // 23 LD LSB 12
0x89, // 24 LD CMP01 // CMP01 = 12, for send address toggling lines
0xbe, // 25 LD LSB 14
0x90, // 26 LD DR_PARALLEL // ALE = 1, WE = 1
// LD A ADR_BUFFER01 // clear A as the first byte, it is always 0,for 256mb
// LD ADR_BUFFER10 // clear low byte of ADR1
// LD CMP10 // clear low byte of CMP1
// LD BUFFER_MNGT // clear SEGment offset for using Y on ECC check
0x26, // 27 SUB16 ADR_BUFFER0 // send address from high byte to low byte
// :loop_send_address
//-----------------
// SUB16 ADR_BUFFER0 // send address from high byte to low byte
0xdb, // 28 LD A DATA_BUFFER0
0x8c, // 29 LD DATA_FLASH // Output the address bytes
0xc9, // 2a LD A CMP01
0x90, // 2b LD DR_PARALLEL // ALE = 1, WE = 0
0xbe, // 2c LD LSB 14
0x90, // 2d LD DR_PARALLEL // ALE = 1, WE = 1
0x26, // 2e SUB16 ADR_BUFFER0 // send address from high byte to low byte
// LD A DATA_BUFFER0
0x3c, // 2f DECY
// JP :loop_send_address
0x68, // 30 JP -8
0xa0, // 31 LD MSB 0
0xba, // 32 LD LSB 10
0x90, // 33 LD DR_PARALLEL // ALE = 0, WE = 1
//---------------------------------------------------
//For 256 MB or 2K page send 0x30 command,
//---------------------------------------------------
0xac, // 34 LD MSB 12 //Set a Flag at 0xc0= 0x00 for the card with 2K page
0xb0, // 35 LD LSB 0
0x82, // 36 LD Y
0xc0, // 37 LD A <Y>
0x82, // 38 LD Y
0x3c, // 39 DECY
// JP :Wait_SMC_Ready
0x4e, // 3a JP 14
//send 0x30 cmd
0xa3, // 3b LD MSB 3
0xb0, // 3c LD LSB 0
0x8c, // 3d LD DATA_FLASH
0xba, // 3e LD LSB 10
0x90, // 3f LD DR_PARALLEL // WE = 1, CLE = 0
0xbb, // 40 LD LSB 11
0x90, // 41 LD DR_PARALLEL // WE = 1, CLE = 1
0xb9, // 42 LD LSB 9
0x90, // 43 LD DR_PARALLEL // WE = 0, CLE = 1
0xbb, // 44 LD LSB 11
0x90, // 45 LD DR_PARALLEL // WE = 1, CLE = 1
0xba, // 46 LD LSB 10
0x90, // 47 LD DR_PARALLEL // WE = 1, CLE = 0
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////
//// Start to read one page
//// 1. Test the READY/BUSY line is ready
//// 2. Wait one of the buffer is free
//// 3. Read the page data
//// 4. Check the ECC
//// 5. Submit the buffer to send the page data
////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// :Wait_SMC_Ready
//--------------
0xc5, // 48 LD A ADR_BUFFER01
0x89, // 49 LD CMP01
0xb2, // 4a LD LSB 2
0x88, // 4b LD CMP00 // CMP0 = 0x0002, will use for RD toggling
0x84, // 4c LD ADR_BUFFER00 // buffer pointer 0 = 0x0002
////// Reset the ECC calculation machine
// LD MSB 0 // data_flash port = intput
0xb9, // 4d LD LSB 9 // DATA_FLASH Port driven by FCI
0x8d, // 4e LD CTRL_FCI // PARALLEL Port driven by FCI
0xa2, // 4f LD MSB 2 // ECC Mode & Reset TMP Reg
0x8d, // 50 LD CTRL_FCI // PARALLEL Port driven by FCI
// :wait_ready_line
//---------------
0x27, // 51 ADDER16 ADR_BUFFER0
0xc, // 52 CP ADR_BUFFER0=>CMP0
// JP :test_busy_line
0x42, // 53 JP 2
0x7, // 54 STATUS STOP ERROR // return with error
// :test_busy_line
//--------------
0xd0, // 55 LD A DR_PARALLEL
0x33, // 56 EXCHANGE
0x28, // 57 BCLR1
// JP :wait_ready_line
0x67, // 58 JP -7
// :Init_Page_Reading
//----------------- // Initialize ADR0 for read ECC
0xc6, // 59 LD A ADR_BUFFER10
0x85, // 5a LD ADR_BUFFER01 // clear high byte of pointer 0
0xaf, // 5b LD MSB 15
0xb8, // 5c LD LSB 8
0x84, // 5d LD ADR_BUFFER00 // ADR0 = 0x00F8, points the ECC memory
////////////////////////////////////////////////////////////////////////////////////
//// Test and wait one of the buffer is full
////////////////////////////////////////////////////////////////////////////////////
0xc7, // 5e LD A ADR_BUFFER11
0x39, // 5f BSET2
// JP :wait_buffer1_full
0x47, // 60 JP 7
0xb1, // 61 LD LSB 1
0x87, // 62 LD ADR_BUFFER11 // buffer pointer 1 = 0x0100
// :wait_buffer0_full
//-----------------
0xdf, // 63 LD A BUFFER_MNGT
0x3a, // 64 BSET3
// JP :wait_buffer0_full
0x62, // 65 JP -2
// JP :read_one_page
0x44, // 66 JP 4
// :wait_buffer1_full
//-----------------
0xdf, // 67 LD A, BUFFER_MNGT
0x3b, // 68 BSET4
// JP :wait_buffer1_full
0x62, // 69 JP -2
// :read_one_page
//-------------
0xc6, // 6a LD A ADR_BUFFER10
0x82, // 6b LD Y // Clear Y
// :read_256_bytes
//--------------
0xb2, // 6c LD LSB 2
0x90, // 6d LD DR_PARALLEL // RD = 0// WE = 1// ALE=CLE=0
0xba, // 6e LD LSB 10
0x90, // 6f LD DR_PARALLEL // RD = 1// WE = 1// ALE=CLE=0
0xcc, // 70 LD A DATA_FLASH // Get the reading data byte
0x9c, // 71 LD DATA_BUFFER1 // Save it in the buffer
0x9d, // 72 LD ECC_CRC // Load to ECC_CRC REG
0xdd, // 73 LD A ECC_CRC // AUTO UPDATE OF Line PARITY 1
0xdd, // 74 LD A ECC_CRC // AUTO UPDATE OF Line PARITY 2
0xdd, // 75 LD A ECC_CRC // AUTO UPDATE OF column PARITY
0x2f, // 76 ADDER16 ADR_BUFFER1
0x3d, // 77 INCY
// JP :read_256_bytes
0x6c, // 78 JP -12
//-------------------
// Save the calculated ECC to 0xF8, 0xF9, 0xFA -- 0xFB, 0xFC, 0xFD
//-------------------
// :read_ecc_calcul
0xde, // 79 LD A TMP_ECC // first read (Line parity 1)
0x9b, // 7a LD DATA_BUFFER0
0xdd, // 7b LD A ECC_CRC // -- INCR CRC_ECC_STATE --
0x27, // 7c ADDER16 ADR_BUFFER0
0xde, // 7d LD A TMP_ECC // second read (Line parity 2)
0x9b, // 7e LD DATA_BUFFER0
0xdd, // 7f LD A ECC_CRC // -- INCR CRC_ECC_STATE --
0x27, // 80 ADDER16 ADR_BUFFER0
0xde, // 81 LD A TMP_ECC // third read ( column parity)
0x9b, // 82 LD DATA_BUFFER0
0x27, // 83 ADDER16 ADR_BUFFER0
0xc7, // 84 LD A ADR_BUFFER11 // The value can be 0010, 0011, 0100, 0101
0x28, // 85 BCLR1
// JP :read_256_bytes
0x7a, // 86 JP -26
//---------------------------------------------
// Read 16 bytes of redundant area from the SMC
// They will be saved in 0xE7-0xF6
//---------------------------------------------
// :init_read_spare
0xbf, // 87 LD LSB 15
0x82, // 88 LD Y // Y = 15
0xae, // 89 LD MSB 14
0xb6, // 8a LD LSB 06
0x84, // 8b LD ADR_BUFFER00 // ADR0 = 0x00E6,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -