-
Notifications
You must be signed in to change notification settings - Fork 78
Apple II SP over SLIP
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:
- SLIP frames allow to detect packet boundaries without parsing the (variable sized) packets.
- 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.
A SLIP message consists of a message enclosed by $C0
- if the contents of the message contains a $C0, transmit $DB $DC instead
- if the contents of the message contains a $DB, transmit $DB $DD instead
See SLIP at Wikipedia for more details.
Note: The request/response packet descriptions below are meant to supplement the information in:
- Apple IIc Technical Reference Manual, Chapter 6: Block Device I/O
- Apple IIgs Firmware Reference, Chapter 7: SmartPort Firmware
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number |
| 1 | SmartPort Unit Number |
| 1 | Status Code |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
| [n] | Status List (if Status == $00) |
Note: For Status Code $02 (return newline status), the Status List consists of two bytes. The first byte contains $00 if there is no NEWLINE character, and $80 if there is one. The second byte in the list contains the current NEWLINE character, if it exists.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number |
| 1 | SmartPort Unit Number |
| 2 | Block Size* |
| 3 | Block Number |
* 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.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
| [n] | Block Data (if Status == 0x00) |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number |
| 1 | SmartPort Unit Number |
| 2 | Block Size* |
| 3 | Block Number |
| n | Block Data |
* 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.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number |
| 1 | SmartPort Unit Number |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number |
| 1 | SmartPort Unit Number |
| 1 | Control Code |
| n | Control List |
Note: For Control Code $02 (set newline status), the Control List consists of two bytes. The first byte contains $00 if there is no NEWLINE character, and $80 if there is one. The second byte in the list contains the current NEWLINE character, if it exists.
Note: The Apple II side of SP-over-SLIP is - in contrast to CBus - supposed to be implemented using some processor beside the 6502 main processor. This allows the Apple II to inform the connected devices about a 6502 reset. Doing so can i.e. have a modem drop an active connection or a printer eject a partially printed page. This can be done by sending a Control requestion with Control Code $00 to the connected devices.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number |
| 1 | SmartPort Unit Number |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number |
| 1 | SmartPort Unit Number |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number |
| 1 | SmartPort Unit Number |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number |
| 1 | SmartPort Unit Number |
| 2 | Byte Count |
| 3 | Address |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
| [n] | Read Data (if Status == $00) |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number |
| 1 | SmartPort Unit Number |
| 2 | Byte Count |
| 3 | Address |
| n | Write Data |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
Copyright 2024 Contributors to the FujiNetWIFI project.
Join us on Discord: https://discord.gg/7MfFTvD
- Home
- What is FujiNet?
- The Definition of Done
- Board bring up for FujiNet Platform.IO code
- The Complete Linux CLI Guide
- The Complete macOS CLI Guide
- Development Env for Apps
- FujiNet-Development-Guidelines
- System Quickstarts
- FujiNet Flasher
- Setting up a TNFS Server
- FujiNet Configuration File: fnconfig.ini
- AppKey Registry - SIO Command $DC Open App Key
- CP-M Support
- BBS
- Official Hardware Versions
- Prototype Board Revisions
- FujiNet Development Guidelines
- Atari Programming
- Apple Programming
- C64 Programming
- ADAM Programming
- Testing Plan
- Hacker List
- FujiNet VirtualMachine