/********************************************* READPSK.C READING SOFTWARE FOR .tsIQ FILES May 16th 2004 (C) 2004 J.F. FOURCADIER F4DAY Modified by M0DTS Dec 12th 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; if (argc != 2) { printf("Usage: readpsk "); 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); clrscr(); printf("\nSize of file is: %d Bytes",(filesize)); printf("\nLoading TS File to Memory..."); buf = (unsigned 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("\n\nTransmitting Digital ATV!"); n = 0; disable(); //Disable EVERYTHING! do { do { outportb(data_reg,*(buf+n)); // wait for next state on nAck : do { } while (((inportb(status_reg)) | 0xBF) != 0xFF); n++; outportb(data_reg,*(buf+n)); // wait for next state on nAck : do { } while (((inportb(status_reg)) | 0xBF) == 0xFF); n++; } while (n <= (filesize -1)); n=0; } while(k<=10); //Set number of Transmissions enable(); free(buf); exit(0); }