Hey John,
The implementation in NADSBox is a bit more than just a single API
(Called Condensed List, opcode value 0x0F). Quite some time ago you and
I had discussed an API mechanism for defining and querying extended
capabilities, which is what I implemented in NADSBox. The full story is
this:
1. The client (TS-DOS, TEENY, whatever) issues a QUERY_EXTENDED call
(opcode 0x0E) with a payload being a NULL terminated list of API
extensions it is interested in.
2. The server (NADSBox, LaddieAlpha, etc.) responds with return value
0x14 and a payload indicating which of the requested extensions are
supported.
3. The client then knows which extended API can be used. A sample
would be:
Client issues: 'ZZ", 0x0E, len, "NM BR FD RA CL", 0x00, checksum
Server responds: 0x14, len, "NM=NADSBox
BR=19200,38400,57600,115200 FD=4 RA:Y CL:Y", 0, checksum
with
NM = Server Name
BR = Baud Rate list supported
FD = Number of open files supported at once
RA = Random Access modes for Open/Read/Write
CL = Condensed List
Note that Yes/No items have a ':' separation and non-binary items use
'='. I don't recall why I did this ... probably made the PIC assembly
easier.
Once Condensed List API support has been established, certain extension
can be set using the Set Extended API (opcode value 0x0B). This would
be used for things like setting the baud rate, setting the active File
Descriptor, etc. And example might be:
"ZZ", 0x0B, len, "BR=115200 FD=2", 0, checksum, which would be
followed by a normal 0x12 response from the server.
The API for Condensed List is:
===================
Client request:
-------------
"ZZ", 0x0F, 3, FMT, START_IDX_LSB, START_IDX_MSB, checksum
FMT = Format of the requested list which is a bitfield. If not
bits are set, then 6.2 filename length reporting is requested. Modifiers
are:
- Bit 7 set (0x80) = 8 byte filename request (the part before
the '.')
- Bit 0 set (0x01) = 3 byte extension request
START_IDX = Index of within directory list of 1st file to report
(0xFFFF to start from beginning / reset to beginning). On successive
calls for CondensedList, this value will increase based on the number of
entries that fit into a 128 byte packet (based on requested name length
format).
Server Response:
---------------
0x16, len, first_entry, second_entry, etc., checksum
Each entry:
- Directory entry:
- Reported as "NAME.<>" with no terminating zero (or quotes).
- File entry:
- NAME, ".", EXT, 4-byte Length (LSB first)
- NAME has spaces truncated and has max length of 6 or 8
based on selected format. NAME can be shorter than the selected 6 or 8
characters. The "." always appears and EXT is always 2 or 3 chars
(based on the selected format). Length is 4 bytes to support reporting
files larger than 64K from the server.
- Directory entries have no length associated.
The server fills out a standard packet with 128 byte payload with as
many entries as will fit based on format request and possibly short
filenames.
Ken
On 4/4/16 2:59 PM, John R. Hogerhuis wrote:
On Monday, April 4, 2016, Ken Pettit <[email protected]
<mailto:[email protected]>> wrote:
Hi John,
NADSBox already has an API defined for this and I had started
adding it I believe to NEWDOS. I don't recall how far along I got
on that effort, but I can look.
Ken
Ok. If you let me know what it is I can add it to LaddieAlpha.
-- John.