element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Project Videos
  • Challenges & Projects
  • element14 presents
  • Project Videos
  • More
  • Cancel
Project Videos
Documents Emulate an EPROM - How Hard Could it Be? -- Episode 517
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Project Videos to participate - click to join for free!
Related
Recommended
Engagement
  • Author Author: kellyhensen
  • Date Created: 12 Mar 2019 8:18 PM Date Created
  • Last Updated Last Updated: 24 Sep 2021 7:24 AM
  • Views 4416 views
  • Likes 12 likes
  • Comments 10 comments

Emulate an EPROM - How Hard Could it Be? -- Episode 517

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

The Apple IIe uses a custom microcontroller and ROM chip to put ASCII values into the computer’s memory. How hard could it be to replace that dual-chip setup with a microcontroller to emulate another kind of keyboard? Bald Engineer tries using an Arduino Mega 2560, Teensy 4.0, and a Pi Pico to replace a vintage ROM chip. See what works AND what does not!

 

In the attached zip file are:

 

  • KiCad files for the ROM Interposer Board
  • Arduino code for ROM test
  • Teensy code to test interrupt latency
  • Python code that can respond to an Output Enable signal

 

A couple of notes that keep coming up:

 

Q: Why do you need to emulate a ROM chip anyway?

A: Like most 8-bit computers, the keyboard interface eventually talks directly to the memory bus. In an Apple IIe (and IIc), that is done through a ROM chip.

 

Q: Why not just replace the keyboard matrix?

A: The final design will not use the original keyboard microcontroller or ROM. Ideally, I want to have an interface for a USB keyboard (and possibly Apple Desktop Bus: ADB.)

 

Q: The Teensy was only 200 nanoseconds, why not just use that?

A: The Mini-Apple IIe is based on the MEGA-II ASIC from an Apple IIgs. Its timing is tighter and slightly different from the Apple IIe’s MMU. The Teensy is slightly too slow.

 

Q: What is “Golden Delicious”?

A: Originally, I was naming this project “Golden Delicious.” So, let’s call it a code name. Now, I call it “Mini Apple IIe.” But, the final project has a different name.

 

Supplemental Content:

 

  • Workbench Wednesday 18: Digilent Analog Discovery Review
  • Workbench Wednesday 16: Instrument Basics: Logic Analyzer
  • Keyboard ROM (26-pin) Interposer Board: https://github.com/baldengineer/Golden-Delicious/tree/master/kicad%20files/ROM%20Interposer%20board

 

Bill of Material:

 

Product Name Manufacturer Quantity Buy Kit
Pi Pico (RP2040) Raspberry Pi Foundation 1 Buy Now
Mega 2560 Arduino 1 Buy Now
Analog Discovery 2 Digilent 1 Buy Now
Digital Discovery Digilent 1 Buy Now

 

Additional Parts:

 

Product Name
Teensy 4.0 from PJRC

 



Attachments:
emulating_rom_with_mcu_v2.zip
element14 presents

element14 Presents  |  About James|  Project Videos

  • emulating rom
  • baldengineer
  • raspberry pi pico
  • e14p_JBE
  • apple
  • apple iie
  • eprom
  • e14presents_baldengineer
  • masked rom
  • raspberry pi
  • digilent
  • element14 presents
  • how hard can it be
  • james
  • teensy
  • arduino
  • friday_release
  • pi pico
  • Share
  • History
  • More
  • Cancel
Actions
  • Share
  • More
  • Cancel
  • Sign in to reply

Top Comments

  • baldengineer
    baldengineer over 3 years ago +5
    Related Live Streams Check out these live streams for even more details on how I figured out the EPROM stuff. These are all part of an ongoing live stream series where I am designing a mini Apple IIe using…
  • mayermakes
    mayermakes over 3 years ago +4
    you call that easy??? Thats alot of work with some tight thinking here, I'm sure it would be a lot harder for me. Now I need to get into how to use these PIOs of the RP2040....
  • baldengineer
    baldengineer over 3 years ago in reply to DAB +3
    I think so. There are a couple of microcontrollers with a similar feature or capability. Each vendor calls it something else. The unique combination here was the support in CircuitPython. Being able to…
