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)

 


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 0x21 is sent as 0x00 0x21; byte 0xFF is sent as 0x01 0x7F.

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
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
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, TALK
47
48 SNDCMD
49 SNDM (first packet)LNGTHbyte 1byte 2bytes NNCHKSUM97/83
4a SNDM (subsequent packets)LNGTHbyte 1byte 2bytes NNCHKSUM97/83
4b re:RECV
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-REGISTERSTARTENDV_REGDAT (40 bytes)83
54 re:RHEXS headerSTARTENDV_REGDAT (40 bytes)83
55 SHEXS (file)STARTEND83
56 re:RECEIVE-VRAM-REGISTERSTARTENDV_REGDAT (40 bytes)83
57 RHEXSTARTEND83Respond with 4c
58 RHEXS (mem)STARTEND83Respond with 54, then send 4d(s)
59 RECEIVE-VRAM-REGISTERSTARTEND83Respond with 56
5a RECEIVE-VRAM-DATASTARTEND83Respond with 4e
5b RHEXS (file)STARTEND83 Respond with 4e
5c POKEADDRbyte 183
5d POKE (NetRAM)ADDRbyte 183
5e RUN
5f PEEKADDR83Respond with 61
60 PEEK (NetRAM)ADDR83Respond with 61
61 re:PEEKbyte 183
62 RECV01 7F 01 7F01 7F 01 7F83
6383Respond with 4f
64 RCVM83Respond with 51
65 STOP83


Packet 0x05 (PONG)

Response to PING (0x15) packet.

00
01
02
03
04
05
F000ADR205ADR183


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 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


CP/M stuff


DIR SLAVE (6H:)

MASTER	SLAVE	PAYLOAD

--- Search First -------------------------
21		00 00 00 08 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e5
	3c	00 58 44 49 52 20 20 20 20 43 4f 4d 00 00 00 10 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ACK
	31	ff 42 00 08 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e5
ACK

--- Search Next -------------------------
22		00 00 00 08 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e5
	3c	00 53 55 42 4d 49 54 20 20 43 4f 4d 00 00 00 0a 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ACK
	32	ff 42 00 08 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e5
ACK

----------------------------
22		00 00 00 08 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e5
	3c	00 4e 55 54 4c 20 20 20 20 43 4f 4d 00 00 00 01 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ACK
	32	ff 42 ff 08 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e5
ACK

----------------------------
2e		00 00 00 08 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e5
	3e	ff 44 00 08 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e5
ACK

---------------------------------------------------------------------------------------------------------------------------------------




COPY MASTER --> SLAVE

MASTER	SLAVE	PAYLOAD
--- Search the first file matched with wildcard --------------------------
21		00 00 00 08 4b 55 4b 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b8
	3c	00 41 4f 4b 20 20 20 20 20 20 20 20 00 00 00 01 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ACK
	31	ff 42 ff 08 4f 52 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b8
ACK

-----------------------------
2e		00 00 00 08 4b 55 4b 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b8
	3e	ff 44 00 08 4f 52 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b8
ACK

--- Delete file --------------------------
23		00 00 00 08 4b 55 4b 20 20 20 20 20 24 24 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3a
	33	ff 42 ff 08 4f 52 20 20 20 20 20 20 24 24 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3a
ACK

--- Create file --------------------------
26		00 00 00 08 4b 55 4b 20 20 20 20 20 24 24 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3a
	36	ff 42 02 08 4f 52 20 20 20 20 20 20 24 24 24 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3a
ACK

-----------------------------
2c		data, 0x97
	ACK
2d		data, 0x97
	ACK
2d		data, 0x83
	ACK

--- Write sequential file --------------------------
25		00 00 00 08 4b 55 4b 20 20 20 20 20 24 24 24 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3a
	35	ff 42 00 08 4f 52 20 20 20 20 20 20 24 24 24 00 00 00 01 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 3a
ACK

--- Close file --------------------------
20		00 00 00 08 41 4f 4b 20 20 20 20 20 24 24 24 00 00 00 01 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 3a
	30	ff 42 02 08 4f 52 20 20 20 20 20 20 24 24 24 00 00 00 01 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 3a
ACK

--- Rename file --------------------------
27		00 00 00 08 41 4f 4b 20 20 20 20 20 24 24 24 00 00 00 00 08 41 4f 4b 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 3a
	37	ff 42 00 08 4f 52 20 20 20 20 20 20 24 24 24 00 00 00 00 00 4f 52 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 3a
ACK
	ACK (?)

© tnt23
Hosted by uCoz