ParlorNet
Turn-based game server for any computer, old or new
Clients | Protocols | Browsers | Telnet programs | Docs | Source

Online Backgammon 1.7 (Atari ST): the peer-to-peer serial protocol

Status: research notes, 2026-11-21. Every fact carries a source tag like [S1] (list in section a). Anything not backed by a source is marked UNVERIFIED. Code locations are offsets into the program's TEXT segment (TEXT:0x5848).

Method: static analysis only. The ST disk image was read with a small FAT12 reader in Python. The GEMDOS program header and relocation table were parsed, and the 68000 code was disassembled with capstone 5. The program is compiled BASIC: its runtime raises errors as [1][Error +111][Return] alerts, the GFA-BASIC 3 style (compiler identity UNVERIFIED). User code calls the runtime through a4 (a4 = 0x13B80 after start-up) and keeps variables at negative offsets from a5. The runtime entry points for OUT, INP and INP? were identified by following them to their BIOS trap #13 calls. Nothing was run and no modem or serial port was used.

Key findings in brief

  1. No server. Online Backgammon links two STs directly over the ST serial port (BIOS device 1, AUX), normally through two Hayes modems. One side dials (ATDT/ATDP + number) and the other sets auto-answer [S1][S2]. The program never waits for CONNECT. It treats any byte on AUX as from the peer. A null-modem cable or any serial-to-TCP bridge works the same way as a modem call.
  2. Serial settings: Rsconf(baud, 1, -1, -1, -1, -1): XON/XOFF flow control, UCR unchanged (the TOS default is 8 data bits, no parity, 1 stop: UNVERIFIED for a given machine). Default 1200 baud [S1].
  3. Framing: one byte stream, no packets, no checksums, no acknowledgements. Bytes 0x20-0x7E and CR (0x0D) are chat text. Each game message is a single opcode byte of 0xBF or above, followed by a fixed number of binary operand bytes. The receiver reads those operand bytes straight after the opcode [S1]. One request/response pair exists (position verification).
  4. Each side rolls its own dice and sends them (BF d1 d2). The board is "free and open": the program checks only hits and bar entry, not moves [S2]. Moves are sent one checker step at a time, as the player makes them (E5 from to). Passing the turn (E4) makes the other side roll automatically.
  5. Coordinates: each ST numbers the board from its own seat. The peer's numbering is the same board turned 180 degrees, i.e. index i in 1..12 <-> i+12. The sender converts before sending. 25 = bar, 26 = off, unchanged [S1].
  6. Feasibility: a ParlorNet "virtual peer" on a serial or modem line is possible, and the protocol is small (ten opcodes). It conflicts with backgammon/1's model in two ways. The ST rolls its own player's dice, so the server cannot be authoritative for that player's rolls. And the cube has no take/drop message. A bridge needs a ruleset option for client-supplied dice, and must re-synchronise the ST's free board with FE when the server rejects a step. Low to medium value; see section g.

(a) Sources

(b) Connection details

ItemValueSource
PortST serial port, BIOS device 1 (AUX). Output Bconout(1, b), input Bconin(1), polled with Bconstat(1) (runtime TEXT:0xF05C, 0xF876, 0xF864)[S1]
Serial setupXBIOS 15 Rsconf(speed, 1, -1, -1, -1, -1) at start-up (TEXT:0x110), after the baud dialog (0x98D2) and on entering the terminal screen (0x68EE). Flow control 1 = XON/XOFF. UCR, RSR, TSR and SCR are left unchanged[S1]
Default speedRsconf code 7 = 1200 baud (TEXT:0x10A). The manual recommends 1200[S1][S2]
Baud dialog"Choose baud rate. 300 / 1200 / 2400". As compiled: button 1 sets code 9 (300), then a second test of button 1 overwrites it with code 4 (2400). Button 2 sets code 7 (1200). Button 3 changes nothing (TEXT:0x9890-0x98BA). So "300" gives 2400 and "2400" keeps the previous speed. Whether this is a source bug or a deliberate remap is UNVERIFIED[S1]
DialPulse/tone dialog, then ATDP<number> or ATDT<number> followed by CR. Every character is masked with 0x7F and sent with OUT 1 (TEXT:0x664C, 0x687E, 0x689C)[S1]
Auto answermenu item sends ATS0=1 CR then ATZ CR, in that order (TEXT:0x991C-0x9940). On most Hayes modems ATZ reloads the stored profile and may clear S0=1. The manual also suggests typing ATA in the terminal screen when the phone rings[S1][S2]
Terminal screenfull-screen dumb terminal: received bytes masked to 7 bits and printed (CR also prints LF). Typed keys are sent raw. CR is sent as CR LF, local echo optional ("Full=no echo / Half=echo"). Leaves on a mouse click (TEXT:0x68BE)[S1][S2]
Connect detectionnone. The game screen's receive loop (TEXT:0x533A) polls Bconstat(1) and dispatches every byte, whatever its origin[S1]
Displaymonochrome high resolution only ("requires a mono monitor")[S1][S2]

