SkillAgentSearch skills...

MemSIM2

Tool for memSIM2 EPROM emulator

Install / Use

/learn @nils-eilers/MemSIM2
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

memSIM2

This is a software tool to load memory images onto the memSIM2 EPROM emulator from http://momik.pl .

MemSIM2 is an EPROM emulator. It emulates EPROMs from 2764 (8K/28 pin) to 27040 (4M/32 pin). This is accomplished by downloading your code with this tool.

WARNING: Do not use the memSIM2 in an EPROM burner. It will be destroyed by the programming voltages. To 'program' the EPROM just use the command line to update the emulators contents via the USB. Also memSIM2 may work fine in place of EEPROM but it can't be programmed in system like an EEPROM or Flash chip can.

WARNING: Take great care when using an adapter to simulate 2716 (2K) or 2732 (4K) ERPOMs (24 pin) some of the really odd chips put the voltages in different places or, worse yet, use voltages (+5, -5 and +12v) that will destroy the memSIM2. See the TMS2716 below as an example of an EPROM with triple voltages.

Build and install

make
sudo make install

The Makefile is written for GNU make. On some BSD systems, you'll have to call gmake instead of make to get a GNU make. Tested on Linux and GhostBSD, which is based on FreeBSD. Should build on most POSIX systems out of the box.

The binary installs to the PREFIX path defined in the Makefile, usually '/usr/local/bin'.

Installing udev rule on Linux

sudo cp 62-memsim2.rules /etc/udev/rules.d/

This installs an udev rule. Once you attach the EPROM emulator, a symbolic link '/dev/memsim2' will appear which points to the usual '/dev/ttyUSBn', with n being any digit starting at zero.

Gain access rights to the simulator

If you try to access the simulator and get an error message 'permission denied', you probably don't have the required rights to access the EPROM simulator. You may gain these rights for example by adding your user to the appropriate group.

Ensure, the simulator is not plugged in. Plug it in then, then issue

	sudo dmesg

You should get a number of messages, the last ones should tell you the device name used by the EPROM simulator, '/dev/ttyUSB0' in this case:

[ 4789.932478] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 4789.932504] ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
[ 4789.932520] usb 1-1: Detected FT-X
[ 4789.932659] usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0

Show the group of that device:

	ls -l /dev/ttyUSB0

which gives here:

	crw-rw---- 1 root uucp 188, 0  9. Jun 07:20 /dev/ttyUSB0

so your user must be in the 'uucp' group to gain the required access rights. Run 'groups' to show the current set of groups you're part of. If your user name is not a member of the group used by the EPROM simulator, you may add this group to your user like so:

	sudo usermod -aG uucp <your-user-name>

Run 'su <your-user-name>' to apply the new group immediately. As an alternative, you may log out and in again.

Ensure, the simulator is not plugged in. Plug it in then, then issue

	sudo dmesg

You should get a number of messages, the last ones should tell you the device name used by the EPROM simulator, '/dev/ttyACM0' in this case:

[ 4789.932478] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 4789.932504] ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
[ 4789.932520] usb 1-1: Detected FT-X
[ 4789.932659] usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0

Show the group of that device:

	ls -l /dev/ttyACM0

which gives here:

	crw-rw---- 1 root dialout 166,  0 Mar 19 07:14 /dev/ttyACM0

so your user must be in the 'dialout' group to gain the required access rights. Run 'groups' to show the current set of groups you're part of. If your user name is not a member of the group used by the EPROM simulator, you may add this group to your user like so:

	sudo usermod -aG dialout <your-user-name>

Run 'su <your-user-name>' to apply the new group immediately. As an alternative, you may log out and in again.

Notes

My notes and ramblings. The code is a work in progress.

The memSIM2 can emulate up to 512Kbyte EPROMs (32 Pin), the smallest is an 8K 2764 (28 Pin)

The memSIM2 comes with a 32 pin cable also says that a 28 pin cable is available.

I've stacked the 32 pin end of the cable to a high quality machine socket to the socket. I learned that trick from using CPU emulators. It gives a sturdier set of pins to insert into the EPROM sockets.

I've got the 32 pin cable version of the memSIM2 and I also need to work with 28 pin EPROMS. I see in the flyer that it supports a Vcc of 2.7v to 5.0v. It is possible to connect the 32 pin cable to the 28 pin socket by using an additional 28 pin machine socket using the lower 28 pins of the 32 pin cable (pins 1, 2, 31 & 32, the top 4 pins are exposed). (Yes)

