CARTLOAD

Color BASIC, Extended Color BASIC, CoCo 3 BASIC, and Disk Extended Color BASIC call all be discussed here.

CARTLOAD

Postby BillO » Sun Mar 25, 2018 3:23 pm

COCO Cartridge files (.CCC files) are meant to be uploaded by a suitable emulator on a PC or burned into EPROM for use on real hardware. While they are binary files, they do not conform to the COCO binary file format and so do not contain any preamble or postamble information that would tell LOADM what to do with them. Because of this they cannot be loaded into the COCO's memory in the usual way. You might very well ask why someone would want to load a non-conforming binary file into a COCO in the first place. Well, to burn them into the flash RAM of a COCO SDC, that's why.

You can find out more about the COCO SDC here: http://www.cocowares.com/item.php?nombre=CoCo%20SDC

The COCO SDC does provide a means to copy cartridges directly, but you need an MPI and a physical cartridge to do this. If you don't have an MPI and cartridge, or don't want do a lot of manual editing of binary files with a binary editor to manually add the pre & post amble, well, your a bit out of luck . Until now. This program will search a disk (including over Drivewire) for COCO cartridge files (.CCC extension) and load them into flash RAM banks on a COCO-SDC device. It's a bit slow (it's BASIC after all...) but it gets the job done without the need for an MPI or a physical cartridge and is quicker and easier than editing binary files.

In my development and testing I downloaded the .CCC files from colorcomputerarchive.com and used TOOLSHED to load them into a .dsk disk image which I then mounted in Drivewire. The COCO SDC incorporates a DW client that allows you access to 2 DW virtual drives, so using this program you can load whatever cartridge images you want onto your SDC.

I developed this on a COCO 3, but it should run on anything except a very early model COCO 1 (see the SDC documentation for details). If you have any questions about using it - just ask.

