Page 1 of 3

Real Input and Output on the Pi emulation

Posted: 08 Dec 2024 19:45
by TimoHartong
Recently I finally built a print for the museum I use the 23017 on the I2C bus. Under linux I can see the chip with the i2c tools and I can read the data and write data. I have compiled the MEMU sources with the options -DTARGET=FBuf -DHW_23017=Y and -DTARGET=XWin -DHW_23017=Y I have made a hardware config file and load this with the command line option -hw-config it however does not seem to work if I use BASIC to set the output as a test.

Re: Real Input and Output on the Pi emulation

Posted: 08 Dec 2024 23:58
by Bill B
OK. I will need some time to look into this.

What Model of RPi are you using, and what OS?

Re: Real Input and Output on the Pi emulation

Posted: 09 Dec 2024 00:49
by TimoHartong
Bill B wrote: 08 Dec 2024 23:58 OK. I will need some time to look into this.

What Model of RPi are you using, and what OS?
I'm using a Zero-W and the uname results are :
Linux raspberrypi 6.6.47+rpt-rpi-v7 #1 SMP Raspbian 1:6.6.47-1+rpt1 (2024-09-02) armv7l GNU/Linux

Re: Real Input and Output on the Pi emulation

Posted: 09 Dec 2024 10:28
by Bill B
What do you get from

Code: Select all

cat /etc/os-release
Also, what do you get from:

Code: Select all

./memu --help | grep hw

Re: Real Input and Output on the Pi emulation

Posted: 09 Dec 2024 16:36
by TimoHartong
Bill B wrote: 09 Dec 2024 10:28 What do you get from

Code: Select all

cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 12 (bookworm)"
NAME="Raspbian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Re: Real Input and Output on the Pi emulation

Posted: 09 Dec 2024 16:46
by TimoHartong
Bill B wrote: 09 Dec 2024 10:28 <knip>

Also, what do you get from:

Code: Select all

./memu --help | grep hw
usage: ./memu-fb [flags]
Flags may be specified on command line or in files
"memu.cfg" or "memu0.cfg" in the program folder.
flags: -help display this list
-ignore Allow flags for unimplemented features
-config-file file read configuration options from file
-no-ignore-faults turn off permissive options enabled by -config-file
-rom-enable rom_bits bit flags to enable (1) or disable (0) a rom
-no-cfx2 rom_file disable CFX-II emulation but specify ROM image file
-mon-size sets 80 col size (but does not enable it)
-disk-dir dir directory containg disk images
-hw-config file read definitions of external hardware for MEMU
-iobyte iobyte specify IOBYTE (initially 0x00)
-subpage subpage set ROM subpage (initially 0)
-addr addr set the address (initially 0x0000)
-mem file load file at address
-mem-blocks n number of 16KB memory blocks (default 4)
-mem-mtx500 equivelent to -mem-blocks 2
-n-subpages rom n set number of subpages
-romX file load ROM X from file
-rompairX file load ROM X and X+1 from file
-largerom roms file load roms (S,0-7) from single file
-vid-win emulate VDP and TV using a graphical window
-vid-win-big,-v increase size of VDP window (repeat as necessary)
-vid-win-max make VDP window maximum size
-vid-win-hw-palette use an alternate palette
-vid-win-title set title for VDP window
-vid-win-display set display to use for VDP window
-vid-ntsc refresh at 60Hz (instead of 50Hz)
-snd-portaudio,-s emulate sound chip using portaudio
-snd-latency value instruct portaudio to use a given latency
-mon-win emulate 80 column card using a graphical window
-mon-win-big,-mw increase size of MON window (repeat as necessary)
-mon-win-max make MON window maximum size
-mon-win-mono green screen monochrome
-mon-console,-mc emulate 80 column card using console only
-mon-console-nokey keyboard status shows no keys pressed
-mon-no-ignore-init don't ignore writes to non-emulated registers
-mon-win-title set title for 80 column window
-mon-win-display set display to use for 80 column window
-vga emulate Propeller VGA display
-kbd-remap remaps MTX keyboard (despite shift state)
-kbd-country n sets the country code switches to n (default 0)
-kbd-type string auto type keys in this string
-kbd-type-file fn auto type keys in this file
-joy,-j enable joystick support
-joy-buttons string define left,right,up,down and fire buttons
-joy-central n percentage off-centre to press direction
-serial1-dev dev serial 1 in/out from device
-serial1-in fn serial 1 input from file/pipe
-serial1-out fn serial 1 output to file/pipe
-serial2-dev dev serial 2 in/out from device
-serial2-in fn serial 2 input from file/pipe
-serial2-out fn serial 2 output to file/pipe
-sdx-tracks n specify tracks of first drive (default 80)
-sdx-mfloppy file specify .mfloppy file in SDX first drive
-sdx-tracks2 n specify tracks of second drive (default 80)
-sdx-mfloppy2 file specify .mfloppy file in SDX second drive
-sidisc-huge enable Silicon Disc huge mode
-sidisc-no-save don't save Silicon Disc content on termination
-sidisc-file n file specify Silicon Disc content for a drive
-cfx2 rom_file enable CFX-II emulation and specify ROM image file
-cf-image c:p file specify data image for partition (p) on card (c)
-prn-file file specify file to receive printer output
-tape-dir path .mtx files are in this directory
-tape-overwrite SAVE can overwrite an existing file
-tape-disable don't patch INOUT to LOAD/SAVE/VERIFY .mtx files
-tap-file fn specify ZX tape file (default memu.tap)
-sna-file fn specify ZX snapshot file (default memu.sna)
-cassette-in hardware emulation - MTX or WAV file to load
-cassette-out hardware emulation - MTX or WAV file to save
-cpm emulate CP/M BDOS
-cpm-drive-a path where CP/M BDOS finds A: files (default: .)
-cpm-invert-case invert between CP/M and host filenames
-cpm-tail tail construct CP/M command tail
-cpm-open-hack don't insist on EX,S1,S2,RC being 0
-sdx SDX support in ROM 5 (or -sdx3 for ROM 3)
-fdxb FDXB CP/M support
-nfx-port-offset off offset to add to NFX port numbers
-vdeb Run Visual Debugger on startup
-speed hz set CPU speed (default is 4000000, ie: 4MHz)
-fast don't limit speed, run as fast as possible
-run-no-interrupts disable interrupts loading RUN files from command line
file.com tail ... -cpm -iobyte 0x80 -addr 0x0100 -mem file.com
file.run -iobyte 0x00 -addr 0xAAAA (from header)
file.mtx subsequent LOAD/SAVE/VERIFY "" will use this file

