DLOAD PROTOCOL

1982

Message-ID: <bnews.microsof.3587>
Newsgroups: net.micro
X-Path: utzoo!decvax!microsof!hanss
From: microsof!hanss
Date: Sun Dec  5 14:14:35 1982
Subject: CoCo DLOAD doc.  170 lines
Posted: Sun Dec  5 00:03:33 1982
Received: Sun Dec  5 14:14:35 1982


Having seen several requests for documentation on the Radio Shack
color computer's DLOAD command, I asked the right person (Mark C,
who does not read news, nor does he have access to uucp) and got
the document below in reply.  Earlier I tried to get it to a previous
requestor by mail and asked for acknowledgement.  Since I didnt get
any I assume the paths didnt work.  Submitting to news is a third
and final resort.

I don't know anything about this stuff so please don't send letters
about it to me.  I'm just forwarding the info since I knew where it
could be found.
			-Hans Spiller
			decvax!microsoft!hanss
 



            Microsoft 6809 Extended Color BASIC
            DLOAD/DLOADM Communications Protocol
        Copyright (c) 1982 by Microsoft Corporation
               Prepared by Mark L. Chamberlin
                      August 31, 1982
 DLOAD/DLOADM Communications Protocol                  Page 2


     DLOAD  and  DLOADM  send   and   receive   packets   of
information  to  and  from  the  host  computer  in order to
download BASIC and machine  language  files.   The  protocol
used  for  sending  these packets was designed to facilitate
detection and correction of transmission errors.

     The  process  of  downloading  a  file  from  the  host
involves  opening  a  file,  and then reading blocks of data
from the file.  The details of this protocol follow.


OPEN FILE -

     1.  BASIC to host - P.FILR

     2.  Host to BASIC - P.FILR

     3.  BASIC to host - 

         1.  8 byte filename, left justified, blank filled

         2.  XOR of the bytes in the filename


     4.  Host to BASIC -

         a) If no errors detected -

         1.  P.ACK

         2.  file type (0=BASIC program, 2=machine language,
             FF=file not found)

         3.  ASCII flag (0=binary file, FF=ASCII)

         4.  XOR of file type and ASCII flag.

         b) If errors detected, P.NAK.

     5.  BASIC - If errors then return to step 1.



READ BLOCK -

     1.  BASIC to host - P.BLKR

     2.  Host to BASIC - P.BLKR

     3.  BASIC to host -

         1.  Block number (most significant 7 bits)
 DLOAD/DLOADM Communications Protocol                  Page 3


         2.  Block number (least significant 7 bits)

         3.  XOR of block number bytes


                                  NOTE

                 The block number  is  a  fourteen  bit,
                 unsigned integer in the range 0 through
                 16383.  It is split into two seven  bit
                 values, each of which is transmitted in
                 the least significant 7 bits of a byte.
                 This  insures that the most significant
                 bit is not set except for the  protocol
                 control characters (e.g., P.BLKR).  For
                 example,  a  block  number  of  511  is
                 transmitted   as  binary  00000011  and
                 01111111.




     4.  Host to BASIC -

         a) If no errors detected -

         1.  P.ACK

         2.  Block  length  in  bytes  (0  through  128,   0
             indicating end of file)

         3.  128 bytes of data


                                  NOTE

                 128  bytes  of  data  must   be   sent,
                 regardless of the block length.  If the
                 block length is less than 128 the extra
                 bytes  are  read by BASIC but not used,
                 so their values are of no concern.



         4.  XOR of block length and data bytes

         b) If errors detected, P.NAK.

     5.  BASIC - If errors then return to step 1.

 DLOAD/DLOADM Communications Protocol                  Page 4


     The control character definitions are:

     1.  P.ACK - Acknowledge - C8 hex.

     2.  P.ABRT - Abort - BC hex.

     3.  P.BLKR - Block request - 97 hex.

     4.  P.FILR - File request - 8A hex.

     5.  P.NAK - Negative Acknowledge - DE hex.


     Additional rules:

     1.  If errors occur during an OPEN  or  READ  sequence,
         BASIC will retry the operation.  For each sequence,
         a  maximum  of  5  tries  is  attempted.   After  5
         unsuccessful  attempts, BASIC transmits a P.ABRT to
         the host and aborts the download, causing  a  BASIC
         IO error to occur.

     2.  If more than  10.4  seconds  pass  while  BASIC  is
         waiting  for  a byte from the host, a timeout error
         occurs.  The operation is  retried  or  aborted  as
         described above.

     3.  If the host receives any unsolicited data, it  quit
         transmitting  and  wait  for  BASIC  to restart the
         sequence.

     4.  The host should never time  out.   It  should  just
         continue to wait.

 