(c) Board model

Two arrays of 27 entries (indices 0..26): count A[i] (checkers on point i) and colour B[i] (1 = light, 2 = dark, 0 = none) [S1] (TEXT:0x6102-0x62F6).

(d) Message catalogue

Receive dispatch is SELECT on each byte (TEXT:0x5848) [S1]:

BytesNameSender / whenReceiver action
20-7Echat charactertyped chat line, sent whole when the player presses RETURN, each character AND 0x7F (TEXT:0x650E -> 0x664C)appended to the incoming chat line (up to 79 characters shown)
0Dend of chat lineafter a chat lineshows the line in the message area
other bytes below BF, and LF--ignored
D3new-game request from darkdark player picks "Begin a new game" (TEXT:0x971E)acted on only by the light side: records the peer's request. If the local request is also set, the game starts, otherwise the screen shows the opponent's request
D4new-game request from lightlight player picks "Begin a new game" (TEXT:0x977E)acted on only by the dark side, as above
xx yy (no opcode)opening dicethe dark side, right after both requests are exchanged: rolls one die each (dark, light), re-rolls ties, sends the two raw bytes (1..6) (TEXT:0x7662-0x7686)the light side waits for exactly two bytes (TEXT:0x7780). Higher die moves first. The top die is dark's, the bottom light's [S2]
BF d1 d2dice rollthe side whose turn begins, after it rolls (INT(RND*6)+1 twice, TEXT:0x6E16, 0x6E58). Values 1..6if not our turn: store and show the opponent's dice (TEXT:0x5406)
E5 f tone checker stepafter each local step on our turn, if not in manual (computer) mode. f and t are 200 + index in the receiver's numbering (1..24 shifted by 12; 25 and 26 unchanged), so 0xC9-0xE2 (TEXT:0x65EE, 0x6CE6)if not our turn: subtract 200 and perform the step as if clicked, including hits (TEXT:0x6D1C)
E4pass (end of turn)PASS button on our turn (TEXT:0x52FA). The sender's turn endsif not our turn: our turn begins, and **we roll at once and send BF d1 d2** (TEXT:0x54DA)
F0cube turnedclick on the cube square on our turn (TEXT:0x52A0); also when the opening winner chooses "Roll" with the opening-roll option (then followed by BF)if not our turn: double the displayed cube and flash it (TEXT:0x54F6)
F2position verification requestOptions / Position verification, after "Compare positions on both players boards?" (TEXT:0x6A30)replies at once with F1 + 52 bytes (below), whatever the turn
F1 (A1 B1 ... A24 B24) A25 B25 A26 B26position dumpreply to F2: counts and colours in the sender's numbering, unshifted (TEXT:0x550C)read only by the requester, which busy-waits for it. It stores sender 1..12 as its 13..24 and 13..24 as 1..12, compares, and reports "boards are correct" or "do NOT match" (TEXT:0x6A3A). If the first byte is not F1, the check is silently abandoned
FE (A1 B1 ... A24 B24) A25 B25 A26 B26 turn cubetransmit positionsOptions / Transmit positions (TEXT:0x841C). turn = sender's turn flag (0/1), cube = displayed cube value as one byteoverwrites the board with the same 12-point rotation; our turn = 1 if turn was 0, else 0; cube set to cube; full redraw (TEXT:0x559C)

