#include "fcntl.h" #include "stdio.h" #define tpa_plus_one *((int *)6) main() { char *buffer,*dma; char filename[129][15]; unsigned filestart[129]; char tempname[15]; int lastfile,doread,readfile,writefile,rfd,wfd; unsigned size,rndex; int response,assumed,echo,halfbuf; unsigned maxbuf; unsigned i; dma=alloc(128); maxbuf = (unsigned)tpa_plus_one - ((unsigned)dma+128) - (unsigned)4000; maxbuf &= 0xff00; halfbuf=(maxbuf>>1)&0x7fff; buffer=alloc(halfbuf); alloc(halfbuf); fputs("\n\t\t\tSINGLE DRIVE FILE COPY UTILITY\n\n",stdout); fputs("\t\tInsert SOURCE DISK when prompted for disk E:\n",stdout); fputs("\t\tInsert DESTINATION DISK when prompted for disk A:\n\n", stdout); bdos(0xe,0); /*select drive a*/ bdos(0xd,0); /*reset*/ bdos(0x1a,dma); /*set dma address*/ *buffer=5; for(i=1;i<12;i++)*(buffer+i)='?'; *(buffer+12)=0; i=bdos(0x11,buffer); if(i==255)exit(1); lastfile=0; strcpy(&filename[lastfile++][0],dma+1+32*i); while(i!=255) { i=bdos(0x12,0); if(i!=255)strcpy(&filename[lastfile++][0],dma+1+32*i); } fputs("Respond to each file name with:\n",stdout); fputs(" y - yes, copy this file\n",stdout); fputs(" n - no, don't copy this file\n",stdout); fputs(" - respond to remaining files the same way\n\n", stdout); response=0; echo='y'; assumed='E'; for(i=0;i=lastfile) { close(wfd); exit(0); } doread=1; bdos(0x30,0); /*flush buffers*/ filestart[readfile]=0; putchar('\007'); } } } }