Apple II SP over SLIP - FujiNetWIFI/fujinet-firmware GitHub Wiki

SmartPort over Serial Line Internet Protocol (SP-over-SLIP) is related to Apple II Protocol Converter Bus (CBus). From a high-level perspective it transports almost the same data as CBus, but the actual coding of the data is pretty different. The primary difference in the transported data results from the fact that SP-over-SLIP runs on a point-to-point connection while CBus runs - nomen est omen - on a bus.

SP-over-SLIP can be used on any medium providing a transparent, duplex, lossless byte stream. Examples are a TCP connection or a USB CDC-ACM connection.

SP-over-SLIP strictly consists of request/response packets. Every packet is encapsulated in a SLIP frame for two reasons:

  1. SLIP frames allow to detect packet boundaries without parsing the (variable sized) packets.
  2. SLIP frames allow to detect incomplete packets caused by an Apple II Reset during packet transmission.

Every request/response packet starts with a Request Sequence Number for this reason: An Apple II Reset after sending a request but before receiving the response makes the response stay in some TCP or USB related buffer. Now the next send request / receive response sequence receives that wrong, old response. The Request Sequence Number allows to detect (and discard) that response.

Note that on the Apple II implementation, all block sizes are 512 bytes, but the interface is generic, so the size must be specified in the request.

Status Request

Size Content
1 Request Sequence Number
1 Command Number ($00)
1 SmartPort Unit Number
1 Status Code

Status Response

Size Content
1 Request Sequence Number
1 Status
[n] Status List (if Status == $00)

ReadBlock Request

Size Content
1 Request Sequence Number
1 Command Number ($01)
1 SmartPort Unit Number
2 Block Size*
3 Block Number

ReadBlock Response

Size Content
1 Request Sequence Number
1 Status
[N] Block Data (if Status == $00)

WriteBlock Request

Size Content
1 Request Sequence Number
1 Command Number ($02)
1 SmartPort Unit Number
2 Block Size*
3 Block Number
N Block Data

WriteBlock Response

Size Content
1 Request Sequence Number
1 Status

Format Request

Size Content
1 Request Sequence Number
1 Command Number ($03)
1 SmartPort Unit Number

Format Response

Size Content
1 Request Sequence Number
1 Status

Control Request

Size Content
1 Request Sequence Number
1 Command Number ($04)
1 SmartPort Unit Number
n Control List

Control Response

Size Content
1 Request Sequence Number
1 Status

Init Request

Size Content
1 Request Sequence Number
1 Command Number ($05)
1 SmartPort Unit Number

Init Response

Size Content
1 Request Sequence Number
1 Status

Open Request

Size Content
1 Request Sequence Number
1 Command Number ($06)
1 SmartPort Unit Number

Open Response

Size Content
1 Request Sequence Number
1 Status

Close Request

Size Content
1 Request Sequence Number
1 Command Number ($07)
1 SmartPort Unit Number

Close Response

Size Content
1 Request Sequence Number
1 Status

Read Request

Size Content
1 Request Sequence Number
1 Command Number ($08)
1 SmartPort Unit Number
2 Byte Count
3 Address

Read Response

Size Content
1 Request Sequence Number
1 Status
[n] Read Data (if Status == $00)

Write Request

Size Content
1 Request Sequence Number
1 Command Number ($09)
1 SmartPort Unit Number
2 Byte Count
3 Address
n Write Data

Write Response

Size Content
1 Request Sequence Number
1 Status

The Apple II side of SP-over-SLIP is supposed to be implemented using some processor beside the 6502 main processor. This allows the Apple II - in contrast to CBus - to inform the connected devices about a 6502 reset. This can i.e. have a modem drop an active connection or a printer eject a partially printed page.

Reset Request

Size Content
1 Request Sequence Number
1 Command Number ($0A)
1 SmartPort Unit Number

Reset Response

Size Content
1 Request Sequence Number
1 Status