Logo Search packages:      
Sourcecode: cbmlink version File versions  Download package

int disk_install ( const struct comm comm,
const struct hostinfo hostinfo,
unsigned  device 
)

install the disk extension

Parameters:
comm the communication primitives
hostinfo information on the remote host
device the device number of the disk drive
Returns:
zero on success, nonzero on error

Definition at line 48 of file disk.c.

References B128, B256, C128, C264, C64, comm::comm_read, comm::comm_sr, comm::comm_write, disk_cbm, disk_cbm2, disk_pet3000, disk_pet4000, disk_remove(), ext(), hostinfo::host, P500, PET, PET3, PET4, and Vic.

Referenced by drive_image_read(), drive_image_write(), drive_memory_load(), and drive_memory_save().

{
  int status = 1;
  switch (hostinfo->host) {
  case PET:
    break;
  case PET3:
    status = ext (comm, hostinfo, disk_pet3000, sizeof disk_pet3000,
              device, 15) ? 2 : 0;
    break;
  case PET4:
    status = ext (comm, hostinfo, disk_pet4000, sizeof disk_pet4000,
              device, 15) ? 2 : 0;
    break;
  case P500: case B128: case B256:
    status = ext (comm, hostinfo, disk_cbm2, sizeof disk_cbm2,
              device, 15) ? 2 : 0;
    break;
  case Vic: case C64: case C128: case C264:
    status = ext (comm, hostinfo, disk_cbm, sizeof disk_cbm,
              device, 15) ? 2 : 0;
    break;
  }

  if (!status) {
    unsigned char ch = 0;
    if ((*comm->comm_write) (&ch, 1))
      status = 3;
    else {
      (*comm->comm_sr) ();
      if ((*comm->comm_read) (&ch, 1) || ch) {
      fprintf (stderr, "disk: remote error %#x\n", ch);
      status = 3;
      disk_remove (comm);
      }
    }
  }
  else if (status == 1)
    fprintf (stderr, "disk: unsupported server %u\n", hostinfo->host);

  return status;
}


Generated by  Doxygen 1.6.0   Back to index