/********************************************* READPSK.C READING SOFTWARE FOR .tsIQ FILES May 16th 2004 (C) 2004 J.F. FOURCADIER F4DAY Modified by M0DTS Dec 15th 2007 *************************************************/ #include #include #include #include int main (int argc, char *argv[]) { FILE *file; int base = 0x378; // output port address int data_reg = base + 0; int status_reg = base + 1; unsigned char *buf; unsigned long n; int k = 0; int filesize = 0; iopl(3); if (argc != 2) { printf("\nUsage: readpsk \n"); exit(1); } if ((file = fopen(argv[1],"rb")) == NULL) { printf("Error opening file\n"); exit(1); } fseek(file,0,SEEK_END); filesize = ftell(file); rewind(file); printf("\nSize of file is: %d Bytes",(filesize)); printf("\nLoading TS File to Memory..."); buf = (char*)malloc(filesize); if (buf == NULL) { printf("Error allocating memory\n"); exit(1); } if (fread(buf,1,filesize,file) != filesize) { printf("Error reading file.\n"); exit(1); } fclose(file); printf("\nLoaded TS File to Memory"); printf("\n\nTransmitting Digital ATV!\n"); n = 0; k=0; do { asm("cli"); //Pause EVERYTHING! do { outb(*(buf+n),data_reg); // wait for next state on nAck : do { } while (((inb(status_reg)) | 0xBF) != 0xFF); n++; outb(*(buf+n),data_reg); // wait for next state on nAck : do { } while (((inb(status_reg)) | 0xBF) == 0xFF); n++; } while(n <= (filesize -1)); n=0; k++; asm("sti"); //Stop pause printf("%d\n", k); //Display Transmission number } while(k<=0); //Number of times to repeat transmission free(buf); exit(0); }