TRIVIAL NETWORK DISK PROTOCOL * "CAPABILITIES REQUEST" is the only message type that should be broadcast. Everything else should be unicast All fields are in network byte order (hi/lo) FOR ALL MESSAGES Offset meaning $00..$03 signature 'TNDP' (ASCII, high byte clear) $04 1 byte version ID - current version = 1 $05..$06 2 byte xid (echoed back in response) FOR ALL RQS $07 1 byte opcode $00 = CAPABILITIES REQUEST $01 = VOLUME CATALOG REQUEST $02 = READ T/S REQUEST $03 = WRITE T/S REQUEST $04 = INIT VOLUME REQUEST FOR CAPABILITIES REQUEST No further data FOR VOLUME CATALOG REQUEST $08.. requested client system architecture $00 = all architectures (regardless of architecture) $64 = C64 $A2 = Apple 2 $09.. requested file system $00 = Any $01 = RAW / other $02 = Apple DOS 3.3 $03 = PRODOS 8 $04 = Apple CPM $05 = CBM DOS $0A..$0B Catalogue Offset For READ/WRITE: $08..$09 2 byte track # $0A..$0B 2 byte sector # $0C..$0D 2 byte sector length (in bytes) $0E..$4B volume name (null padded 55 bytes) $4C null byte (i.e. filename can be 55 bytes long, MUST be at least 1 null at the 56th byte) FOR WRITE $4d.. sector data FOR INIT VOLUME $00..$3c volume name (up to 56 chars, null padded) $37 null byte $38 system architecture ID $39 file system ID $3A..$3B number of tracks $3C..$3D sector length (in bytes) $3E..$3F ?? FOR ALL RESPONSES $07 1 byte opcode $80 = CAPABILITIES REQUEST RESPONSE $81 = VOLUME CATALOG REQUEST RESPONSE $82 = READ T/S REQUEST RESPONSE $83 = WRITE T/S REQUEST RESPONSE $FF = ERROR RESPONSE FOR CAPABILITIES RESPONSE $07 Maximum supported protocol version $08..$1b 19 byte application name $1c Null byte (so application name is null padded) $1d number of entries in supported architectures/file systems list (must be >=1, since list should always contain at least a "any architecture, any file system" entry, even if the count is 0). $1e.. list of supported architectures/file systems: supported architecture/file systems lists: $00 system architecture ID $01..$02 number of volumes available for this combination of architecture/file system list should be sorted by architecture ID (in descending order) and file system id (in descending order). Each architecture list should end with a file system Id of $00 (any) which is the count of all volumes available for this architecture. The list of supported architectures should end with an entry for architecture ID $00 (any) which should have a single file system ID $00 (any) which should have a count of all volumes available for all architectures on this server. FOR VOLUME CATALOG $08..$09 Total Catalogue Entries $0A..$0B Catalogue Offset (i.e. how many entries are there in the catalogue before the first entry in this response) $0C Number of Entries in this response (maximum of 10) $0D.. the volume catalog entries. for each entry $00..$3c volume name (up to 56 chars, null padded) $37 null byte $38 system architecture ID $39 file system ID $3A..$3B number of tracks $3C..$3D sector length (in bytes) $3E..$3F ?? For READ/WRITE: $04..$05 2 byte track # $06..$07 2 byte sector # $06..$07 2 byte sector length (in bytes) $0A..$49 volume name (null padded 64 bytes) FOR READ $4A.. sector data FOR INIT VOLUME $00..$3c volume name (up to 56 chars, null padded) $37 null byte $38 system architecture ID $39 file system ID $3A..$3B number of tracks $3C..$3D sector length (in bytes) FOR ERROR $04..$05 Error Code $00 = OK $01 = BROADCAST NOT ALLOWED Capabilities Request (opcode=00) are the only message types that can be broadcast. $02 = UNKNOWN OPCODE The client sent a message with an opcode the server does not understand $03 = VERSION NOT SUPPORTED The client sent a message with an protocol version that the server does not support $04 = ARCHITECTURE NOT SUPPORTED $05 = FILE SYSTEM NOT SUPPORTED $06 = INVALID VOLUME NAME $07 = INVALID TRACK NUMBER $08 = INVALID SECTOR NUMBER $09 = INVALID SECTOR LENGTH $FF = INTERNAL SERVER ERROR The server suffered an internal error while processing the request $06..$0b bytes $04..$09 from original request $0c..$4c error message (null padded 63 bytes) $4d null byte