/[gxemul]/trunk/src/diskimage.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/diskimage.c

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

revision 20 by dpavlin, Mon Oct 8 16:19:23 2007 UTC revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2003-2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2003-2006  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: diskimage.c,v 1.102 2005/11/21 09:17:25 debug Exp $   *  $Id: diskimage.c,v 1.108 2006/01/11 20:14:41 debug Exp $
29   *   *
30   *  Disk image support.   *  Disk image support.
31   *   *
# Line 595  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 595  xferp->data_in[4] = 0x2c - 4;  /*  Additi
595                  memcpy(xferp->data_in+8,  "GXemul  ", 8);                  memcpy(xferp->data_in+8,  "GXemul  ", 8);
596                  if (diskimage_getname(cpu->machine, id,                  if (diskimage_getname(cpu->machine, id,
597                      type, namebuf, sizeof(namebuf))) {                      type, namebuf, sizeof(namebuf))) {
598                          int i;                          size_t i;
599                          for (i=0; i<sizeof(namebuf); i++)                          for (i=0; i<sizeof(namebuf); i++)
600                                  if (namebuf[i] == 0) {                                  if (namebuf[i] == 0) {
601                                          for (; i<sizeof(namebuf); i++)                                          for (; i<sizeof(namebuf); i++)
# Line 612  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 612  xferp->data_in[4] = 0x2c - 4;  /*  Additi
612                   *  the drives.                   *  the drives.
613                   */                   */
614    
615                  if (machine->machine_type == MACHINE_DEC) {                  if (machine->machine_type == MACHINE_PMAX) {
616                          /*  DEC, RZ25 (rev 0900) = 832527 sectors  */                          /*  DEC, RZ25 (rev 0900) = 832527 sectors  */
617                          /*  DEC, RZ58 (rev 2000) = 2698061 sectors  */                          /*  DEC, RZ58 (rev 2000) = 2698061 sectors  */
618                          memcpy(xferp->data_in+8,  "DEC     ", 8);                          memcpy(xferp->data_in+8,  "DEC     ", 8);
# Line 626  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 626  xferp->data_in[4] = 0x2c - 4;  /*  Additi
626                          xferp->data_in[1] = 0x80;  /*  0x80 = removable  */                          xferp->data_in[1] = 0x80;  /*  0x80 = removable  */
627                          /*  memcpy(xferp->data_in+16, "CD-ROM          ", 16);*/                          /*  memcpy(xferp->data_in+16, "CD-ROM          ", 16);*/
628    
629                          if (machine->machine_type == MACHINE_DEC) {                          if (machine->machine_type == MACHINE_PMAX) {
630                                  /*  SONY, CD-ROM:  */                                  /*  SONY, CD-ROM:  */
631                                  memcpy(xferp->data_in+8, "SONY    ", 8);                                  memcpy(xferp->data_in+8, "SONY    ", 8);
632                                  memcpy(xferp->data_in+16,                                  memcpy(xferp->data_in+16,
# Line 652  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 652  xferp->data_in[4] = 0x2c - 4;  /*  Additi
652                          xferp->data_in[1] = 0x80;  /*  0x80 = removable  */                          xferp->data_in[1] = 0x80;  /*  0x80 = removable  */
653                          memcpy(xferp->data_in+16, "TAPE            ", 16);                          memcpy(xferp->data_in+16, "TAPE            ", 16);
654    
655                          if (machine->machine_type == MACHINE_DEC) {                          if (machine->machine_type == MACHINE_PMAX) {
656                                  /*                                  /*
657                                   *  TODO:  find out if these are correct.                                   *  TODO:  find out if these are correct.
658                                   *                                   *
# Line 897  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 897  xferp->data_in[4] = 0x2c - 4;  /*  Additi
897                                   *  blocks to transfer. (NOTE: If the value is                                   *  blocks to transfer. (NOTE: If the value is
898                                   *  0, this means 0, not 65536. :-)                                   *  0, this means 0, not 65536. :-)
899                                   */                                   */
900                                  ofs = (xferp->cmd[2] << 24) + (xferp->cmd[3]                                  ofs = ((uint64_t)xferp->cmd[2] << 24) +
901                                      << 16) + (xferp->cmd[4] << 8) +                                      (xferp->cmd[3] << 16) + (xferp->cmd[4] << 8)
902                                      xferp->cmd[5];                                      + xferp->cmd[5];
903                                  retlen = (xferp->cmd[7] << 8) + xferp->cmd[8];                                  retlen = (xferp->cmd[7] << 8) + xferp->cmd[8];
904                          }                          }
905    
# Line 975  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 975  xferp->data_in[4] = 0x2c - 4;  /*  Additi
975                           *  transfer. (NOTE: If the value is 0 this means 0,                           *  transfer. (NOTE: If the value is 0 this means 0,
976                           *  not 65536.)                           *  not 65536.)
977                           */                           */
978                          ofs = (xferp->cmd[2] << 24) + (xferp->cmd[3] << 16) +                          ofs = ((uint64_t)xferp->cmd[2] << 24) +
979                                (xferp->cmd[4] << 8) + xferp->cmd[5];                              (xferp->cmd[3] << 16) + (xferp->cmd[4] << 8) +
980                                xferp->cmd[5];
981                          retlen = (xferp->cmd[7] << 8) + xferp->cmd[8];                          retlen = (xferp->cmd[7] << 8) + xferp->cmd[8];
982                  }                  }
983    
# Line 1024  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 1025  xferp->data_in[4] = 0x2c - 4;  /*  Additi
1025                  if (xferp->cmd_len != 6)                  if (xferp->cmd_len != 6)
1026                          debug(" (weird len=%i)", xferp->cmd_len);                          debug(" (weird len=%i)", xferp->cmd_len);
1027    
1028                  for (i=0; i<xferp->cmd_len; i++)                  for (i=0; i<(ssize_t)xferp->cmd_len; i++)
1029                          debug(" %02x", xferp->cmd[i]);                          debug(" %02x", xferp->cmd[i]);
1030    
1031                  /*  TODO: actualy care about cmd[]  */                  /*  TODO: actualy care about cmd[]  */
# Line 1285  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 1286  xferp->data_in[4] = 0x2c - 4;  /*  Additi
1286                  } else {                  } else {
1287                          int i;                          int i;
1288                          fatal("[ unknown MODE_SELECT: cmd =");                          fatal("[ unknown MODE_SELECT: cmd =");
1289                          for (i=0; i<xferp->cmd_len; i++)                          for (i=0; i<(ssize_t)xferp->cmd_len; i++)
1290                                  fatal(" %02x", xferp->cmd[i]);                                  fatal(" %02x", xferp->cmd[i]);
1291                          fatal(", data_out =");                          fatal(", data_out =");
1292                          for (i=0; i<xferp->data_out_len; i++)                          for (i=0; i<(ssize_t)xferp->data_out_len; i++)
1293                                  fatal(" %02x", xferp->data_out[i]);                                  fatal(" %02x", xferp->data_out[i]);
1294                          fatal(" ]");                          fatal(" ]");
1295                  }                  }
# Line 1307  xferp->data_in[4] = 0x2c - 4;  /*  Additi Line 1308  xferp->data_in[4] = 0x2c - 4;  /*  Additi
1308          case 0xbd:          case 0xbd:
1309                  fatal("[ SCSI 0x%02x (len %i), TODO: ", xferp->cmd[0],                  fatal("[ SCSI 0x%02x (len %i), TODO: ", xferp->cmd[0],
1310                      xferp->cmd_len);                      xferp->cmd_len);
1311                  for (i=0; i<xferp->cmd_len; i++)                  for (i=0; i<(ssize_t)xferp->cmd_len; i++)
1312                          fatal(" %02x", xferp->cmd[i]);                          fatal(" %02x", xferp->cmd[i]);
1313                  fatal(" ]\n");                  fatal(" ]\n");
1314    
# Line 1498  int diskimage_add(struct machine *machin Line 1499  int diskimage_add(struct machine *machin
1499                  d2->next = d;                  d2->next = d;
1500          }          }
1501    
1502          d->type = DISKIMAGE_SCSI;          d->type = DISKIMAGE_IDE;
1503    
1504          /*  Special cases: some machines usually have FLOPPY/IDE, not SCSI:  */          if (machine->machine_type == MACHINE_PMAX ||
1505          if (machine->arch == ARCH_X86 ||              machine->machine_type == MACHINE_ARC)
1506              machine->machine_type == MACHINE_COBALT ||                  d->type = DISKIMAGE_SCSI;
             machine->machine_type == MACHINE_EVBMIPS ||  
             machine->machine_type == MACHINE_HPCMIPS ||  
             machine->machine_type == MACHINE_BEBOX ||  
             machine->machine_type == MACHINE_PREP ||  
             machine->machine_type == MACHINE_CATS ||  
             machine->machine_type == MACHINE_NETWINDER ||  
             machine->machine_type == MACHINE_PS2)  
                 d->type = DISKIMAGE_IDE;  
1507    
1508          if (prefix_i + prefix_f + prefix_s > 1) {          if (prefix_i + prefix_f + prefix_s > 1) {
1509                  fprintf(stderr, "Invalid disk image prefix(es). You can"                  fprintf(stderr, "Invalid disk image prefix(es). You can"
# Line 1563  int diskimage_add(struct machine *machin Line 1556  int diskimage_add(struct machine *machin
1556                           */                           */
1557    
1558  #if 0  #if 0
1559                          if (machine->machine_type == MACHINE_DEC)                          if (machine->machine_type == MACHINE_PMAX)
1560                                  d->logical_block_size = 512;                                  d->logical_block_size = 512;
1561                          else                          else
1562                                  d->logical_block_size = 2048;                                  d->logical_block_size = 2048;
# Line 1777  int diskimage_is_a_tape(struct machine * Line 1770  int diskimage_is_a_tape(struct machine *
1770   */   */
1771  void diskimage_dump_info(struct machine *machine)  void diskimage_dump_info(struct machine *machine)
1772  {  {
1773          int iadd=4;          int iadd = DEBUG_INDENTATION;
1774          struct diskimage *d = machine->first_diskimage;          struct diskimage *d = machine->first_diskimage;
1775    
1776          while (d != NULL) {          while (d != NULL) {

Legend:
Removed from v.20  
changed lines
  Added in v.22

  ViewVC Help
Powered by ViewVC 1.1.26