Re: Real Input and Output on the Pi emulation

Posted: 09 Dec 2024 16:46
by TimoHartong
Sorry for the delay but today was used to make the print more neat. Strangely grep did not a very good job but I'm not really a Linux top expert :D

Re: Real Input and Output on the Pi emulation

Posted: 10 Dec 2024 22:12
by Bill B
It will probably be the weekend before I set up the hardware needed to test the MCP23017 interface.

I have committed a software update which may resolve the issue, if you would like to try it.

There is also another option. Recent versions of the RPi OS have a kernel driver for the MCP23017. To enable this, add the following line to /boot/firmware/config.txt:

Code: Select all

dtoverlay=mcp23017
After rebooting, running gpiodetect should show something like:

Code: Select all

pi@raspberrypi:~ $ gpiodetect
gpiochip0 [pinctrl-bcm2711] (58 lines)
gpiochip1 [raspberrypi-exp-gpio] (8 lines)
gpiochip2 [mcp23017] (16 lines)
gpiochip0 [pinctrl-bcm2711] (58 lines)
It should then be possible to specify the MCP23017 pins as GPIO pins in the hardware definition file:

Code: Select all

[pio]
pot0 = GPIO, /dev/gpiochip2, 0
pot0 = GPIO, /dev/gpiochip2, 1
    :
pin0 = GPIO, /dev/gpiochip2, 8
    :



Re: Real Input and Output on the Pi emulation

Posted: 11 Dec 2024 00:02
by TimoHartong
Hi Bill thank you for all the trouble. I will test tomorrow. I have been hacking code myself as well making slow progress.

Re: Real Input and Output on the Pi emulation

Posted: 11 Dec 2024 00:43
by TimoHartong
Bill B wrote: 10 Dec 2024 22:12 It will probably be the weekend before I set up the hardware needed to test the MCP23017 interface.

I have committed a software update which may resolve the issue, if you would like to try it.
<knip>
I have excellent news ( I think ) at least my code now works ( after two days :lol: ) I will certainly try yours tomorrow as well than we can compare notes and than we have a very nice addition to the emulator

I will try to post some pictures of the print I made