[Coco] A new DLOAD patch

Christian Lesage hyperfrog at gmail.com
Thu Dec 24 13:12:27 EST 2009

I found a few shortcomings with the DLOAD patch Darren submitted. First, 
it assumes the Disk Extended Color BASIC ROM is present. It won't work 
without this ROM. Second, while this patch restores the exact same code 
as present in the CoCo 1 or 2 with ECB 1.1, it doesn't take into account 
the fact that the baud rate and time out variables ($E6, $E7) are used 
for something else on the CoCo 3. As a result, the time out is not 
handled properly. Third, this patch uses space above $7F00, and is not 
relocatable. This could be an issue with some programs.

So here is another DLOAD patch for the CoCo 3. The baud rate and time 
out variable are now located at $76 and $77 respectively. The actual 
code is placed in at $FA0C. There are 1012 free bytes on the CoCo 3 
starting from this address, so I think it is the perfect location to put 
a non-intrusive patch.

2 POKE&H8C18,&H7E
3 POKE&H8C19,VAL("&H"+AH$)
4 POKE&H8C1A,VAL("&H"+AL$)
6 POKE&H8DC2,&H77
7 POKE&H76,&H2C
8 POKE&H77,&H02
10 A=VAL("&H"+AH$+AL$):I=0
20 READ B$:IF B$="XX" THEN 100
30 POKE A+I,VAL("&H"+B$)
40 I=I+1:GOTO 20
100 DATA FA,0C,BD,A4,29,9D,A5,80,4D,34
110 DATA 02,26,02,9D,9F,BD,A5,78
120 DATA 9D,A5,27,16,BD,B2,6D,81
130 DATA 2C,27,0F,BD,B7,0B,86,B0
140 DATA 5D,27,05,86,2C,5A,26
150 DATA 20,97,76,BD,8C,D0,34
160 DATA 02,86,FD,97,6F,35,02,6D
170 DATA E0,27,12,BD,A5,C7,5D,27
180 DATA 06,BD,AD,19,7E,AC,7C,7E
190 DATA A6,16,7E,B4,4A,7E,8C,85,XX

After you run this program, your CoCo 3 understands two new commands: 
DLOAD, and DLOADM. DLOAD allows you to download a BASIC file in ASCII 
mode. DLOADM allows you to download a machine language program in binary 
mode. The binary format is the same as the one of the .BIN files in DECB.

If you want to put the patch somewhere else in memory, just change the 
first two DATA values.

To change the baud rate, use the following:

1200 baud: POKE&H76,44
2400 baud: POKE&H76,19
4800 baud: POKE&H76,7

9600 baud is not reliable at normal speed, but you can achieve it if you 
use the 4800 baud value and run your CoCo 3 at double speed. The DLOAD 
protocol provides for error checking and retries, so a correct transfer 
is pretty much guaranteed.

Boisy G. Pitre wrote:
> Christian,
> Yes I would.  I take that it would be 7 POKEs and an EXEC?
> BTW, Darren Atkinson sent me an email with the following:
> --
> Hi Boisy, 
> I agree that having to enter a program by hand to bootstrap HDB-DOS would be too painful.  Nevertheless, it is possible to restore the DLOAD command to full functionality on the CoCo 3.  Here is a BASIC program that I use to do this.  Of course, pressing the RESET button destroys DLOAD again.
> 10 CLEAR 50,&H7EFF:A = &H7F00
> 20 READ B$:IF B$="XX" THEN 50
> 30 B=VAL("&H"+B$):POKE A,B
> 40 A=A+1:GOTO 20
> 50 POKE 53040,127:POKE 53041,3
> 100 DATA BD,A4,29,9D,A5,80,4D,34
> 110 DATA 02,26,02,9D,9F,BD,A5,78
> 120 DATA 9D,A5,27,18,BD,B2,6D,81
> 130 DATA 2C,27,11,BD,B7,0B,86,B0
> 140 DATA 5D,27,07,86,2C,5A,10,26
> 150 DATA 35,20,97,E6,BD,8C,D0,34
> 160 DATA 02,86,FD,97,6F,35,02,6D
> 170 DATA E0,27,0F,BD,A5,C7,5D,27
> 180 DATA 06,BD,AD,19,7E,AC,7C,7E
> 190 DATA A6,16,7E,8C,85,XX
> Merry Christmas,
> Darren

More information about the Coco mailing list