-------

1988 UPDATE

             Microsoft 6809 Extended Color BASIC
             DLOAD/DLOADM Communications Protocol
         Copyright (c) 1982 by Microsoft Corporation
                Prepared by Mark L. Chamberlin
                       August 31, 1982

     DLOAD  and  DLOADM  send   and   receive   packets   of
information  to  and  from  the  host  computer  in order to
download BASIC and machine  language  files.   The  protocol
used  for  sending  these packets was designed to facilitate
detection and correction of transmission errors.

     The  process  of  downloading  a  file  from  the  host
involves  opening  a  file,  and then reading blocks of data
from the file.  The details of this protocol follow.


*note*
   The DLOAD protocol is only supported by Extended Color Basic 1.1
   or older.  It has been removed from 1.2 and newer as it was 
   determined that there was no demand for it.
   
                   Burt Mitchell     28 Jan 88

OPEN FILE -
     1.  BASIC to host - P.FILR
     2.  Host to BASIC - P.FILR
     3.  BASIC to host - 
         1.  8 byte filename, left justified, blank filled
         2.  XOR of the bytes in the filename
     4.  Host to BASIC -
         a) If no errors detected -
         1.  P.ACK
         2.  file type (0=BASIC program, 2=machine language,
             FF=file not found)
         3.  ASCII flag (0=binary file, FF=ASCII)
         4.  XOR of file type and ASCII flag.
         b) If errors detected, P.NAK.
     5.  BASIC - If errors then return to step 1.
READ BLOCK -
     1.  BASIC to host - P.BLKR
     2.  Host to BASIC - P.BLKR
     3.  BASIC to host -
         1.  Block number (most significant 7 bits)
         2.  Block number (least significant 7 bits)
         3.  XOR of block number bytes

NOTE:     The block number  is  a  fourteen  bit,
          unsigned integer in the range 0 through
          16383.  It is split into two seven  bit
          values, each of which is transmitted in
          the least significant 7 bits of a byte.
          This  insures that the most significant
          bit is not set except for the  protocol
          control characters (e.g., P.BLKR).  For
          example,  a  block  number  of  511  is
          transmitted   as  binary  00000011  and
          01111111.

4.  Host to BASIC -
         a) If no errors detected -
         1.  P.ACK
         2.  Block  length  in  bytes  (0  through  128,   0
             indicating end of file)
         3.  128 bytes of data

NOTE:     128  bytes  of  data  must   be   sent,
          regardless of the block length.  If the
          block length is less than 128 the extra
          bytes  are  read by BASIC but not used,
          so their values are of no concern.

         4.  XOR of block length and data bytes
         b) If errors detected, P.NAK.
     5.  BASIC - If errors then return to step 1.


         The control character definitions are:
     1.  P.ACK - Acknowledge - C8 hex.
     2.  P.ABRT - Abort - BC hex.
     3.  P.BLKR - Block request - 97 hex.
     4.  P.FILR - File request - 8A hex.
     5.  P.NAK - Negative Acknowledge - DE hex.

     Additional rules:
     1.  If errors occur during an OPEN  or  READ  sequence,
         BASIC will retry the operation.  For each sequence,
         a  maximum  of  5  tries  is  attempted.   After  5
         unsuccessful  attempts, BASIC transmits a P.ABRT to
         the host and aborts the download, causing  a  BASIC
         IO error to occur.
     2.  If more than  10.4  seconds  pass  while  BASIC  is
         waiting  for  a byte from the host, a timeout error
         occurs.  The operation is  retried  or  aborted  as
         described above.
     3.  If the host receives any unsolicited data, it quits
         transmitting  and  wait  for  BASIC  to restart the
         sequence.
     4.  The host should never time  out.   It  should  just
         continue to wait.

RTS