Menu

#1872 Commit 41875 breaks CMDHD SCSI-ID support for DHD/S10-S60 disk images

v3.x
closed-fixed
compyx
None
GTK3
Drives
2023-06-17
2023-04-18
DarkVision
No

Hi ...

You have comitted 41875 but that "fix" breaks support for multiple CMDHD disk images for different SCSI ID/LUN in x64sc.

By default on previous releases the main disk image for a CMDHD does have the name "name.DHD" and for SCSI ID 1-6 the name for additional disk images would be "name.S1x" to "name.S6x" (x might be the LUB, 0 by default). See comments in cmdhd.c:

    /* look to see if there are more files with the same base
       name, but different extensions: s10, s11, ..., s20, ..., s67
       s<ID><LUN> */
    /* copy the file name */

After commit 41875 additional .Sxx images will not be recognized and you cannot switch the SCSI ID by software anymore.

I reverted this change on SVN/current and the CMDHD drive will detected the additional .Sxx disk images and switching SCSI-ID is possible again.

diff -U3 -d -r -N vice-3.6r41875/src/drive/iec/cmdhd.c vice-3.6r41874/src/drive/iec/cmdhd.c
--- vice-3.6r41875/src/drive/iec/cmdhd.c    2023-04-18 19:45:22.000000000 +0200
+++ vice-3.6r41874/src/drive/iec/cmdhd.c    2023-04-18 19:40:45.000000000 +0200
@@ -1392,8 +1391,10 @@
             /* skip first disk as it has a DHD extension */
             for (j = (i == 0); j < 8; j++) {
                /* generate the name */

-               testname = lib_msprintf("%s%" PRI_SIZE_T" %1" PRI_SIZE_T,
-                                       basename, i, j);
+               testname = lib_msprintf("%s%llu%1llu",
+                                       basename,
+                                       (unsigned long long)i,
+                                       (unsigned long long)j);
                /* open the file */
                test = fopen(testname, "rb+");
                if (test) {

You maybe want to compare the previous commit 41874.

Discussion

  • compyx

    compyx - 2023-04-19

    I've committed a fix in r42694

    Now I'm wondering why using PRI_SIZE_T doesn't work. It should expand to %1Iu, with Iu being the Microsoft C runtime non-standard way of printing size_t (since their C99 compiler and runtime suck). I'm guessing MS' non-standard Iu can't handle a width specifier?

     
    • DarkVision

      DarkVision - 2023-04-19

      I have tested 41875 using LINUX/GTK3, it was not a windows build. Also the patch was testet against SVN/current using LINUX. So this was broken on Linux and Windows (the initial reporter to me was using windows)...

      I had no time yet to test 42694, will do later, but it seem to be the same patch above so i'm sure it will work.

      I don't know much about C, can't help on the compiler issues, sorry.

       
      • compyx

        compyx - 2023-04-19

        Hmmm, I figured it would be some weird Windows-specific issue. I'm on Linux as well. I'll have to write some test code to see what exactly happens when the PRI_SIZE_T macro is used then, on Linux the format string would expand to %s%zu%1zu, which I don't see any obvious issues with at first glance.

        But indeed the commit is identical for all intents and purposes, so it should work. Let me know if it does, I don't have any CMD HD images to test this.

         
        • radius75

          radius75 - 2023-04-19

          I don't quite understand what the problem is.
          If you need a .dhd image, here it is (disk 4GB). There are two empty partitions type 1541 on it.
          I use a single image like this .dhd on Win7 x64 3.7-dev r42647

           

          Last edit: radius75 2023-04-19
          • DarkVision

            DarkVision - 2023-04-19

            The problem was maybe a typo in 41875.

            And the problem ist not using a DHD but a DHD and a file with the same name but with .S10 as extension instead of .DHD.

            This will allow the "SCSI" controller in the CMD-HD to use a different SCSI disk with device ID 1 and LUN 0. There does software exist (even 25 years ago) that was able to switch between different SCSI disk devices connected to the CMDHD (the CMDHD supports up to 56 devices i think...). And maybe the typo was the cause that the CMDHD emulation did not find the additional DHD images (filename was "name.S 10" with an additional blank in the extension while it should have been "name.S10").

            I will give it a try later but reverting 42694 and remove the space out of the filename from fix 41875 could have been the reason for this issue.

             
            • radius75

              radius75 - 2023-04-19

              Thanks for the clarification.
              I'm not proficient enough to set it up on my own.
              I read the manual for CMD-HD superficially ;)
              Is there any special command in Jiffy that can switch to another disk under the same ID? I understand correctly? multiple drives installed/connected in a single CMDHD?

              --
              Edit.
              Is that what this passage in the manual is talking about?
              Sorry for offtopic.

               

              Last edit: radius75 2023-04-19
              • DarkVision

                DarkVision - 2023-04-19

                No... you need a special software to switch the SCSI-ID and the hard disk connected to the CMDHD device. If you need more info drop me a message.

                Is that what this passage in the manual is talking about?

                Yes, originally used to extend the size of the internal disk but nowadays it is much better to use the additional devices as individual drives and switch between the drives. I used that for an external IomegaZIP drive and 100Mb disks. And with the .Sxx feature VICE can emulate such drives.

                 
                👍
                1

                Last edit: DarkVision 2023-04-19
    • DarkVision

      DarkVision - 2023-04-19

      Fixed with r43699 ... can be closed.

       
  • gpz

    gpz - 2023-06-17
    • status: open --> closed-fixed
     

Log in to post a comment.