OXYGENHUB
◆ main openmsx / Contrib / README.MSXPi
11.2 KiB · last changed chore(): initial commit 1 month ago source blame history raw
1
Using MSXPi Extension for openMSX
2
=================================
3
MSXPi is a hardware and software solution that allows MSX
4
computers to control and use Raspberry Pi resources. The interface
5
exposes I/O ports for the MSX computer, which allows exchange of
6
data with the Raspberry Pi using a custom protocol. Many resources are
7
implemented, such as access to network drives, internet, disk images,
8
and access to the Raspberry Pi itself to execute commands.
9
10
The MSXPiDevice for openMSX implements the same functionality of the
11
physical MSXPi without the need of a Raspberry Pi - instead, relies
12
on a Python msxpi-server code running on the same computer where
13
openMSX is hosted.
14
15
For detailed information about the MSXPi project and the hardware interface,
16
go to: https://github.com/costarc/MSXPi
17
18
This README is for the openMSX extension that reproduces the behaviour of
19
the physical interface.
20
21
Architecture of the physical Interface:
22
┌────────────┐         ┌────────────────────────┐         ┌────────────────────┐
23
│    MSX     │  <--->  │     MSXPi Interface    │  <--->  │   msxpi-server     │
24
│ (Z80 I/O)  │  0x56   │   (CPLD + SPI bridge)  │  GPIO   │ (Python GPIO API)  │
25
│            │  0x57   │     + 32KB EEPROM      │         │                    │
26
└────────────┘  0x5A   └────────────────────────┘         └────────────────────┘
27
28
Architecture of the MSXPi extension for openMSX:
29
┌────────────┐         ┌────────────────────────┐         ┌────────────────────┐
30
│    MSX     │  <--->  │     MSXPi Interface    │  <--->  │   msxpi-server     │
31
│ (Z80 I/O)  │  0x56   │  (MSXPiDevice + socket │  Socket │(Python socket API) │
32
│            │  0x57   │     + msxpibios.rom)   │         │                    │
33
└────────────┘  0x5A   └────────────────────────┘         └────────────────────┘
34
35
The emulated device reproduces the CPLD (firmware v1.6) at I/O-port level, so
36
the same msxpibios.rom and the same MSX side commands that run on the physical
37
interface run unchanged in openMSX. Port 0x57 returns the firmware version,
38
which means software cannot tell the emulated interface from the real one.
39
40
Now that you know everything you need (not really!) to start with MSXPi, prepare
41
the environment.
42
43
Quick setup on Windows
44
======================
45
46
If you are on Windows, one installer does everything below: it installs
47
Python 3 and the modules the server needs, 7-Zip and mpv music player, the msxpi-server
48
code, the MSXPi disk images, an openMSX build with MSXPi support, MSXPi.xml
49
and msxpibios.rom, and a launcher that starts the server and openMSX together.
50
51
Download msxpi-openmsx-install.bat from:
52
53
   https://github.com/costarc/MSXPi/tree/master/software/Server/Setup
54
55
and double-click it. The .bat fetches msxpi-windows-setup.ps1 (the script that
56
does the work) if it is not next to it, so that one file is enough. From a
57
command line, with options:
58
59
   msxpi-openmsx-install.bat [-Network] [-Branch name]
60
61
   -Network  also installs the OpenVPN TAP driver and sets up the MSX network
62
             (NAT), so the MSX TCP/IP commands work. This step asks for
63
             administrator rights; the rest of the install does not need any.
64
65
Everything lands in C:\home\pi\msxpi - the path the server expects - with
66
openMSX in C:\home\pi\msxpi\openMSX. You get a start-openmsx.bat launcher
67
and an MSXPi icon on the desktop. Running the installer again is safe: it
68
updates what is out of date and keeps your msxpi.ini and your disk images.
69
70
Then start MSXPi from the desktop icon and go to step 8 below, where the
71
MSXPi commands are tried out.
72
The manual steps that follow are for other platforms, or if you would rather
73
install the pieces yourself.
74
75
To install the pieces by hand you will need Python3 installed in your computer.
76
IDLE will work with MSXPi in Windows - it can be downloaded and installed
77
from Microsoft App store. MSXPi will also work in other platforms - it
78
works better on Linux, since it is the native environment it was designed
79
for initially.
80
At this time, some commands will work on Windows, many won't - but they
81
are being ported and pushed to MSXPi repository, so I recommend to keep
82
refreshing your local copy frequently.
83
84
There are a lot of Python modules that are not standard in Python, and will
85
require you to install before running MSXPi. When you run msxpi-server, it
86
will complain about missing modules - use that information to install them.
87
For example, to install module "fs":
88
89
Go to Windows command line and type:
90
91
   python -m pip install fs
92
93
Repeat for all modules that are not already installed.
94
95
You will also have to download several files needed by MSXPi - follow the
96
instructions below to get started.
97
98
Manual setup, and trying MSXPi out
99
==================================
100
101
1. Install an openMSX version that has support for MSXPi extension. You can download
102
   binaries for all platforms (nightly builds from openMSX) in the releases section:
103
   https://github.com/costarc/openMSX/releases
104
105
   Always use the latest release.
106
107
2. Download msxpi-server.py from:
108
109
   https://github.com/costarc/MSXPi/tree/master/software/Server/Python/src
110
111
   Use a server from the same MSXPi version as the ROM in step 3: the socket
112
   transport that openMSX uses was introduced in MSXPi v1.6, older servers do
113
   not speak it.
114
115
   Note: the msxpi-server component has some commands that require elevation of privileges
116
   in the Raspberry Pi platform using "sudo". These commands apply only to Raspberry Pi
