home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ENTERPRS
/
CPM
/
UTILS
/
A
/
CCP105P.ARC
/
PUTCCP.C
< prev
next >
Wrap
Text File
|
1986-10-17
|
2KB
|
105 lines
/*
* This program installs a CCP onto a MDK-Format Double Density
* disk, geting the data from the declared filename.
* The file's data is transferred directly, not taking into account
* the 100H "load-offset".
*
* The CCP is located in sectors 9-16 (inclusive) of track-1 (4K).
*
* Sectors are 0.5K each.
*
* Written 9/1986 by Michael D. Kersenbrock
*/
#include "c:stdio.h"
FILE *Infile;
char Buffer[5000];
struct block {
char funct;
char areg;
int bcreg;
int dereg;
int hlreg;
} Biospb;
main(argc,argv)
int argc;
char *argv[];
{
register int sector;
register int temp;
if (argc != 2) {
Usage();
exit(1);
}
if ((Infile=fopen(argv[1],"r")) == NULL ) {
fprintf(stderr,"\nCan't open file: %s\n",argv[1]);
Usage();
exit(2);
}
for (sector = 0 ; sector < 4096 ; sector++) {
if ((temp= getc(Infile)) == EOF)
break;
Buffer[sector] = temp;
}
fclose(Infile);
for (sector = 9 ; sector <= 16 ; sector++) {
/*
* Set track number
*/
bioscall(10,1,0);
/*
* Set sector number
*/
bioscall(11,sector,0);
/*
* Set the dma bank to '1'
*/
bioscall(28,0,1);
/*
* Set dma address
*/
bioscall(12,&Buffer[(sector-9)*512],0);
/*
* Write sector
*/
bioscall(14,1,0);
}
}
bioscall(number,bc,a)
int number;
int bc;
int a;
{
Biospb.funct = number;
Biospb.bcreg = bc;
Biospb.areg = a;
return(bdos(0x32,&Biospb));
}
Usage()
{
fprintf(stderr,"\nUsage: putccp <filename-where-to-get-it>\n");
}
t argc;
char *argv[];
{
register int sector;
register int temp;
if (argc