Parents
  • juanpc2021
    juanpc2021 over 3 years ago

    Arduino is a High Level Lenguaje,
    but AVR allows to write directly to pins at MHz / 2 speeds "ultra fast".

    it seems very strange when you say AVR is Not fast enoigh...
    if you only want to create a Keyboard translator with LUT.
    also AVR has EPROM, RAM, and Flash Memory,even more confusing..

    There are many projects usign HW card readers to automatically type passwords on a keybaord, and stuff...

    i don't understand your projects, too over-simplified for a begginer...
    your audience has developed Telepathy.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • baldengineer
    baldengineer over 3 years ago in reply to juanpc2021

    No, it has nothing to do with the Arduino library (it isn't a language) nor how fast you can directly read/write the GPIO pins.

    The fundamental problem is that it takes a minimum of 1.5 microseconds for an AVR to respond to an interrupt. In the case of the Apple IIe's keyboard access, we have less than 500 nanoseconds to respond and output a value. (And then less than 10ns to get back off the bus.)

    The best case for an AVR is 1.5 microseconds. The Arduino library adds about another microsecond of overhead.

    i don't understand your projects, too over-simplified for a begginer ...

    I'm sorry you feel that way. But the point of this video was not to explain the entire project. The point was to show the steps I went through to solve one specific problem of a much larger project.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • juanpc2021
    juanpc2021 over 3 years ago in reply to baldengineer

    interrupts create latency, required for multitasking.
    500ns requires 2MHz
    https://www.unitjuggler.com/convert-frequency-from-ns(p)-to-Hz.html?val=500

    AVR has 16MHz XO standard,
    most AVR instructions have 2 clocks per cicle... some 3, some 4,
    but can be overclocked to 20MHz "most people do, in complex projects."

    ...
    AVR has a 8 clocks available "heardroom" at 16Mhz and 500ns,
    see my point? very confusing...

    • Cancel
    • Vote Up -1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • baldengineer
    baldengineer over 3 years ago in reply to juanpc2021

    That's great. Except, I can't rely on polling the "OUTPUT ENABLE" signal if the microcontroller is going to do anything else (like interface to a keyboard.)

    I need an interrupt. The AVR datasheet says:

    The interrupt execution response for all the enabled AVR interrupts is five clock cycles minimum.
    After five clock cycles the program vector address for the actual interrupt handling routine is executed.
    During these five clock cycle period, the Program Counter is pushed onto the Stack. The
    vector is normally a jump to the interrupt routine, and this jump takes three clock cycles. If an
    interrupt occurs during execution of a multi-cycle instruction, this instruction is completed before
    the interrupt is served.

    There is a minimum of 5 clocks (312 nanoseconds) and up to 8 clocks (500 nanoseconds) as a MINIMUM latency. That's assuming the processor can even start servicing the interrupt on the next clock. So at a MINIMUM, it will take longer to get into an ISR than I have to service it. And even if I could get into the ISR within the 5 clocks, I only have 3 single-cycle instructions left (at best) to do something.

    Yes, I could get into the ISR faster without the Arduino library. (Which then means I have to write *everything* from scratch. Wow.) And even if I did that, it still IS NOT FAST ENOUGH.

    So, none of your math on how fast you can toggle a pin matters.

    See MY point?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • baldengineer
    baldengineer over 3 years ago in reply to juanpc2021

    That's great. Except, I can't rely on polling the "OUTPUT ENABLE" signal if the microcontroller is going to do anything else (like interface to a keyboard.)

    I need an interrupt. The AVR datasheet says:

    The interrupt execution response for all the enabled AVR interrupts is five clock cycles minimum.
    After five clock cycles the program vector address for the actual interrupt handling routine is executed.
    During these five clock cycle period, the Program Counter is pushed onto the Stack. The
    vector is normally a jump to the interrupt routine, and this jump takes three clock cycles. If an
    interrupt occurs during execution of a multi-cycle instruction, this instruction is completed before
    the interrupt is served.

    There is a minimum of 5 clocks (312 nanoseconds) and up to 8 clocks (500 nanoseconds) as a MINIMUM latency. That's assuming the processor can even start servicing the interrupt on the next clock. So at a MINIMUM, it will take longer to get into an ISR than I have to service it. And even if I could get into the ISR within the 5 clocks, I only have 3 single-cycle instructions left (at best) to do something.

    Yes, I could get into the ISR faster without the Arduino library. (Which then means I have to write *everything* from scratch. Wow.) And even if I did that, it still IS NOT FAST ENOUGH.

    So, none of your math on how fast you can toggle a pin matters.

    See MY point?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube