Dragon 64 DLOAD/DLOADM help request

A place to discuss everything Dragon related that doesn't fall into the other categories.
Post Reply
Sam64
Posts: 1
Joined: Sat Nov 09, 2013 11:16 pm

Dragon 64 DLOAD/DLOADM help request

Post by Sam64 »

Hello all,

Please can anyone tell me what type of program file (.bas,.cas etc?) can be loaded, using the DLOAD or DLOADM command for the Dragon 64 serial port?
Also, does it use the standard 1200 BAUD rate, does a delay between sending bytes need to be set and how long would it take to load a program?

I've soldered a cable for connecting the Dragon's 7 pin DIN serial port to a 9 pin D-sub USB serial adapter (Rx-Tx, Tx-Rx, DTR-CTS,CTS-DTR) and successfully adapted the BASIC programs in the Dragon 64 Supplement into one program for sending/receiving text. A 'conversation' can be had between the Dragon and my PC via the 'Terminal' software (free download), so I know the cable and port both work. Due to the Dragon's registry FF04 only receiving and dealing with one character at a time and hence the program loop needing time to repeat, Terminal has to be set to a minimum 48ms delay between sending bytes, so all the characters which are sent as a sentence can be accepted sequentially and make sense.

Terminal has a facility for sending files. However, when I try using the DLOAD or DLOADM command on the dragon (I've tried .cas and .bas type files) I get no joy. Also, after typing DLOAD pressing ENTER, the only change on the screen is that the cursor disappears (whereas with CLOAD, as we all know, the screen clears and 'S' for search flashes in the top left corner). I realise I could be barking up the wrong tree, but want to be sure, before giving up.

Thank you in anticipation of some advice.
User avatar
tormod
Posts: 416
Joined: Sat Apr 27, 2013 12:06 pm
Location: Switzerland
Contact:

Re: Dragon 64 DLOAD/DLOADM help request

Post by tormod »

Sam64 wrote:Terminal has a facility for sending files. However, when I try using the DLOAD or DLOADM command on the dragon (I've tried .cas and .bas type files) I get no joy. Also, after typing DLOAD pressing ENTER, the only change on the screen is that the cursor disappears (whereas with CLOAD, as we all know, the screen clears and 'S' for search flashes in the top left corner). I realise I could be barking up the wrong tree, but want to be sure, before giving up.
Hi Sam64, welcome to the forum!

The DLOAD command uses a particular protocol, it doesn't just receive a stream (such that Terminal sends). You will need a DLOAD server on the host computer. See https://gitorious.org/m6809-computer-tools/dload-server - I have been brushing up an old server I found on the internet. It works on Linux and MacOSX but not as-is on Windows if that is what you are using (maybe it just needs more detailed configuration of the serial port).

To get higher transfer speeds you can use bit-banging on the printer port instead of the built-on serial port, see viewtopic.php?f=5&t=781
KenH
Posts: 182
Joined: Fri Oct 12, 2012 9:50 am

Re: Dragon 64 DLOAD/DLOADM help request

Post by KenH »

For additional reference, here is a copy of the official Microsoft documentation of the DLOAD protocol.

Code: Select all

             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.

Source:
https://groups.google.com/forum/#!msg/n ... xC4wSwHUMJ
Post Reply