As Ethernet and TCP/IP based applications for the C64 have appeared, a standardized method of configuring them would be beneficial to both users and developers.
The configuration file is a binary PRG file. It starts with a magic 2-byte header, and then a section of data chunks. A data chunk has a type, a length, and optional data. The first six chunks are mandatory and must come in the specified order. The last chunk in the file should have the type set to zero, to signal end of file. Other chunks are optional, and may come in any order, as long as they come after the first six chunks, and before the end of file chunk. The maximum size of the configuration file is 254 bytes, or 1 disk block.
The default configuration file should be named "ipconfig-default". Additional configuration files should start with "ipconfig-".
The configuration file starts with the byte pair $ec, $64.
Data chunks start with a type byte, followed by a length byte, and optional chunk data. The length includes the type byte and the length byte itself.
Mandatory Chunks | |||
---|---|---|---|
Type | Length | Data | Description |
0 | N/A | End of file | |
1 | 4 | 2-byte driver code | The driver to use (driver class, product ID) |
2 | 8 | 6-byte MAC address | The MAC adress used for the ethernet card |
3 | 6 | 4-byte address | The IP address |
4 | 6 | 4-byte address | IP netmask |
5 | 6 | 4-byte address | Default gateway IP |
6 | 6 | 4-byte address | Primary DNS server |
Optional Chunks | |||
Type | Length | Data | Description |
7 | 6 | 4-byte address | Secondary DNS server |
8 | 4 | 2-byte speed code | Line speed, values are driver specific |
9 | 2 + N | N bytes PETSCII | Configuration name, in PETSCII |
10 | 2 | Use dynamic configuration (e.g. DHCP or PPP), overriding provided data | |
11 | 2 + N | N bytes PETSCII phone number | Phone number for dialup connections |
Application chunks | |||
Type | Length | Data | Description |
128 | 6 | 4-byte PETSCII ID | Application ID |
129-255 | Application specific data |
RS-232 interfaces | ||
---|---|---|
Class | ID | Product |
$01 | $01 | User port |
$01 | $02 | Swiftlink |
$01 | $03 | Turbo232 |
$01 | $04 | Silver Surfer |
$01 | $05 | DUART |
Ethernet cards | ||
Class | ID | Product |
$02 | $01 | TFE |
$02 | $02 | RR-Net |
$02 | $03 | ETH64 |
Chunk types 128-255 are reserved for application specific use. If they are used, chunk 128 should be present and appear before any other application chunks.
Minimal config file, providing only the mandatory fields:
.byte $ec, $64 ; Magic ID .byte 1, 4, $02, $02 ; RR-Net .byte 2, 8, $0c, $64, "P", "O", 74, 04 ; MAC address .byte 3, 6, 192, 168, 0, 64 ; IP address .byte 4, 6, 255, 255, 255, 0 ; Netmask .byte 5, 6, 192, 168, 0, 1 ; Gateway .byte 6, 6, 192, 168, 0, 1 ; Primary DNS .byte 0 ; EOF
DHCP configuration, using the RR-Net driver:
.byte $ec, $64 ; Magic ID .byte 1, 4, $02, $02 ; RR-Net .byte 2, 8, $0c, $64, "P", "O", 74, 04 ; MAC address .byte 3, 6, 0, 0, 0, 0 ; IP address .byte 4, 6, 0, 0, 0, 0 ; Netmask .byte 5, 6, 0, 0, 0, 0 ; Gateway .byte 6, 6, 0, 0, 0, 0 ; Primary DNS .byte 10, 2 ; DHCP .byte 9, 6, "DHCP" ; Profile called "DHCP" .byte 0 ; EOF
PPP dialup using Turbo232:
.byte $ec, $64 ; Magic ID .byte 1, 4, $01, $03 ; Turbo232 .byte 2, 8, 0, 0, 0, 0, 0, 0 ; MAC address .byte 3, 6, 0, 0, 0, 0 ; IP address .byte 4, 6, 0, 0, 0, 0 ; Netmask .byte 5, 6, 0, 0, 0, 0 ; Gateway .byte 6, 6, 0, 0, 0, 0 ; Primary DNS .byte 10, 2 ; Dynamic address .byte 11, 11, "020795611" ; Phone number .byte 9, 7, "Felia" ; Profile called "Felia" .byte 0 ; EOF
As the first six chunks are mandatory, a quick and dirty implementation could just load the config file into memory. If you load the config file at $cf00, the MAC address would be at $cf06, the IP address at $cf0e, and so on. For some applications (like RR-Net transfer tools) this is preferable over having to write a full config parser for a bunch of options that the application doesn't support.
Please let me know if you have any comments, changes, or additions.