-
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
Example dummy message:
message: 01 DB 49 C0 15
message sent: C0 01 DB DD 49 DB DC 15 C0
The Status call returns information about a particular device or about the SmartPort itself. Only Status calls that return general information are listed here.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number (0x00) |
| 1 | SmartPort Unit Number |
| 1 | Status Code |
| Status Code | Meaning |
|---|---|
| $00 | Return device status |
| $01 | Return device control block |
| $02 | Return newline status (character devices only) |
| $03 | Return Device Information Block (DIB) |
Example SLIP Status Request message:
Sequence Number
| Status Command
| | Unit Number
| | | Status Code
| | | |
Apple II -> FujiNet : C0 12 00 01 03 C0
| 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 | 1 = write allowed |
| 5 | 1 = read allowed |
| 4 | 1 = device on line or disk in drive |
| 3 | 1 = format allowed |
| 2 | 1 = media write-protected (block devices only) |
| 1 | reserved; must = 0 |
| 0 | 1 = 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 |
Example SLIP Status Response message:
FujiNet -> Apple II : 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
Sequence Number
The ReadBlock call reads one 512-byte block from the block device specified by the unit number.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number (0x01) |
| 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) |
The WriteBlock call writes one 512-byte block to the block device specified by the unit number.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number (0x02) |
| 1 | SmartPort Unit Number |
| 2 | Block Size* |
| 3 | Block Number |
| n | Block Data |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
The Format call formats a block device. The formatting performed by this call is not linked to any operating system; it only prepares all blocks on the medium for reading and writing. Operating-system-specific catalog information, such as bit maps and directories, are not prepared by this call.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number (0x03) |
| 1 | SmartPort Unit Number |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
The Control call sends control information to the device. The information may be either general or device specific.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number (0x04) |
| 1 | SmartPort Unit Number |
| 1 | Control Code |
| n | Control List |
| Command | Byte | Content |
|---|---|---|
| 'O' | 0 | open |
| 1-2 | payload size | |
| 3 | mode read, write or both | |
| 4 | translation | |
| 5... | url | |
| 'C' | 0 | close |
| 1-2 | payload size of $00 | |
| 'R' | 0 | read |
| 1-2 | payload size | |
| 3... | data | |
| 'W' | 0 | write |
| 1-2 | payload size | |
| 3... | data | |
| 'A' | 0 | accept |
| 1-2 | payload size of $00 | |
| 'D' | 0 | udp destination |
| 1-2 | payload size | |
| 3... | url |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
Example SLIP Control messages:
Apple II -> FujiNet : C0 66 04 07 4F 2B 00 0C 80 4E 3A 48 54 54 50 3A 2F 2F 61 70 69 2E 6F 70 65 6E 2D 6E 6F 74 69 66 79 2E 6F 72 67 2F 69 73 73 2D 6E 6F 77 2E 6A 73 6F 6E C0
. f . . O + . . . N : H T T P : / / a p i . o p e n - n o t i f y . o r g / i s s - n o w . j s o n .
FujiNet -> Apple II : C0 66 00 C0
The Init call causes SmartPort to execute its initialization sequence, causing a hardware reset of all devices and assigning a unit number to each device. This call is not made to a specific unit; rather, it is made to the SmartPort as a whole. This call is executed automatically on system startup or forced cold reset.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number (0x05) |
| 1 | SmartPort Unit Number |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
The Open Request call prepares a character device for reading or writing.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number (0x06) |
| 1 | SmartPort Unit Number |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
Example SLIP Open messages:
Apple II -> FujiNet : C0 65 06 07 C0
FujiNet -> Apple II : C0 65 00 C0
The Close call tells a character device that a sequence of read or write operations has ended. For a printer, this call could have the effect of flushing the print buffer.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number (0x07) |
| 1 | SmartPort Unit Number |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
Example SLIP Close messages:
Apple II -> FujiNet : C0 6C 07 07 C0
FujiNet -> AppleWin : C0 6C 00 C0
The Read Request reads the number of bytes specified by the byte count parameter.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number (0x08) |
| 1 | SmartPort Unit Number |
| 2 | Byte Count |
| 3 | Address |
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Status |
| [n] | Read Data (if Status == $00) |
Example SLIP Read messages:
Apple II -> FujiNet : C0 6B 08 07 0B 00 00 00 00 C0
FujiNet -> Apple II : C0 6B 00 31 37 32 35 38 38 34 32 36 30 0A C0
. k . 1 7 2 5 8 8 4 2 6 0 . .
The Write call writes the number of bytes specified by the byte count to the device specified by the unit number.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number (0x09) |
| 1 | SmartPort Unit Number |
| 2 | Byte Count |
| 3 | Address |
| n | Write Data |
| 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.
| Size | Content |
|---|---|
| 1 | Request Sequence Number |
| 1 | Command Number ($0A) |
| 1 | SmartPort Unit Number |
| 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