Code: Select all
10 ' THIS PROGRAM WILL SEARCH
20 ' A DISK FOR CARTRIDGE
30 ' FILES WITH AN EXTENSION
40 ' OF .CCC THEN ALLOW THE
50 ' THE USER TO CHOOSE ONE
60 ' TO LOAD INTO A FLASH RAM
70 ' BANK ON A COCO SDC DEVICE
80 '
90 ' IT IS WRITTEN IN BASIC
100 ' SO IT IS QUITE SLOW
110 ' (ABOUT 20 SEC/KB) BUT
120 ' IT GETS THE JOB DONE.
130 '
140 '
150 ' RESERVE SPACE FOR
160 ' STRINGS AND A 16K MEMORY
170 ' BUFFER
180 '
190 CLEAR 1600, &H3FFF
200 '
210 '
220 ' INITIALIZE VARIABLES AND
230 ' ARRAYS
240 '
250 BF=&H4000:NS=8:BY=0:DJ=0
260 DIM NA$(71), EX$(71), GR(71)
270 CLS:PRINT "           CARTLOAD":PRINT
280 PRINT "   LOAD CARTIDGE FILES INTO"
290 PRINT "      FLASH RAM ON A COCO-SDC"
300 PRINT "            DEVICE"
310 PRINT
320 '
330 '
340 ' GET THE SOURCE DRIVE
350 '
360 INPUT "ENTER SOURCE DRIVE";DR
370 PRINT
380 '
390 '
400 ' READ THE DIRECTORY OF THE
410 ' SOURCE DRIVE
420 '
430 FOR DS=3 TO 11
440 DSKI$ DR,17,DS,A$,B$
450 C$=A$+LEFT$(B$,127)
460 FOR N=0 TO 7:FLD=N*32+1
470 EX$(DJ)=MID$(C$,FLD+8,3)
480 '
490 '
500 ' IF IT IS A CARTRIDGE FILE
510 ' (.CCC EXTENSION) THEN GO
520 ' ADD IT TO THE LIST
530 '
540 IF EX$(DJ)="CCC" THEN GOSUB 1740
550 NEXT N
560 NEXT DS
570 '
580 '
590 ' IF WE FOUND CCC FILES
600 ' PRINT OUT THE LIST OF
610 ' FILES WE HAVE FOUND AND
620 ' ASK THEM TO CHOOSE ONE
630 ' OTHERWISE GO TELL THEM
640 ' THERE WERE NO FILES
650 ' FOUND
660 '
670 IF DJ=0 THEN GOSUB 1840:GOTO 80
680 FOR I=0 TO DJ-1
690 PRINT I;NA$(I);".";EX$(I);" ";
700 NEXT I
710 PRINT
720 PRINT:PRINT "CHOOSE A FILE ( 0 -";DJ-1;")";
730 INPUT N
740 '
750 '
760 ' PULL UP THE FIRST GRANULE
770 ' OF THE CHOSEN FILE AND
780 ' TELL THEM WHAT WE ARE
790 ' DOING
800 '
810 GR=GR(N)
820 CLS:PRINT "READING ";NA$(N);" INTO MEMORY."
830 PRINT
840 PRINT "THIS PROGRAM IS WRITTEN IN BASIC SO THIS MAY TAKE A WHILE..."
850 PRINT
860 '
870 '
880 ' GET THE FILE ALLOCATION
890 ' TABLE THEN GO GET THE
900 ' THE INFORMATION WE
910 ' NEED TO READ THE FILE
920 '
930 DSKI$ DR,17,2,AT$,B$
940 GOSUB 1610
950 '
960 '
970 ' NOW READ THE FILE...
980 ' SECTOR BY SECTOR AND
990 ' PLACE IT IN THE BUFFER
1000 ' BYTE BY BYTE...
1010 '
1020 FOR SE=SS TO SS+NS
1030 PRINT ".";
1040 DSKI$ DR,TR,SE,S1$,S2$
1050 VP=VARPTR(S1$)
1060 VA=256*PEEK(VP+2)+PEEK(VP+3)
1070 FOR I=0 TO 127
1080 Z=PEEK(VA+I)
1090 POKE BF,Z
1100 BF=BF+1:BY=BY+1
1110 NEXT I
1120 PRINT".";
1130 VP=VARPTR(S2$)
1140 VA=256*PEEK(VP+2)+PEEK(VP+3)
1150 FOR I=0 TO 127
1160 Z=PEEK(VA+I)
1170 POKE BF,Z
1180 BF=BF+1:BY=BY+1
1190 NEXT I
1200 NEXT SE
1210 GR=X
1220 IF GR>0 GOTO 940
1230 '
1240 '
1250 ' CALCULATE THE NUMBER OF
1260 ' BYTES READ AND ASK THEM
1270 ' WHICH BANK THEY WANT TO
1280 ' LOAD UP
1290 '
1300 CL=BY-16128
1310 IF CL>1 THEN BY=BY-CL
1320 PRINT:PRINT
1330 INPUT"LOAD INTO WHICH FLASH BANK (1-7)";BK
1340 PRINT:PRINT "LOADING";BY;"BYTES TO BANK";BK
1350 '
1360 '
1370 ' GET THEM TO MAKE SURE
1380 ' THEN ERASE THE BANK AND
1390 ' WRITE THE CONTENTS OF
1400 ' THE BUFFER TO IT
1410 '
1420 INPUT"OKAY (Y/N)"; OK$
1430 IF OK$<>"Y" THEN PRINT "ABORTING...":END
1440 KILL MEM @BK
1450 WRITE MEM @BK,&H4000,&HC000,BY
1460 '
1470 '
1480 ' WE'RE ALL DONE...
1490 '
1500 PRINT:PRINT "DONE!"
1510 END
1520 '
1530 '
1540 ' SUBROUTINES...
1550 '
1560 '
1570 ' GET TRACK, START SECTOR
1580 ' AND NEXT GRANULE FROM
1590 ' CURRENT GRANULE
1600 '
1610 Y=ASC(MID$(AT$,GR+1,1))
1620 IF Y>=192 THEN NS=Y-193:X=0
1630 IF Y<192 THEN X=Y
1640 M=GR/2
1650 TR=INT(M)
1660 SS=1+9*INT(.6+M-TR)
1670 IF GR>33 THEN TR=TR+1
1680 RETURN
1690 '
1700 '
1710 ' GET NAME AND FRIST GRANULE
1720 ' FOR EACH FILE
1730 '
1740 NA$(DJ)=MID$(C$,FLD,8)
1750 GR(DJ)=ASC(MID$(C$,FLD+13,1))
1760 DJ=DJ+1
1770 RETURN
1780 '
1790 '
1800 ' TELL THEM IF THERE ARE NO
1810 ' CARTRIDGE FILE (.CCC) ON
1820 ' THIS DISK
1830 '
1840 PRINT"NO CARTIDGE FILES ON THAT DRIVE!"
1850 FOR T=0 TO 2000:NEXT T
1860 RETURN
User avatar
BillO
 
Posts: 10
Joined: Wed Mar 07, 2018 9:19 am
Location: The deep woods of Central Ontario

Return to CoCo BASIC

Who is online

Users browsing this forum: No registered users and 1 guest

cron