Notes [S1]:

(e) Sample exchange

Dark ST (D) and light ST (L), both connected; hex bytes.

D->L  48 69 20 42 6F 62 0D                 "Hi Bob" CR (chat)
D->L  D3                                    dark requests a new game
L->D  D4                                    light requests; both sides now start
D->L  05 03                                 opening dice: dark 5, light 3 -> dark moves first,
                                            playing the 5-3 (opening-roll option off)
D->L  E5 CD D2                              step 8->3 in dark's own numbering = dark index
                                            17->22 = light index 5->10, sent as 200+5, 200+10
D->L  E5 CF D2                              step 6->3 (dark index 19->22 = light 7->10)
D->L  E4                                    pass
L->D  BF 06 02                              light rolls 6-2 automatically and sends it
L->D  E5 ...                                light's steps
L->D  E4
D->L  BF 04 04                              dark rolls
...
D->L  F2                                    dark asks to verify
L->D  F1 + 52 bytes                         light's board

(f) Unverified items

  1. UCR and parity: the program never sets them, so they depend on TOS defaults and earlier programs. 8N1 is assumed.
  2. Whether XON/XOFF filtering in TOS can swallow operand bytes 0x11 or 0x13. No operand reaches those values in normal play (counts are at most 15), so it is probably harmless.
  3. The opening-roll option: the manual says that with the option off the first player's dice "are automatically rolled again". The code shows the winner playing the opening dice, with no BF sent (TEXT:0x7720, 0x7846). Only the "Roll" choice sends F0 and a new BF. A live test would settle it.
  4. What index 26 holds after bearing off (count of borne-off checkers of one colour, or a transient) was not traced in full.
  5. The baud dialog mapping (section b) as the author intended.
  6. The exact screen geometry (which row is top) does not matter for the protocol and was not settled. The manual describes the local player moving counter-clockwise from upper right to lower right [S2].

(g) Feasibility verdict

Possible, as a "virtual peer", but a poor fit for a server-authoritative table. What a ParlorNet bridge would have to do:

  1. Link: present a serial line at 1200 baud, 8N1, XON/XOFF. It can be a modem answering the ST's ATDT call, a null-modem cable to a host serial port, or an emulator's serial port redirected to TCP. The bridge needs no modem dialogue beyond what the line itself requires. The ST user can also stay in the terminal screen first. That gives a plain-text lobby: the bridge's printable text and CR show up as chat lines.
  2. Colour: take the colour the ST user did not choose. The bridge can tell the user by chat ("You should play light...").
  3. Start: answer the ST's D3/D4 with the other one. If the bridge is dark, send the two opening dice as raw bytes. If light, read two raw bytes.
  4. Bridge's turns: send BF d1 d2 with the server's dice, then one E5 f t per step of the server's move, translated into the ST's numbering (our absolute point to the ST index via section c, plus 200), then E4.
  5. ST player's turns: after the bridge's E4, the ST rolls by itself and sends BF. The server must accept those dice. backgammon/1 rolls on the server, so this needs a ruleset option such as dice=client for this seat, or a bridge that refuses the roll and repairs the board. Then read E5 steps, check each with the server, and on E4 commit. When the server rejects a step, the ST board is already wrong ("free and open"). The bridge then sends FE with the server's position, and chat text with the reason.
  6. Cube: an F0 from the ST means "I double". There is no take/drop opcode. The bridge must ask by chat (for example "type TAKE or DROP") and read the answer from chat text. For its own doubles, it sends F0 and parses the ST player's chat reply.
  7. Health: after every turn, the bridge may send F2 and compare the F1 reply with the server position, or simply send FE.

Effort: small code (ten opcodes), but it needs a serial or modem bridge plus two backgammon/1 extensions: client-supplied dice for one seat, and a cube take/drop path. Confidence: high for the opcodes, operand layouts and coordinate rotation, which were read from the code. Medium for the opening-roll behaviour and the auto-answer sequence. Value: low. It is a 1991 freeware program for monochrome STs, and modem-to-modem play is its only network mode.

This doc on GitHub


 These pages cover every ParlorNet server. | Source code | ParlorNet is free software.