#include <iostream.h>
#include <string.h>
#include "mscdex.h"
#include "client.h"
main() {
  server_init();

  struct ioctlread * iptr = (ioctlread *)server->data_area;
  int drive = firstdrv();
  double ver = mscdex_ver();
  /* Get the actual sector size. */

  char command = DIO_RESET;
  
  iptr->hdr.len = sizeof(ioctlread); /* offset of subcommand */
  iptr->hdr.subunit = 0;
  iptr->hdr.command = CD_IOCTLO; /* ioctl output */
  iptr->hdr.status = 0;
  memset (iptr->hdr.reserved, 0, 8);
  iptr->descr=0;
  iptr->toff = DOS_BUFFER + iptr->hdr.len;
  iptr->tseg = DOS_DS;
  iptr->num = DIO_RESET_LEN;
  iptr->sector = 0;
  iptr->voloff = 0;
  iptr->volseg = 0;

  *(server->data_area + iptr->hdr.len) = DIO_RESET;
  
  DOS_AX = MSCDEX_DEVREQ;
  DOS_CX = drive;
  DOS_BX = DOS_BUFFER;
  DOS_CMD = CALL_IRQ;
  DOS_ARG = MSCDEX_INT;
  call_dosemu();

  cout << "drive = " << (char)(drive + 'A') << " version = " << ver << endl;

  return (0);

}
