Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emulating an AT27C256 #8

Closed
InPermutation opened this issue Apr 7, 2021 · 5 comments
Closed

Emulating an AT27C256 #8

InPermutation opened this issue Apr 7, 2021 · 5 comments

Comments

@InPermutation
Copy link

Please consider this a draft note-to-self, since I don't have time tonight to write a pull request.

The pinout between an AT27C256 and a 28256 differs in that the EEPROM's A14 is on pin 1, with /WE on pin 27, while the 28256 EPROM has Vdd on pin 1 and A14 on pin 27.

So, since in the EPROM-EMU-NG, pin 1 is A15, and A14 will be held high ("write enable" not asserted), we can write a little Python script to convert a 32K binary file into a 64K file padded with junk in addresses 0000:3FFF and 8000:c000:

#!/usr/bin/env python3

import sys

if __name__ == "__main__":
    with open(sys.argv[1], "rb") as infile:
        data = infile.read()
        assert len(data) == 0x8000, f"len must be {0x8000}; was {len(data)}"
    with open(sys.argv[2], "wb") as outfile:
        outfile.write(b'\xff' * 0x4000) # junk
        outfile.write(data[0:0x4000])
        outfile.write(b'\xff' * 0x4000)  # junk
        outfile.write(data[0x4000:0x8000])

then write it out like usual:

% python3 EPROM_NG_v2.0rc3.py -mem 27512 -spi y -auto y ./a512.out /dev/tty.usbserial-1410 -start 0 -map y

I used a TL866 II+ with minipro to confirm that this reads correctly as a 27C256:

% minipro -p AT28C256 -r a.test

And, I attached it in place of the EEPROM of my Ben Eater 6502, and it boots up correctly!

@InPermutation
Copy link
Author

Data writes at about 1.6 kbps, so we can speed this up by not even writing the junk bytes. First optimization: use the -start 4000 parameter, and remove the first # junk line.

Second optimization: write two separate files, write at -start 4000 and -start c000. (todo: check math)

@InPermutation
Copy link
Author

InPermutation commented Apr 7, 2021

The downside to the second optimization is that RST/ goes high for a fraction of a second between the two runs, which could cause undesired operation of the target computer.

@Kris-Sekula
Copy link
Owner

Hey Jacob, great job investigating. I sent you an email, try that if you get a chance and let me know if your BE6502 boots... if it does I'll publish the files for others to try.

@Kris-Sekula
Copy link
Owner

The newly released (experimental) version of firmware and software now has EEPROM support included:
Firmware 2.0rc8 (EPROM_EMU_NG_FW_2.0rc8.ino - Arduino sketch in Firmware folder)
Software 2.0rc8 (EPROM_EMU_NG_2.0rc8.py - Python script in Software folder)

@InPermutation
Copy link
Author

The new firmware works great, thanks @Kris-Sekula!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants