INTRODUCTION
Matured computer hardware (e.g. Arcade PCBs, home computers, etc.) usually don’t have a debug interface, nor do they provide an easy way to alter the firmware. This firmware in form of an integrated circuit in a DIP-package ROM and/or EPROM is fitted on the PCB.
This blog introduces a EPROM EMULATOR which can be used for retrocomputing, debugging and ROM patching. The adapter of the EMULATOR replaces the ROM or EPROM device to be altered.
HARDWARE FEATURES
- Shield for Arduino MEGA 2560 (or compatible)
- 24-pin and 28-pin socket support via flat ribbon cable
- Emulates EPROM devices: 2704, 2708, 2716, 2732, 27(C)64, 27(C)128, 27(C)256, 27(C)512
- Emulates Texas Instruments EPROM devices: TMS 2716, TMS 2516, TMS 2532, TMS 2564
- Emulates ROM devices: 2316, 2332, 2364, 23128, 23256
- -5V tolerant on pin A11 for 2704, 2708, TMS 2716
- +12V tolerant on pin A10 for 2704, 2708, TMS 2716
- Power: USB-powered, Target-powered or DC 9-12V barrel power jack
- Battery backed SRAM
The table below shows the pinout for the supported devices:
ROM | ROM | TMS | TMS | ROM | TMS | TMS | ROM | ROM | TMS | TMS | ROM | TMS | ROM | TMS | ROM | ROM | ||||||||||||||||||||||
27512 | 27256 | 23256 | 27128 | 23128 | 2564 | 2764 | 2364 | 2532 | 2732 | 2332 | 2516 | 2716 | 2716 | 2316 | 2708 | 2704 | 2704 | 2708 | 2316 | 2716 | 2716 | 2516 | 2332 | 2732 | 2532 | 2364 | 2764 | 2564 | 23128 | 27128 | 23256 | 27256 | 27512 | |||||
Pin | Pin | Pin | Pin | |||||||||||||||||||||||||||||||||||
A15 | VPP | n.c. | VPP | n.c. | VPP | VPP | 1 | 28 | +5V | +5V | +5V | +5V | +5V | +5V | +5V | |||||||||||||||||||||||
A12 | A12 | A12 | A12 | A12 | CE1 | A12 | 2 | 27 | PGM | CE2 | CE3 | PGM | A14 | A14 | A14 | |||||||||||||||||||||||
A7 | A7 | A7 | A7 | A7 | A7 | A7 | A7 | A7 | A7 | A7 | A7 | A7 | A7 | A7 | A7 | A7 | 3 | 1 | 24 | 26 | +5V | +5V | +5V | +5V | +5V | +5V | +5V | +5V | +5V | +5V | n.c. | +5V | A13 | A13 | A13 | A13 | A13 | |
A6 | A6 | A6 | A6 | A6 | A6 | A6 | A6 | A6 | A6 | A6 | A6 | A6 | A6 | A6 | A6 | A6 | 4 | 2 | 23 | 25 | A8 | A8 | A8 | A8 | A8 | A8 | A8 | A8 | A8 | A8 | A8 | A8 | A8 | A8 | A8 | A8 | A8 | |
A5 | A5 | A5 | A5 | A5 | A5 | A5 | A5 | A5 | A5 | A5 | A5 | A5 | A5 | A5 | A5 | A5 | 5 | 3 | 22 | 24 | GND | A9 | A9 | A9 | A9 | A9 | A9 | A9 | A9 | A9 | A9 | A9 | A9 | A9 | A9 | A9 | A9 | |
A4 | A4 | A4 | A4 | A4 | A4 | A4 | A4 | A4 | A4 | A4 | A4 | A4 | A4 | A4 | A4 | A4 | 6 | 4 | 21 | 23 | -5V | -5V | CE3 | VPP | -5V | VPP | CE1 | A11 | VPP | A12 | A11 | A12 | A11 | A11 | A11 | A11 | A11 | |
A3 | A3 | A3 | A3 | A3 | A3 | A3 | A3 | A3 | A3 | A3 | A3 | A3 | A3 | A3 | A3 | A3 | 7 | 5 | 20 | 22 | OE | OE | CE1 | OE | A10 | OE | CE2 | OE | CE* | CE | OE | CE* | CE1 | OE | CE1 | OE | OE | |
A2 | A2 | A2 | A2 | A2 | A2 | A2 | A2 | A2 | A2 | A2 | A2 | A2 | A2 | A2 | A2 | A2 | 8 | 6 | 19 | 21 | +12V | +12V | A10 | A10 | +12V | A10 | A10 | A10 | A10 | A10 | A10 | A10 | A10 | A10 | A10 | A10 | A10 | |
A1 | A1 | A1 | A1 | A1 | A1 | A1 | A1 | A1 | A1 | A1 | A1 | A1 | A1 | A1 | A1 | A1 | 9 | 7 | 18 | 20 | CE | CE | CE2 | CE | CE | CE* | A11 | CE | A11 | A11 | CE | A11 | CE2 | CE | CE2 | CE | CE | |
A0 | A0 | A0 | A0 | A0 | A0 | A0 | A0 | A0 | A0 | A0 | A0 | A0 | A0 | A0 | A0 | A0 | 10 | 8 | 17 | 19 | D7 | D7 | D7 | D7 | D7 | D7 | D7 | D7 | D7 | D7 | D7 | D7 | D7 | D7 | D7 | D7 | D7 | |
D0 | D0 | D0 | D0 | D0 | D0 | D0 | D0 | D0 | D0 | D0 | D0 | D0 | D0 | D0 | D0 | D0 | 11 | 9 | 16 | 18 | D6 | D6 | D6 | D6 | D6 | D6 | D6 | D6 | D6 | D6 | D6 | D6 | D6 | D6 | D6 | D6 | D6 | |
D1 | D1 | D1 | D1 | D1 | D1 | D1 | D1 | D1 | D1 | D1 | D1 | D1 | D1 | D1 | D1 | D1 | 12 | 10 | 15 | 17 | D5 | D5 | D5 | D5 | D5 | D5 | D5 | D5 | D5 | D5 | D5 | D5 | D5 | D5 | D5 | D5 | D5 | |
D2 | D2 | D2 | D2 | D2 | D2 | D2 | D2 | D2 | D2 | D2 | D2 | D2 | D2 | D2 | D2 | D2 | 13 | 11 | 14 | 16 | D4 | D4 | D4 | D4 | D4 | D4 | D4 | D4 | D4 | D4 | D4 | D4 | D4 | D4 | D4 | D4 | D4 | |
GND | GND | GND | GND | GND | GND | GND | GND | GND | GND | GND | GND | GND | GND | GND | GND | GND | 14 | 12 | 13 | 15 | D3 | D3 | D3 | D3 | D3 | D3 | D3 | D3 | D3 | D3 | D3 | D3 | D3 | D3 | D3 | D3 | D3 |
red: Power pins
green: Low active pins; CE* according to datasheet PD/PGM (Power Down & PROGRAM)
yellow: Chip Enable pin polarity is factory programmed, check target schematic for proper polarity settings
SOFTWARE FEATURES
- RS232 terminal interface
- Menu for device selection and upload
- Single command upload
- Auto termination of upload by time-out
- Auto device configuration after power-up
LET’S GET STARTED
The EMULATOR in operation
Hier is an exemplary application of the EMULATOR:
The photo above shows the emulation of a ROM (8KB) using the 24-pin adapter placed in UB3 socket on a floppy drive 1541 PCB. UB3, which is the target device here, has the pinout of a 2364 ROM (1541: #325302; $C000-$DFFF). Connected to the floppy’s RESET line is the black Target Reset clip.
Info:
To the right of UB3 is UB4. But here instead of a ROM 2364 an EPROM TMS 2564 with adapter board is fitted (1541: #901229; $E000-$FFFF).
Power supply considerations
When powering the EMULATOR from the target or barrel jack then it will backfeed 5V into the USB, if the USB host is shut down. Therefore it’s recommended to disconnect USB before shutting down the host. A USB connection is only needed for uploads.
Power supply decoupling of USB and target/barrel is achieved by supplying the MEGA 2560 board over Vin. Once Vin has reached ca. 6.6V then the on-board 5V is being disconnected from the USB 5V.
A SX1308 module steps the target 5V up to 7V which then supplies Vin. With Vin=7V the idle current is about 110mA. A screen shot of the current surge into pin 28 of the target adapter on power-up is shown below. For USB and barrel jack the idle current is circa 70mA. Using the barrel jack with DC 9-12V will override Vin and limit the current into pin 28 to ca. 1mA.
Schematic
Socket U1 connects the shield with the target adapter. U3 and U4 disconnect the target address bus from the host address bus during upload. U2 buffers the data bus to the target and its outputs are disabled on target power down and during upload.
U7 provides buffering for target reset and buffer enable signals. Furthermore, it protects the buffer against -5V on TA11 when emulating a 2704, 2708 or TMS 2716.
U6 is a standard 128KB SRAM supplied via diode decoupling from +5V or a 3V lithium battery when 5V is powered down.
U4 is doing the magic. The GAL22V10 limits the SRAM address in case of open/floating upper target address lines TA11 to TA15. The address mapping according to the pinout table above is also managed by U4 and is set by MODE and SIZE signals.
ABEL design
MODULE
TITLE 'EPROM EMULATOR'
"Yorck Thiele, December 2022
DEVICE 'p22V10';
"INPUTS
TA15, TA14, TA13, TA12, TA11, TA10 PIN 1, 2, 3, 4, 5, 6;
TCE, TOE, SIZE0, SIZE1, SIZE2 PIN 7, 8, 9, 10, 11;
BUF_OE, MODE1, MODE0 PIN 13, 14, 15;
"OUTPUTS
!ACCESS, A10, A11, A12, A13, A14, A15 PIN 17,18,19,20,21,22,23 ISTYPE 'com';
SIZE_05KB=0;
SIZE_1KB=1;
SIZE_2KB=2;
SIZE_4KB=3;
SIZE_8KB=4;
SIZE_16KB=5;
SIZE_32KB=6;
SIZE_64KB=7;
TYPE_27xx =0;
TYPE_25xx =1;
TYPE_23xx =2;
TYPE_2716 =3;
X=.X.;
TARGET_SIZE = [SIZE2, SIZE1, SIZE0];
TARGET_TYPE = [MODE1, MODE0];
TARGET_ADR = [TA15, TA14, TA13, TA12, TA11, TA10,X,X];
TRSL_ADR = [A15, A14, A13, A12, A11, A10,X,X]; "translated address
MAP2332 = [0, 0, 0, 0, TCE, TA10,X,X]; "2332
MAP2364 = [0, 0, 0, TA11, TCE, TA10,X,X]; "2364
MAP2716 = [0, 0, 0, 0, 0, TOE,X,X]; "TMS2716
EQUATIONS
[A10, A11, A12, A13, A14, A15].OE = !BUF_OE;
"ADDRESS MAPPER & ADDRESS LIMITER
WHEN ((TARGET_TYPE==TYPE_2716) & (TARGET_SIZE==SIZE_2KB)) THEN TRSL_ADR= MAP2716; "TMS2716
ELSE WHEN ((TARGET_TYPE==TYPE_23xx) & (TARGET_SIZE==SIZE_4KB)) THEN TRSL_ADR= (MAP2332 & ^hF); "2332
ELSE WHEN ((TARGET_TYPE==TYPE_23xx) & (TARGET_SIZE==SIZE_8KB)) THEN TRSL_ADR= (MAP2364 & ^h1F); "2364
ELSE WHEN TARGET_SIZE==SIZE_2KB THEN TRSL_ADR=(TARGET_ADR & ^h7);
ELSE WHEN TARGET_SIZE==SIZE_4KB THEN TRSL_ADR=(TARGET_ADR & ^hF);
ELSE WHEN TARGET_SIZE==SIZE_8KB THEN TRSL_ADR=(TARGET_ADR & ^h1F);
ELSE WHEN TARGET_SIZE==SIZE_16KB THEN TRSL_ADR=(TARGET_ADR & ^h3F);
ELSE WHEN TARGET_SIZE==SIZE_32KB THEN TRSL_ADR=(TARGET_ADR & ^h7F);
ELSE TRSL_ADR=TARGET_ADR;
"PROCESS TARGET CE & OE SIGNALS
"CHANGE POLARITY OF ROM 23xx ENABLE SIGNALS BELOW IF NECESSARY
WHEN BUF_OE==1 THEN ACCESS=0;
ELSE WHEN ((TARGET_TYPE==TYPE_23xx) & (TARGET_SIZE==SIZE_2KB)) THEN ACCESS= !TA11 & !TOE & !TCE; "2316
ELSE WHEN ((TARGET_TYPE==TYPE_23xx) & (TARGET_SIZE==SIZE_4KB)) THEN ACCESS= !TA11 & !TOE; "2332
ELSE WHEN ((TARGET_TYPE==TYPE_23xx) & (TARGET_SIZE==SIZE_8KB)) THEN ACCESS= !TOE; "2364
ELSE WHEN ((TARGET_TYPE==TYPE_23xx) & (TARGET_SIZE==SIZE_16KB)) THEN ACCESS= !TA14 & !TOE & !TCE; "23128
ELSE WHEN ((TARGET_TYPE==TYPE_25xx) & (TARGET_SIZE==SIZE_4KB)) THEN ACCESS= !TOE; "2532
ELSE WHEN ((TARGET_TYPE==TYPE_25xx) & (TARGET_SIZE==SIZE_8KB)) THEN ACCESS= !TA14 & !TA12 & !TOE; "2564
ELSE WHEN ((TARGET_TYPE==TYPE_2716) & (TARGET_SIZE==SIZE_2KB)) THEN ACCESS= !TCE; "TMS2716
ELSE ACCESS= !TOE & !TCE;
END
MODULE
TITLE 'EPROM EMULATOR'
"Yorck Thiele, December 2022
DEVICE 'p22V10';
"INPUTS
TA9, TA8, TA7, TA6, TA5, TA4 PIN 1, 2, 3, 4, 5, 6;
TA3, TA2, TA1, TA0, BUF_OE PIN 7, 8, 9, 10, 13;
"OUTPUTS
A0,A1,A2,A3,A4,A5,A6,A7,A8,A9 PIN 14,15,16,17,18,19,20,21,22,23 ISTYPE 'com';
EQUATIONS
"10-BIT BUFFER WITH OUTPUT ENABLE
[A9, A8, A7, A6, A5, A4, A3, A2, A1, A0].OE = !BUF_OE;
[A9, A8, A7, A6, A5, A4, A3, A2, A1, A0] = [TA9, TA8, TA7, TA6, TA5, TA4, TA3, TA2, TA1, TA0];
END
User interface
The EMULATOR can be controlled with a standard RS232 terminal software (settings: 115200 Baud 8-N-1). CoolTerm is used in the example below.
Howto upload:
Strike ‘U’ for upload, then choose “Send Text/Binary File” from the Connection menu. A file dialog for the upload will pop up.