summaryrefslogtreecommitdiff
path: root/ae-protocol.md
blob: 176ef9d71ffecaa27b90e04f2464262d3b7360af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
Overview
========

The AE protocol works by exchanging messages between the Amiga and the Client (e.g. an IBM PC).

Each message consists of a header and optionally payload data. Both parts carry CRC32 checksums
to ensure data integrity. 

Message header
--------------

| Bytes          | Content                      |
| -------------- | ---------------------------- |
| TODO           |                              |

Message types
=============

| Msg  | ID                | Sending side | Description                                               |
| ---- | ----------------- | ------------ | --------------------------------------------------------- |
| 0x00 | MSG_NEXT_PART     | Amiga/Client | Ask for next block                                        |
| 0x01 |                   | Amiga/Client | Transfer cancelled                                        |
| 0x02 | MSG_INIT          | Amiga/Client | Initialisation / Init response                            |
| 0x03 | MSG_MPARTH        | Amiga/?      | Multipart header                                          |
| 0x04 | MSG_EOF           | Amiga        | EOF (no payload)                                          |
| 0x05 | MSG_BLOCK         | Amiga        | Next data block                                           |
|      |                   |              |                                                           |
| 0x08 | MSG_EXISTS        | Amiga        | File already exists (when trying to write with 0x66)      |
| 0x09 |                   | Amiga        | Size ? (response to 0x6c)                                 |
| 0x0a | MSG_ACK_CLOSE     | Amiga        | Close response                                            |
| 0x0b |                   | Amiga        | Format response?                                          |
|      |                   |              |                                                           |
| 0x64 |                   | Client       | List directory                                            |
| 0x65 | MSG_FILE_SEND     | Client       | File read                                                 |
| 0x66 | MSG_FILE_RECV     | Client       | File/folder write                                         |
| 0x67 |                   | Client       | File/folder delete (recursively)                          |
| 0x68 |                   | Client       | File rename (name changes) (works on drives, too?)        |
| 0x69 |                   | Client       | File move (path changes)                                  |
| 0x6a |                   | Client       | File copy                                                 |
| 0x6b |                   | Client       | Set attributes and comment                                |
| 0x6c |                   | Client       | Request size on disk (?)                                  |
| 0x6d | MSG_FILE_CLOSE    | Client       | Close file                                                |
| 0x6e |                   | Client       | Format disk (needs Kickstart 2.0 or newer)                |
| 0x6f |                   | Client       | New folder                                                |

Message details
===============

64 - List a directory
----------------------

### TODO ###


65 - Read a file
-----------------

### TODO ###


0x66 MSG_FILE_RECV - Write a file (PC -> Amiga)
-----------------------------------------------

Payload:

| Bytes          | Content                      |
| -------------- | ---------------------------- |
| 4              | header size                  |
| 4              | file size                    |
| 4              | FIXME ??                     |
| 4              | Attributes FIXME: encoding ? |
| 4              | date (hours since 1/1/78)    |
| 4              | time (mins since midnight)   |
| 4              | ctime                        |
| 1              | file type FIXME: encoding?   |
| header_size-29 | file name                    |

Expected response: 0x00 MSG_NEXT_PART if file does not exist (yet), 0x08 MSG_EXISTS otherwise


67 - Delete file/folder
------------------------

Payload:

     Bytes | Content
    -------|--------------------
         n | Path
         1 | 0x00

Then, read type 0 for confirmation.
Then, sendClose() (0xa response: 5x 00).

If Path is a folder, it will be deleted together with its contents.


68 - Rename file/folder
------------------------

Payload:

     Bytes | Content
    -------|--------------------
         n | Path (including old file name)
         1 | 0x00
         n | New file name (without path)
         1 | 0x00

Then, read type 0 for confirmation.
Then, sendClose() (0xa response: 5x 00).


69 - Move file/folder
----------------------

Payload:

     Bytes | Content
    -------|--------------------
         n | Path (including old file name)
         1 | 0x00
         n | New path to contain file (folder without trailing slash or file name)
         1 | 0x00
	 1 | 0xc9 (?)

Then, read type 0 for confirmation.
Then, sendClose() (0xa response: 5x 00).

If Path is a folder, it will be moved together with its contents.
This command appears to work across devices.


6a - Copy file/folder
----------------------

Payload:

     Bytes | Content
    -------|--------------------
         n | Path (including old file name)
         1 | 0x00
         n | New path to contain file (folder without trailing slash or file name)
         1 | 0x00
	 1 | 0xc9 (?)

Then, read type 0 for confirmation.
Then, sendClose() (0xa response: 5x 00).

If Path is a folder, it will be moved together with its contents.
This command appears to work across devices.


6b - Set attributes and comment
--------------------------------

Payload:

     Bytes | Content
    -------|--------------------
         4 | Attributes
         n | Path
         1 | 0x00
         n | Comment
         1 | 0x00
         4 | Checksum? (seems to be 0x00000000 if comment empty)

Then, read type 0 for confirmation.
Then, sendClose() (0xa response: 5x 00).


6c - Request size on disk (?)
------------------------------------

Payload:

     Bytes | Content
    -------|--------------------
         n | Path
         1 | 0x00

Then, read type 0 for confirmation.
Then, read type 9 for 12 bytes of payload (### TODO ###).
Then, send type 0 to request more data (no payload).
Then, read type 9 for 12 bytes of payload (### TODO ###).
Then, send type 0 to request more data (no payload).
Then, read type 0 signaling end of attributes (no payload).
Then, sendClose() (0xa response: 5x 00).

OR

Then, read type 0 for confirmation.
Then, read type 0 signaling end of attributes (no payload).
Then, sendClose() (0xa response: 5x 00).



6d - Close file
----------------

No payload.

Then, read type 0x0a for confirmation (typical payload: 5 bytes of 0x00).

This is used to finish an operation, such as a directory listing
or renaming a file.


6e - Format disk
-----------------

### TODO ###


6f - New folder
----------------

Payload:

     Bytes |  Content
    -------|--------------------
         n | Parent path
         1 | 0x00

Then, read type 0 for confirmation.
Then, sendClose() (0xa response: 5x 00).

The host will create a new folder in the given path, together with a
matching .info file.
The folder name cannot be chosen, and will be something like "Unnamed1".

To create a folder with a specific name, use 0x66.
Note that 0x66'ing a folder does not seem to set its time.