OpenCores
URL https://opencores.org/ocsvn/zet86/zet86/trunk

Subversion Repositories zet86

[/] [zet86/] [trunk/] [src/] [tools/] [out2rom-ml403.c] - Blame information for rev 49

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 zeus
#include <sys/types.h>
2
#include <sys/stat.h>
3
#include <fcntl.h>
4
#include <stdio.h>
5
#include <string.h>
6
#include <stdlib.h>
7
 
8
int main(int argc, char *argv[])
9
{
10
  char buf1[2];
11
  char buf2[2];
12
  int  f1, f2, c1, c2;
13
  char err[50];
14
 
15
  if (argc!=3)
16
    {
17
      sprintf(err, "Usage: %s hd.img bios.img\n", argv[0]);
18
      write(2, &err, strlen(err));
19
      exit(1);
20
    }
21
 
22
  f1 = open (argv[1], O_RDONLY);
23
  if (f1<0)
24
    {
25
      sprintf(err, "Could not open file %s\n", argv[1]);
26
      write(2, &err, strlen(err));
27
      exit(1);
28
    }
29
 
30
  f2 = open (argv[2], O_RDONLY);
31
  if (f2<0)
32
    {
33
      sprintf(err, "Could not open file %s\n", argv[2]);
34
      write(2, &err, strlen(err));
35
      exit(1);
36
    }
37
 
38
  while (1)
39
  {
40
    c1=read(f1, &buf1, 2);
41
    c2=read(f2, &buf2, 2);
42
 
43
    if (c1<2 && c2<2) break;
44
    else
45
      {
46
        if (c1<2) { buf1[0] =  0xff; buf1[1] = 0xff; }
47
        if (c2<2) { buf2[0] =  0xff; buf2[1] = 0xff; }
48
      }
49
 
50
    write (1, &buf1[1], 1);
51
    write (1, &buf1[0], 1);
52
    write (1, &buf2[1], 1);
53
    write (1, &buf2[0], 1);
54
  }
55
 
56
  close(f1);
57
  close(f2);
58
 
59
  return 0;
60
}
61
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.