/* OSCPM.H : #include me in CPM version of CPM.c */ /* I am the Operating-system dependant part of CPM.c */ /* BDS C CP/M-80 version */ #include "bios.h" #include "bdos.h" int cdrive; /* diskette drive for CPM (foreign) diskette */ int sdrive; /* BDOS' opinion of current CP/M drive */ /* in both above: 0==A: 1==B: 2==C: .... */ /* first we fight the BDOS: save & restore context */ csave() /* save BDOS state (BDOS is always in a state!) */ BEGIN sdrive=bdos(BDOS_RCD); END crestore() /* restore BDOS state */ BEGIN bios(SELDSK,sdrive); END /* these are the basis for the rest of CPM.c */ cbegin() BEGIN cdrive = tolower(*diskette) - 'a'; sdrive = bdos(BDOS_RCD); bdos(BDOS_RD,1< 0 */ /************************/ bdos(BDOS_SDA,dma); bdosstatus = bdos(BDOS_SFF,fcb); wp=0; zero(wilds,64*11); WHILE (bdosstatus<4) DO copy(&wilds[wp++][0],dma+(bdosstatus<<5)+1,11); bdos(BDOS_SDA,dma); bdosstatus = bdos(BDOS_SFN,fcb); OD wp=0; END wilddebug() BEGIN int i; printf("sts=%xx fcb=",bdosstatus); FOR (i=0; i<33; i++) DO printf("%2x",fcb[i]); OD FOR (i=0; i<128; i++) DO IF (!(i&0x1F)) THEN putchar('\n'); FI printf("%2x",dma[i]); OD putchar('\n'); END int wildnext() /* in: do: find next wild-carded file out: infilnam print name of file wname FCB name of file i.e. trail spaces in name,type ret: TRUE if we got another file */ BEGIN char *i; /* infilnam */ char *w; /* wname */ int retval; /* returned value */ IF (retval=(wp<64&&wilds[wp][0])) THEN copy(wname,&(wilds[wp++][0]),11); FOR (i=infilnam,w=wname; w