Having looked at the code, support for an I2C port expander was in reasonable shape, and it was not too much work to hack it into he Linux builds.
Pull the latest code from my repository, then either:
Code: Select all
cd MEMU
mkdir build
cd build
cmake -DTARGET=XWin -DHW_23017=Y ..
make
Or:
Code: Select all
cd MEMU
mkdir build
cd build
cmake -DTARGET=FBuf -DHW_23017=Y ..
make
To run the program you will need a
hardware.cfg file (see docs/Hardware_Config.pdf), like:
Code: Select all
[PIO]
PIN0,MCP23017,/dev/i2c-1,0x20,A0
PIN1,MCP23017,/dev/i2c-1,0x20,A1
PIN2,MCP23017,/dev/i2c-1,0x20,A2
PIN3,MCP23017,/dev/i2c-1,0x20,A3
PIN4,MCP23017,/dev/i2c-1,0x20,A4
PIN5,MCP23017,/dev/i2c-1,0x20,A5
PIN6,MCP23017,/dev/i2c-1,0x20,A6
PIN7,MCP23017,/dev/i2c-1,0x20,A7
POT0,MCP23017,/dev/i2c-1,0x20,B0
POT1,MCP23017,/dev/i2c-1,0x20,B1
POT2,MCP23017,/dev/i2c-1,0x20,B2
POT3,MCP23017,/dev/i2c-1,0x20,B3
POT4,MCP23017,/dev/i2c-1,0x20,B4
POT5,MCP23017,/dev/i2c-1,0x20,B5
POT6,MCP23017,/dev/i2c-1,0x20,B6
POT7,MCP23017,/dev/i2c-1,0x20,B7
Then start MEMU using:
Code: Select all
memu-x -config-file memu.cfg -hw-config hardware.cfg
(Replace
memu-x by
memu-fb if that is what you want to use.)
Note that while this simulates the 8 input and 8 output bits, it does not simulate the two strobe lines. If these are needed by the hardware, and given that these will be time sensitive, I would suggest using a latch (74LS373) to provide INSTB and a tri-state buffer (74LS244) to provide OTSTB. In which case, build your own circuit board with these and an MCP23017, rather than use a commercial board.
Providing a version of MEMU with support for the RPi inbuilt GPIOs is going to take rather longer. One issue is that libgpiod v2 (which is the future of GPIO control) is not currently provided by RPi OS.