117
   and will return a message "Command not supported on this platform" for all non-raspberry
118
   pi hosts.
119
120
   Run from IDLE console, or from command line:
121
122
   python msxpi-server.py
123
124
3. Download msxpibios.rom from:
125
   https://github.com/costarc/MSXPi/tree/master/software/openMSX/share/systemroms/extensions
126
127
   Copy to you openMSX/share/systemroms/extensions/ folder.
128
129
   This file is required: openMSX does not ship ROM images, and the extension
130
   will not load without it. It is the content of the EEPROM on the physical
131
   board, and the emulated interface serves it in the same way, so it boots
132
   the MSXPi BIOS and MSX-DOS1 on its own.
133
134
4. The MSXPi.xml extension definition is part of openMSX, so there is nothing
135
   to copy for it. If you want to use a ROM newer than the openMSX release you
136
   installed, take the matching MSXPi.xml from:
137
   https://github.com/costarc/MSXPi/tree/master/software/openMSX/share/extensions
138
139
   and copy it into your personal openMSX folder (share/extensions/ under
140
   ~/.openMSX, or under Documents/openMSX on Windows), where it takes
141
   precedence over the one that comes with openMSX.
142
143
5. Use a DIR as DISK with openMSX to facilitate the tests.
144
   Create a directory named FloppyA
145
   Copy MSXDOS.SYS and COMMAND.COM to FloppyA
146
   Make sure openMSX can boot into MSX-DOS using this folder as a drive:
147
148
   openmsx -machine Panasonic_FS-A1WSX -diska FloppyA
149
150
   This is the easiest way to get the MSXPi commands onto a drive. You can
151
   also boot MSX-DOS1 from the interface itself, as the physical board does,
152
   and use the MSXPi drives instead of a floppy.
153
154
6. Download the MSXPi commands you want to test from:
155
   https://github.com/costarc/MSXPi/tree/master/software/target
156
157
   Some commands will not work (yet) with openMSX because they were originally
158
   developed to work on Raspberry Pi. In time, most (if not all) commands
159
   will be ported to abstract the platform and run everywhere. If you can develop
160
   in python, help port them (thanks).
161
162
   Three files give you the whole command set:
163
164
   p.com     the MSXPi command, which takes the operation as its first
165
             argument: "p dir", "p run", "p chatgpt" and so on. It replaces
166
             the older one-command-per-operation files (pdir.com, prun.com,
167
             pcd.com and the rest), which are gone.
168
   pver.com  versions of the interface, the ROM and the server
169
   pcopy.com copy files between the MSX drives and the MSXPi drives
170
171
   Copy all these commands to you FloppyA
172
173
   You will need an OpenAI key for "p chatgpt" - see step 9 for where it goes.
174
175
7. Start openMSX loading the MSXPi extension:
176
177
   openmsx -machine Panasonic_FS-A1WSX -diska FloppyA -ext MSXPi
178
179
8. Try some commands - type exactly as shown:
180
181
   p ver
182
   pver
183
   p cd
184
   p dir
185
   p set
186
   p run
187
   p date
188
   p chatgpt
189
   p music
190
   p showpage
191
   pcopy
192
193
   Note 1: Read the Users Guide to learn more about these commands. It can be
194
   downloaded here: https://github.com/costarc/MSXPi/tree/master/documents
195
196
   Note 2: As I mentioned before, some commands will not behave nicely
197
   because they were developed for Raspberry Pi (Linux).
198
   Some work is needed on the msxpi-server side to make those commands
199
   work on Python running in a host that is not Linux.
200
201
9. Create a local /home/pi/msxpi/msxpi.ini
202
   This file is used to persist some MSXPi configuration. Create the
203
   folder in your computer (under Windows the path is C:\home\pi\msxpi)
204
   and save this file inside it:
205
   https://github.com/costarc/MSXPi/tree/master/software/Server/Shell/msxpi.ini
206
207
   If you have an OpenAI key, update this file with it so you can use the
208
   "p chatgpt" command.
209
   
210
   The Windows installer creates this file for you, from the msxpi-JumperLeft
211
   template, and never overwrites an existing one.
212
213
10. Read the MSXPi documentation for more detailed information:
214
   https://github.com/costarc/MSXPi/tree/master/documents
215
216
Settings
217
========
218
219
The extension adds three openMSX settings. Type "help set <name>" in the
220
openMSX console for the full description of each one.
221
222
   msxpirom_bank     The bank jumper, as labelled on the PCB. BANK2 (the
223
                     default) puts the lower half of the EEPROM, with
224
                     MSX-DOS1, at 4000h; BANK1 puts the upper half, the BIOS
225
                     only, there. Read at reset.
226
227
   msxpirom_sltsl    The J3 SLTSL jumper. OFF disconnects the EEPROM while
228
                     the interface ports keep working, which is how the board
229
                     is used when the BIOS comes from somewhere else. ON is
230
                     the default. Read at reset.
231
232
   msxpiserver_port  TCP port used to reach msxpi-server on the host. The
233
                     default, 5000, is the port msxpi-server listens on.
234
                     Change it on both sides if that port is taken. Takes
235
                     effect immediately: the interface reconnects.
236
237
The first two mirror jumpers on the physical board, and like the jumpers they
238
are sampled when the machine resets, so moving one while the MSX is running
239
does not pull the ROM out from under the code that is executing.
240
241
Savestates and the reverse feature (PgUp, the "reverse" commands) work with
242
the extension: the state of the interface is part of the savestate. The
243
connection to msxpi-server is not, and neither is the server's own state, so a
244
command that was in the middle of a transfer when the state was saved can fail
245
after a load. Save and load between commands.