MSX Network


MSX-Link

This project's main goal was to have my diskless MSX2 (Yamaha YIS-503/IIIR) hooked to a PC that would emulate (well, actually simulate) another MSX2 machine, and with quite a bit of reverse engineering, programming, hacking and soldering to be able to download games using YIS-503/IIIR's built-in networking capabilities.

This simple circut allows any MSX equipped with Network Module to be connected to any RS-232 port. Full opto-coupling (both TX and RX), no additional power supply (necessary voltages taken from MSX and RS-232).

Schematics (JPG, 68K)

PCB design (PostScript, 51K)

Components layout (PostScript, 83K)

Communicate using speed 38400, 8 bits and 2 (!) stopbits. At least it works for me this way.


Packet formats

Typical packet has a header, a payload, sometimes a checksum and terminator (0x97 if there will be more packets, 83 if this is the last packet in a sequence).

HEADER
PAYLOAD
CHECKSUM
TERMINATOR
F0 00Destination addressPacket typeSource addressCommand (2 bytes - see Encoding)Optional parameters (encoded)Optional data byte(s) (encoded)16-bit checksum (encoded)97 (intermediate packet) 83 (last packet)

Header

Source and destination address can be 00 (Teacher), 01..0F (Student), and 7F (Broadcast).

Command - see Packet 0x01 description.

Payload

Maximum data bytes (without optional parameters) - 58 bytes.

Checksum

Checksum is a 16-bit sum of all bytes in payload. Packets with wrong checksum are silently discarded.

Encoding

Each 8-bit byte is sent as a pair of 7-bit octets, with the first octet carrying only bit 7 of original byte, and the second carries bits 6..0. This allows for sending packets across MIDI-like network (and through YM3802 chip in particular) in accordance with MIDI standards.

Example: byte 21 is sent as 00 21; byte FF is sent as 01 7F.

There are four types of packets used in MSX network.

Packet 0x01

This is the Base type of packet. Each Base packet should be acknowledged with ACK (0x06) packet, except for specific ones (see table).

00
01
02
03
04
05
06
07
08
09
0A
0B
0c
0d
0e
0f
10
11
12
13
14
15
16
17
18
19
1a
F000ADR201ADR100CMND
CP/M
20 NET-CLOSE-FILELNGTHHFAFCB (37 bytes)CHKSUM83
21 NET-SEARCH-FIRSTLNGTHHFAFCB (37 bytes)CHKSUM83
22 NET-SEARCH-NEXTLNGTHHFAFCB (37 bytes)CHKSUM83
23 NET-DELETE-FILELNGTHHFAFCB (37 bytes)CHKSUM83
24 NET-READ-FILELNGTHHFAFCB (37 bytes)CHKSUM83
25 NET-WRITE-FILELNGTHHFAFCB (37 bytes)CHKSUM83
26 NET-CREATE-FILELNGTHHFAFCB (37 bytes)CHKSUM83
27 NET-RENAME-FILELNGTHHFAFCB (37 bytes)CHKSUM83
2c Master Data (first packet)
2d Master Data (subsequent packets)
2e NET-SEARCH-ENDLNGTHHFAFCB (37 bytes)CHKSUM83
2f NET-OPEN-FILELNGTHHFAFCB (37 bytes)CHKSUM83
30 re: NET-CLOSE-FILE
31 re: NET-SEARCH-FIRST
32 re: NET-SEARCH-NEXT
33 re: NET-DELETE-FILE
34 re: NET-READ-FILE
35 re: NET-WRITE-FILE
36 re: NET-CREATE-FILE
37 re: NET-RENAME-FILE
3c Slave Data (first packet)
3d Slave Data (subsequent packets)
3e re: NET-SEARCH-END
3f re: NET-OPEN-FILE
General
40 SENDLNGTHbyte 1byte 2bytes NNCHKSUM97/83
41 SENDLNGTHbyte 1byte 2bytes NNCHKSUM97/83
42 SHEX (data packets)
43 SHEXS (data packets)
44 SEND-VRAM-DATA
45 SHEXS (file data packets)LNGTHbyte 1byte 2bytes NNCHKSUM97/83
46 MESS, TALKLNGTHbyte 1byte 2bytes NNCHKSUM97/83
47
48 SNDCMDLNGTHbyte 1byte 2bytes NNCHKSUM97/83
49 SNDM (first packet)LNGTHbyte 1byte 2bytes NNCHKSUM97/83
4a SNDM (subsequent packets)LNGTHbyte 1byte 2bytes NNCHKSUM97/83
4b re:RECVLNGTHbyte 1byte 2bytes NNCHKSUM97/83
4c re:RHEXLNGTHbyte 1byte 2bytes NNCHKSUM97/83
4d re:RHEXS data
4e re:RHEXS (file)LNGTHbyte 1byte 2bytes NNCHKSUM97/83
4f re:63
50
51 re:RCVMLNGTHbyte 1byte 2bytes NNCHKSUM97/83
52 SHEX/SHEXSSTARTEND83
53 SEND-VRAM-REGSTARTENDV_REGDAT (40 bytes)83
54 re:RHEXS headerSTARTENDV_REGDAT (40 bytes)83
55 SHEXS (file)STARTEND83
56 re:RECEIVE-VRAM-REGSTARTENDV_REGDAT (40 bytes)83
57 RHEXSTARTEND83Respond with 4c
58 RHEXS (mem)STARTEND83Respond with 54, then send 4d(s)
59 RECEIVE-VRAM-REGSTARTEND83Respond with 56
5a RECEIVE-VRAM-DATASTARTEND83Respond with 4e
5b RHEXS (file)STARTEND83Respond with 4e
5c POKEADDRbyte 183
5d POKE (NetRAM)ADDRbyte 183
5e RUNADDR83
5f PEEKADDR83Respond with 61
60 PEEK (NetRAM)ADDR83Respond with 61
61 re:PEEKbyte 183
62 RECV01 7F 01 7F01 7F 01 7F83Respond with 4b
6383Respond with 4f
64 RCVM83Respond with 51
65 STOP83


Packet 0x15 (PING)

Ping packet type. Every workstation upon receiving of this packet should respond with 0x05 (PONG) packet.

00
01
02
03
04
05
06
F000ADR215ADR1O_STATUS83

Master workstation sends PING to all Slave workstations in turn (01..0F) when idle, to keep list of active Slaves up to date.

Example:

MASTER
SLAVE
15PING
05PONG


Packet 0x06 (ACK)

This packet is used to acknowledge the reception of most Base packets.

00
01
02
03
04
05
06
07
08
09
0a
0b
F000ADR206ADR1U_STATUS83

Example:

MASTER
SLAVE
5cPOKE
06ACK


Packet 0x05 (PONG)

Response to PING (0x15) packet.

00
01
02
03
04
05
F000ADR205ADR183


© tnt23