/[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 26 by dpavlin, Mon Oct 8 16:20:10 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.110 2006/06/24 19:52:27 debug Exp $
29   *   *
30   *  Disk image support.   *  Disk image support.
31   *   *
# Line 524  int diskimage_scsicommand(struct cpu *cp Line 524  int diskimage_scsicommand(struct cpu *cp
524                  fatal(" %02x", xferp->cmd[i]);                  fatal(" %02x", xferp->cmd[i]);
525          fatal("\n");          fatal("\n");
526  if (xferp->cmd_len > 7 && xferp->cmd[5] == 0x11)  if (xferp->cmd_len > 7 && xferp->cmd[5] == 0x11)
527          single_step = 1;          single_step = ENTER_SINGLE_STEPPING;
528  #endif  #endif
529    
530  #if 0  #if 0
# 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;          /*  Default to IDE disks...  */
1503            d->type = DISKIMAGE_IDE;
1504    
1505          /*  Special cases: some machines usually have FLOPPY/IDE, not SCSI:  */          /*  ... but some machines use SCSI by default:  */
1506          if (machine->arch == ARCH_X86 ||          if (machine->machine_type == MACHINE_PMAX ||
1507              machine->machine_type == MACHINE_COBALT ||              machine->machine_type == MACHINE_ARC)
1508              machine->machine_type == MACHINE_EVBMIPS ||                  d->type = DISKIMAGE_SCSI;
             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;  
1509    
1510          if (prefix_i + prefix_f + prefix_s > 1) {          if (prefix_i + prefix_f + prefix_s > 1) {
1511                  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 1558  int diskimage_add(struct machine *machin
1558                           */                           */
1559    
1560  #if 0  #if 0
1561                          if (machine->machine_type == MACHINE_DEC)                          if (machine->machine_type == MACHINE_PMAX)
1562                                  d->logical_block_size = 512;                                  d->logical_block_size = 512;
1563                          else                          else
1564                                  d->logical_block_size = 2048;                                  d->logical_block_size = 2048;
# Line 1777  int diskimage_is_a_tape(struct machine * Line 1772  int diskimage_is_a_tape(struct machine *
1772   */   */
1773  void diskimage_dump_info(struct machine *machine)  void diskimage_dump_info(struct machine *machine)
1774  {  {
1775          int iadd=4;          int iadd = DEBUG_INDENTATION;
1776          struct diskimage *d = machine->first_diskimage;          struct diskimage *d = machine->first_diskimage;
1777    
1778          while (d != NULL) {          while (d != NULL) {

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

  ViewVC Help
Powered by ViewVC 1.1.26