Similarly it is possible to also connect the 32 or 28 pin cable to a 24 pin socket by again using the lower 24 pins (pins 1, 2, 3, 4, 29, 30, 31 & 32, the top 8 pins are exposed). Be careful not to short the exposed pins to anything else. Also I'm pretty sure that the Vcc pin 24 needs to be connected to pin 28 of the cable for voltage sensing. (Untested)

  • When loading code into the simulated EPROM where does it get loaded?
  • I can have multiple address sections that may not be contiguous. Will it load correctly?
  • How does it know where the EPROM starts?
  • I'm not sure I have this coded with the s-record.
  • Need to provide pictures of the stacked machine sockets adapters.

Help

MemSIM2 supports the Intel hex format and straight binary. Motorola S19 format is a work in progress.

$ memsim2 -h
Usage: [OPTION].. FILE
Upload image file to memSIM2 EPROM emulator.  Where file can be .ihx or .bin.

Options:
        -d DEVICE     Serial device
        -m MEMTYPE    Memory type (2716 -2K, 2732 -4K, 2764 -8K, 27128 - 16K, 27256 - 32K,
                      27512 - 64K, 27010 - 128K, 27020 - 256K, 27040 - 512K)
                      2716-2732 are 24 Pin, 2764-27512 are 28 Pin, 27010-27040 are 32 pin.
        -r RESETTIME  Time of reset pulse in milliseconds.
                      > 0 for positive pulse, < 0 for negative pulse
        -e            Enable emulation
        -o BYTES      Specify an offset value with different meaning for:
                      binary files: skip first n bytes of file
                      Hex files: start address in memory map of simulated memory chip
        -h            This help
$

Usage


If the provided defaults work for you, the usage is as easy as plugging everything in while your devices are powered off, switching them on and running

        memsim2 imagefile.ext

to upload and reset the device. The kind of imagefile is solely detected by its file extension. These formats are currently supported:

| Extension | Image type | |---------------------------|-------------------| | .bin | Raw binary files | | .hex | Intel Hex files | | .s19 .s28 .s37 .srec .mot | Motorola S-Record |

Raw binary files


There's not too much to say about these. Usually they're a binary dump of a memory chip. The type of memory chip (e.g. 2764) will be auto-detected if the data size matches the size of a supported chip. If not, a warning will be written to the screen and the next larger chip will be simulated.

It can't be easier than just simulating one chip of the very same size of the provided binary data, for example:

        memsim2 myrom.bin

If you don't provide a specific chip to simulate, it will be auto-detected by the amount of binary data but you may of course specify one:

        memsim2 -m 27128 os16k.bin

If your build system emits a larger binary than you actually would like to simulate, you may specify an offset to the beginning of the file indicating where the simulated data starts and the type of the memory chip to simulate. As an example, let us assume, your operating system occupies 16 KB and is spread across two 2764 chips of 8 KB each. You're currently working on code in the upper half, so you'd like to simulate the upper memory while your build system provides the full 16 KB:

        memsim2 -m 2764 -o 8192 os16k.bin

If you prefer, you may specify the offset in hex if you prefix the value with '0x' or '0X' such as used in the C programming language:

        memsim2 -m 2764 -o 0x2000 os16k.bin

This example will simulate a 2764 chip (8 KB size). The -o option specifies an offset of 8192 to make the simulator skip the first 8192 bytes of the provided file os16k.bin, so that only the upper half of the binary file is transferred to the simulated memory.

For historical reasons, it's even possible to provide the value in octal but I won't go into details here. You only need to know that a leading 0 triggers octal interpretation so if you mean 10 decimal you need to write it as 10 and not as 0010 because that would be octal 0010 = decimal 8 which would obviously break whatever you intend to do.

Intel hex


If the file extension is .hex, the file will be interpreted as Intel hex file:

        memsim2 mydata.hex

These may come in three variants:

  • I8HEX (16 bit addresses)
  • I16HEX (20 bit addresses)
  • I32HEX (32 bit addresses)

Intel hex files usually consist of several records (text lines) with data, each secured with a checksum and provided with an start address indicating where the following data bytes should get stored.

Each checksum is verified, bad files are rejected.

The data records may appear in any order. For example data at lower addresses may follow data at higher addresses. Spaces between occupied memory areas are allowed also. memsim2 will determine the lowest and highest address at which data is stored and use this information to auto-detect the simulated chip if no -m option is given.

There are two possible ways to specify the addresses inside the hex file: seen relative to the sto

View on GitHub
GitHub Stars13
CategoryDevelopment
Updated1mo ago
Forks6

Languages

C

Security Score

90/100

Audited on Feb 13, 2026

No findings