Author Topic: D8085AC and D27128D extracting program from EPROM  (Read 1350 times)

0 Members and 1 Guest are viewing this topic.

Offline Dom87Topic starter

  • Contributor
  • Posts: 15
  • Country: gb
D8085AC and D27128D extracting program from EPROM
« on: April 25, 2020, 12:26:38 pm »
Hi folks.

I have an old piece of test equipment that uses an old school D8085AC processor and what appears to be a NEC D27128D as its EPROM.
I was wondering how difficult it would be to extract the instructions from the D27128D and turn it into something meaningful, like assembly, that I could use to start figuring out the functionality.

Thanks
 

Offline Deni

  • Regular Contributor
  • *
  • Posts: 70
  • Country: hr
Re: D8085AC and D27128D extracting program from EPROM
« Reply #1 on: April 25, 2020, 04:25:25 pm »
Reading out EPROM is easy - there are many device programmers on the market, you can even build your own one usind Arduino, for example.
The next step, disassembly, shoudl be simple too - there are many disassemblers for 8080/85. Analyzing disassembled code - well, that's up to your skills and persistence...
 

Offline Dom87Topic starter

  • Contributor
  • Posts: 15
  • Country: gb
Re: D8085AC and D27128D extracting program from EPROM
« Reply #2 on: May 08, 2020, 09:59:50 pm »
Thanks Deni.

I found this article here from a blog called Dances with Ferrets...  ;D https://danceswithferrets.org/geekblog/?p=315 and I now created an extract.
Is there any particular disassembler you would recommend?
 

Offline eblc1388

  • Frequent Contributor
  • **
  • Posts: 400
  • Country: gb
Re: D8085AC and D27128D extracting program from EPROM
« Reply #3 on: May 09, 2020, 02:20:54 am »
Hi Dom87,

The author's Eprom reader in your above link generate a hex dump with ASCII, which is then send to your serial port on the PC. Therefore, each 8-bit Eprom data is sent as two ascii bytes, and the text file you can then capture in the terminal.

However, most disassembler would only accept a true binary file image for disassembling. You will then need to do a lot of editing before the disassembler will accept it. You can modify the Arduino sketch to transfer the HEX data continuously without extra data like ascii representation, linefeed or carriage return, but then you still need to process the captured file into a true binary file.

I don't know if one can send a binary values of 0x00~0xFF directly via the serial port.

Regarding the disassembler, I would recommend the DASMx Version 1.40. Just search for "DASMx Version 1.40" in Google.

edit: added disassembler info
« Last Edit: May 09, 2020, 03:21:42 am by eblc1388 »
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8387
Re: D8085AC and D27128D extracting program from EPROM
« Reply #4 on: May 09, 2020, 02:48:46 am »
I don't know if one can send a binary value of 0x00~0xFF directly via the serial port.
Yes you can, but you'd need some sort of framing protocol like PPP, HDLC, or SLIP. Otherwise it's just a stream of bytes.
 

Offline Dom87Topic starter

  • Contributor
  • Posts: 15
  • Country: gb
Re: D8085AC and D27128D extracting program from EPROM
« Reply #5 on: May 09, 2020, 10:27:22 am »
Thanks everyone. I think I have successfully converted the HEX/ASCII output from serial monitor (Arduino software).
I copy and pasted all of the text from the monitor window and used a script I wrote to convert the string hex representation to a byte within the file.


Code: [Select]
void Main()
{
string filePath = @"F:\epromreadingfromarduino.txt";
string[] rawLines = File.ReadAllLines(filePath);

string dirPath = Path.GetDirectoryName(filePath);
string fileName = Path.GetFileNameWithoutExtension(filePath);

string binFile = $"{dirPath}\\{fileName}.bin";

List<byte> bytesList = new List<byte>();

foreach(var line in rawLines)
{
if(line.Equals("Reading ROM ...", StringComparison.OrdinalIgnoreCase) || string.IsNullOrWhiteSpace(line)) continue;

var lineData = line.Substring(0,32);
var bytes = ConvertHexStringToByteArray(lineData);
bytesList.AddRange(bytes);
}


ByteArrayToFile(binFile, bytesList.ToArray());

}

// Define other methods and classes here
private static byte[] ConvertHexStringToByteArray(string hexString)
{
return Enumerable
.Range(0, hexString.Length / 2)
.Select(i => Convert.ToByte(hexString.Substring(i * 2, 2), 16))
.ToArray();
}

public bool ByteArrayToFile(string fileName, byte[] byteArray)
{
try
{
using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write))
{
fs.Write(byteArray, 0, byteArray.Length);
return true;
}
}
catch (Exception ex)
{
Console.WriteLine("Exception caught in process: {0}", ex);
return false;
}
}


The file went from looking like this...
987234-0

To this, in a hex editor...
987238-1

Hopefully that is correct.  :)
 

Offline Dom87Topic starter

  • Contributor
  • Posts: 15
  • Country: gb
Re: D8085AC and D27128D extracting program from EPROM
« Reply #6 on: May 09, 2020, 10:43:24 am »
Thanks for the suggestion of 'DASMx Version 1.40'.
I have just given it a go, and it seems to have done the trick. It certainly it didn't complain about the file.

Code: [Select]
λ dasmx -c8085 reading_20200507_1926.bin

DASMx object code disassembler
==============================
(c) Copyright 1996-2003   Conquest Consultants
Version 1.40 (Oct 18 2003)

CPU: Intel 8085 (MCS-80/85 family)
Source file length: 16384 bytes
Pass 1...
Pass 2...

987266-0


Now it looks like the arduous task of working out what is going on in the instructions.   :-//  :-/O :)

Thanks for your help.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf