Skip to content

Apple II SP over SLIP

Norman Davie edited this page Sep 2, 2024 · 30 revisions

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 Code Meaning
$00 Return device status
$01 Not supported
$02 Not supported
$03 Return Device Information Block (DIB)
$04 Return Device Information Block (DIB), extra
$05 Return last error status
$06 Return bytes/block parameter for device
                           Sequence Number
                            |  Status Command
                            |  |  SmartPort
                            |  |  |  Status Code
                            |  |  |  |
AppleWin -> FujiNet : b'c0 12 00 01 03 c0' - STATUS DEVICE CODE
FujiNet -> AppleWin : b'c0 12 00 fc 18 01 00 0e 46 55 4a 49 4e 45 54 5f 44 49 53 4b 5f 30 20 20 01 40 01 0f c0'
                            |  |  |  |     |  | |---16 bytes always                              |  | |   | 
                            |  |  |  |     |  | |F  U  J  I  N  E  T  _  D  I  S  K  _ 0      |  |  | Firmware
                            |  |  |  |     |  String Length                                      |  | Version
                            |  |  |  |    /                                                      |  Subtype
                            |  |  |  Blocks on device (3 bytes)                              Device Type
                            |  |  General Status Byte
                            |  Status Command
                           Sequence Number

Status Response

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

General Status Byte

Bit Meaning
7 0=Character Device 1=Block Device
6 Read Allowed
5 Write Allowed
4 Device Ready
3 0=Format Allowed
2 0=Write Protected (Block devices only)
1 Device currently interrupting
0 Device currently open (Character devices only
Type Subtype Device
$00 $00 Apple II memory expansion card
$01 $00 Apple 3.5 drive
$01 $40 UniDisk 3.5
$02 ProFile™ hard disk
3-9 Reserved
$0A 5.25-inch disk
B-F Reserved

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

Clone this wiki locally