Changes

Jump to: navigation, search

FlashGordon

No change in size, 17:50, 29 April 2020
/* Writing to flash memory */
The memory chip used is an SST 39SF040. This is a flash memory chip that is smarter than a simple ROM or RAM. You talk to it by sending commands to exectute execute (but reading works as usual).
*Connect ROM number 1 and write 0xAA to address 0xD555
*Connect ROM number 2 and write 0x55 to address 0xEAAA
*At this point, the flahs flash is waiting for a command to execute. The available commands are ERASE (0x80), IDENTIFY (0x90), BYTE PROGRAM (0xA0) and RESET (0xF0)
*To erase a sector, send the ERASE command by writing 0x80 to address 0xD555 in ROM 1. Now write once again 0xAA to address 0xD555 in ROM number 1 and 0x55 to address 0xEAAA in ROM number 2. Then, write 0x30 anywhere in the sector you want to erase. Erasing will take up to 20 milliseconds, so wait to make sure the flash is ready to accept another command.
*To write a byte, write 0xA0 (BYTE PROGRAM) to address 0xD555 in ROM 1. Then, connect the ROM you want to program and write one byte at the needed address. There is a delay of 20 NOPs after a write operation, that should be no problem as you can use them to prepare the write operation for the next byte (by the time you're ready to execute the next write to the ROM, it will be ready to listen).
*If you enter identify mode, you can read two bytes to learn about the manufacturer and model of the flash chip. This can be used to identify FlashGordon versus the MegaFlash (which will return different values), a Ramcard (too late, you already corrupted some data), or a plain old romboard (all your attemps attempts to write are vain and bound to fail).
*There is also a command for a complete chip erase if you want to clear everything.
2,063
edits