/[projet1]/public/pc/tools/oric/4k8/4k8totap.c
Defence Force logotype

Diff of /public/pc/tools/oric/4k8/4k8totap.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1185 by mmu_man, Thu Apr 26 21:22:08 2012 UTC revision 1186 by Jylam, Wed Sep 17 20:44:27 2014 UTC
# Line 5  int sync_ok=0; Line 5  int sync_ok=0;
5  int offset;  int offset;
6  FILE *in, *out;  FILE *in, *out;
7    
8  main(int argc,char **argv)  void synchronize(void);
9  {        int getbyte(void);
10          unsigned start,end,i;  
11    int main(int argc,char **argv)
12    {
13          printf(".4k8 -> .tap 1.0\n");          printf(".4k8 -> .tap 1.0\n");
14          if (argc!=3) { printf("Usage: %s file.4k8 file.tap\n",argv[0]); exit(1);}          if (argc!=3) { printf("Usage: %s file.4k8 file.tap\n",argv[0]); exit(1);}
15          in=fopen(argv[1],"rb"); out=fopen(argv[2],"wb");          in=fopen(argv[1],"rb"); out=fopen(argv[2],"wb");
# Line 21  main(int argc,char **argv) Line 23  main(int argc,char **argv)
23  }  }
24    
25    
26  getsample()  int getsample()
27  {  {
28          static int shifter, shiftcount=0;          static int shifter, shiftcount=0;
         int sample;  
29          if (shiftcount==0) {          if (shiftcount==0) {
30                  shiftcount=8;                  shiftcount=8;
31                  if (feof(in)) shifter=0x55;                  if (feof(in)) shifter=0x55;
# Line 35  getsample() Line 36  getsample()
36          return (shifter>>8) & 1;          return (shifter>>8) & 1;
37  }  }
38    
39  getbit()  int getbit()
40  {  {
41          int length=0;          int length=0;
42          do length++; while (getsample()==1);          do length++; while (getsample()==1);
# Line 43  getbit() Line 44  getbit()
44          return length<3 ? 1 : 0;          return length<3 ? 1 : 0;
45  }  }
46    
47  getbyte()  int getbyte(void)
48  {  {
49          int decaleur=0,byte=0,i,bit,sum=0;          int decaleur=0,byte=0,i,bit,sum=0;
50          getbit();          getbit();
# Line 59  getbyte() Line 60  getbyte()
60          return byte;          return byte;
61  }  }
62    
63  synchronize()  void synchronize(void)
64  {  {
65          int decaleur=0,val;          int decaleur=0,val;
66          printf("Searching synchro...\n");          printf("Searching synchro...\n");

Legend:
Removed from v.1185  
changed lines
  Added in v.1186

  ViewVC Help
Powered by ViewVC 1.1.26