Exemple #1
0
void
ttt_init_io (unsigned int port)
{
#if     (defined __unix__ || defined __BEOS__) && !defined __MSDOS__
  init_conio ();
#endif

  port_8 = port;                                // original code used 0x378 for port_8
  port_9 = port + 1;
  port_a = port + 2;
  port_b = port + 3;
  port_c = port + 4;

  parport_print_info ();

  init_port ();
}
Exemple #2
0
int
mcd_read_rom (const char *filename, unsigned short parport)
{
  FILE *file;
  unsigned char buffer[BUFFERSIZE];
  int n_bytes = 0, size;
  time_t starttime;

#if     (defined __unix__ || defined __BEOS__) && !defined __MSDOS__
  init_conio ();
  if (register_func (deinit_conio) == -1)
    {
      fputs ("ERROR: Could not register function with register_func()\n", stderr);
      exit (1);
    }
#endif
  parport_print_info ();

  if ((file = fopen (filename, "wb")) == NULL)
    {
      fprintf (stderr, ucon64_msg[OPEN_WRITE_ERROR], filename);
      exit (1);
    }

  read_block (buffer, 1, parport);
  size = (buffer[0] + 1) * 64 * 1024;
  printf ("Receive: %d Bytes (%.4f Mb)\n\n", size, (float) size / MBIT);
  puts ("Press q to abort\n");

  starttime = time (NULL);
  while (n_bytes < size)
    {
      read_block (buffer, BUFFERSIZE, parport);
      fwrite (buffer, 1, BUFFERSIZE, file);
      n_bytes += BUFFERSIZE;
      ucon64_gauge (starttime, n_bytes, size);
      checkabort (2);
    }

  fclose (file);

  return 0;
}