Is it possible to extract the program from an NEC D27128D?

Thread Starter

bluebrakes

Joined Oct 17, 2009
252
I was wondering what would be required, or if its possible, to extract an existing program from an EPROM NEC D27128D?
I use Microchip PICs and a PicStart Plus, but I doubt its compatible. I also realise the output might be in hex, but any helpful clues would be useful.
 

hexreader

Joined Apr 16, 2011
581
I did it using 40 pin dsPIC30F4013 and development board with prototype area and my own software (because that is what was available to me and handy)

The algorithm is simple, but a lot of wiring is needed. Almost any MCU with enough pins and serial interface will do the job.

The professional way is to use an EPROM programmer, which is almost certain to be able to read as well as write.
 

Papabravo

Joined Feb 24, 2006
21,225
There is a slight disconnect here. Most PICs do not use external EPROMS to store program data. Since they have a Harvard architecture with separate program and data memory, and the instruction fetch from program memory is wider than 8 bits, this part is unlikely to contain PIC code. If you have a datasheet for the part it should be possible to construct a test jig to dump the contents into a file. What you do with it after that is entirely up to you.
 

djsfantasi

Joined Apr 11, 2010
9,160
Your second question might be the limiting factor. I didn’t look up your particular EEPROM, but check out its lock bits. Some EEPROMs lock writing but allow reading or prevent both writing and reading.

Oh, and the output WILL be in hex. What else did you expect?
 

Papabravo

Joined Feb 24, 2006
21,225
Your second question might be the limiting factor. I didn’t look up your particular EEPROM, but check out its lock bits. Some EEPROMs lock writing but allow reading or prevent both writing and reading.

Oh, and the output WILL be in hex. What else did you expect?
I don't think external EPROMs have lock bits. It would sort of defeat the purpose of having an external memory device if you could not read the contents. Bit swapping on the data bus is more likely so any attempt to dump the contents might slow an attacker down. Chips with internal program memory having lock bits makes all kinds of sense.
 

djsfantasi

Joined Apr 11, 2010
9,160
I don't think external EPROMs have lock bits. It would sort of defeat the purpose of having an external memory device if you could not read the contents. Bit swapping on the data bus is more likely so any attempt to dump the contents might slow an attacker down. Chips with internal program memory having lock bits makes all kinds of sense.
I don't think external EPROMs have lock bits. It would sort of defeat the purpose of having an external memory device if you could not read the contents. Bit swapping on the data bus is more likely so any attempt to dump the contents might slow an attacker down. Chips with internal program memory having lock bits makes all kinds of sense.
I was wondering that as soon as I hit post reply. Thanks for the clarification.
 

Thread Starter

bluebrakes

Joined Oct 17, 2009
252
Thanks for the responses so far. One possibility to read the memory is to use an Arduino mega, which sounds interesting... https://danceswithferrets.org/geekblog/?p=315

Are there any suitable cheap serial/USB programmers that you could recommend?

The lock state is something that is in the back of mind, especially if I'm going to have to spend a bit of money to get to the point of potentially reading it.
 

Attachments

Papabravo

Joined Feb 24, 2006
21,225
Thanks for the responses so far. One possibility to read the memory is to use an Arduino mega, which sounds interesting... https://danceswithferrets.org/geekblog/?p=315

Are there any suitable cheap serial/USB programmers that you could recommend?

The lock state is something that is in the back of mind, especially if I'm going to have to spend a bit of money to get to the point of potentially reading it.
The abbreviated datasheet, which you found from a source other than the manufacturer, does not mention "lock bits". That is the good news. What doe you expect the contents to look like?
 

danadak

Joined Mar 10, 2018
4,057
Note program code can be stored externally and run out of internal RAM.

Not all PIC families however can do this.


Regards, Dana.
 
Last edited:

MrChips

Joined Oct 2, 2009
30,795
You can read the data out of the EPROM using any facility that can read an EPROM.
If you are so inclined you can build the equipment necessary to read the data.

The data is in binary. All computers (except analog computers) store data in binary.
If you do not understand this concept I can elaborate.
 

MrChips

Joined Oct 2, 2009
30,795
Octal, hexadecimal, decimal, etc. are all human fabrications. The computer does not understand hexadecimal.
The computer works with bits which is inherently binary.
 

danadak

Joined Mar 10, 2018
4,057
To read it and get it into a file I would simply use Arduino Mega (to get enough I/O),
simply write an address out to address lines, and read the output, and using a terminal
session print the address which send it out over UART back to PC. On PC side with a
terminal session open you can do a session with data to file store.

https://danceswithferrets.org/geekblog/?p=315



Regards, Dana.
 

Thread Starter

bluebrakes

Joined Oct 17, 2009
252
Thanks everyone. I have successfully managed to extract the contents of the EPROM to a bin file. :)

I had to write a script to convert the hex output (string) to byte from the output of the Arduino port monitor. This was fairly straightforward. Just take the 32 characters from each line and each pair is a hexadecimal turned into a byte within a file to create a bin file.
 
Top