Re: [hatari-devel] Re: IDE byte swapping options

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi Thomas,

On 10/3/18 10:00 AM, Thomas Huth wrote:
Am Sun, 23 Sep 2018 20:17:56 +0300
schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:
If yes, attached patch "should" implement such option for IDE
partition counting.  If it works fine, same options can be used
to toggle swapping for rest of IDE handling too.

Thanks for the patch, that's a first step... but actually, I think this
area (especially the HD dialog in the GUI) needs a major clean-up, e.g.
I also need to add SCSI setup to the GUI, add support for multiple ACSI
images, fix the nomenclature for IDE ("master" and "slave" is
nonstandard, the official terms are IDE 0 and IDE 1), etc.

Using "--byteswap master" to only enable byteswapping is also a bad
idea - what if a user already enabled byteswapping in the config file
and wants to disable it on the CLI again?

So I'd appreciate if you could hold back your patch, I'll take care of
this, I just need to find some spare time to work on this...

You've added the functionality and SDL GUI code, but command line
option seems to be still missing.

Does the attached patch look OK?


	- Eero

diff -r 07fb0f2a18e0 doc/hatari.1
--- a/doc/hatari.1	Sat Oct 13 01:12:47 2018 +0300
+++ b/doc/hatari.1	Sat Oct 13 01:46:13 2018 +0300
@@ -345,17 +345,21 @@
 .TP
 .B \-\-acsi <id>=<file>
 Emulate an ACSI hard disk with given BUS ID (0-7) using image <file>.
-If just a filename is given, it is assigned to BUS ID 0
+If just a filename is given, it's assigned to BUS ID 0
 .TP
 .B \-\-scsi <id>=<file>
 Emulate a SCSI hard disk with given BUS ID (0-7) using image <file>.
-If just a filename is given, it is assigned to BUS ID 0
+If just a filename is given, it's assigned to BUS ID 0
 .TP
 .B \-\-ide\-master <file>
-Emulate an IDE master hard disk with an image <file>
+Emulate an IDE 0 (master) hard disk with an image <file>
 .TP 
 .B \-\-ide\-slave <file>
-Emulate an IDE slave hard disk with an image <file>
+Emulate an IDE 1 (slave) hard disk with an image <file>
+.TP
+.B \-\-byteswap <id>=<x>
+Set byte-swap option <x> (off/on/auto) for given IDE <id> (0/1).
+If just option is given, it's applied to IDE 0
 
 .SH "Memory options"
 .TP 
diff -r 07fb0f2a18e0 doc/manual.html
--- a/doc/manual.html	Sat Oct 13 01:12:47 2018 +0300
+++ b/doc/manual.html	Sat Oct 13 01:46:13 2018 +0300
@@ -655,6 +655,10 @@
 <p class="parameter">--disk-b
 &lt;file&gt;</p>
 <p class="paramdesc">Set disk image for floppy drive B</p>
+<p class="parameter">--fastfdc
+&lt;bool&gt;</p>
+<p class="paramdesc">Speed up FDC emulation (can cause
+incompatibilities)</p>
 <p class="parameter">--protect-floppy
 &lt;x&gt;</p>
 <p class="paramdesc">Write protect floppy image contents
@@ -706,24 +710,24 @@
 the partition tables in HD images)</p>
 <p class="parameter">--acsi &lt;id&gt;=&lt;file&gt;</p>
 <p class="paramdesc">Emulate an ACSI hard drive with given bus ID (0-7)
-using image &lt;file&gt;. If just a filename is given, it is assigned to
+using image &lt;file&gt;. If just a filename is given, it's assigned to
 bus ID 0</p>
 <p class="parameter">--scsi &lt;id&gt;=&lt;file&gt;</p>
 <p class="paramdesc">Emulate a SCSI hard drive with given bus ID (0-7)
-using image &lt;file&gt;. If just a filename is given, it is assigned to
+using image &lt;file&gt;. If just a filename is given, it's assigned to
 bus ID 0</p>
 <p class="parameter">--ide-master
 &lt;file&gt;</p>
-<p class="paramdesc">Emulate an IDE master hard drive with an
+<p class="paramdesc">Emulate an IDE 0 (master) hard drive with an
 image &lt;file&gt;</p>
 <p class="parameter">--ide-slave
 &lt;file&gt;</p>
-<p class="paramdesc">Emulate an IDE slave hard drive with an
+<p class="paramdesc">Emulate an IDE 1 (slave) hard drive with an
 image &lt;file&gt;</p>
-<p class="parameter">--fastfdc
-&lt;bool&gt;</p>
-<p class="paramdesc">Speed up FDC emulation (can cause
-incompatibilities)</p>
+<p class="parameter">--byteswap &lt;id&gt;=&lt;x&gt;</p>
+<p class="paramdesc">Set byte-swap option &lt;x&gt; (off/on/auto) for
+given IDE &lt;id&gt; (0/1). If just option is given, it's applied to
+IDE 0</p>
 
 <h3>Memory options</h3>
 <p class="parameter">
diff -r 07fb0f2a18e0 src/options.c
--- a/src/options.c	Sat Oct 13 01:12:47 2018 +0300
+++ b/src/options.c	Sat Oct 13 01:46:13 2018 +0300
@@ -134,6 +134,7 @@
 	OPT_SCSIHDIMAGE,
 	OPT_IDEMASTERHDIMAGE,
 	OPT_IDESLAVEHDIMAGE,
+	OPT_IDEBYTESWAP,
 	OPT_MEMSIZE,		/* memory options */
 #if ENABLE_WINUAE_CPU
 	OPT_TT_RAM,
@@ -365,10 +366,12 @@
 	{ OPT_SCSIHDIMAGE,   NULL, "--scsi",
 	  "<id>=<file>", "Emulate a SCSI harddrive (0-7) with an image <file>" },
 	{ OPT_IDEMASTERHDIMAGE,   NULL, "--ide-master",
-	  "<file>", "Emulate an IDE master harddrive with an image <file>" },
+	  "<file>", "Emulate an IDE 0 (master) harddrive with an image <file>" },
 	{ OPT_IDESLAVEHDIMAGE,   NULL, "--ide-slave",
-	  "<file>", "Emulate an IDE slave harddrive with an image <file>" },
-	
+	  "<file>", "Emulate an IDE 1 (slave) harddrive with an image <file>" },
+	{ OPT_IDEBYTESWAP,   NULL, "--byteswap",
+	  "<id>=<x>", "Set IDE (0/1) byte-swap option (off/on/auto)" },
+
 	{ OPT_HEADER, NULL, NULL, NULL, "Memory" },
 	{ OPT_MEMSIZE,   "-s", "--memsize",
 	  "<x>", "ST RAM size (x = size in MiB from 0 to 14, 0 = 512KiB ; else size in KiB)" },
@@ -1652,6 +1655,30 @@
 			}
 			break;
 
+		case OPT_IDEBYTESWAP:
+			i += 1;
+			str = argv[i];
+			if (strlen(str) > 2 && isdigit(str[0]) && str[1] == '=')
+			{
+				drive = str[0] - '0';
+				if (drive < 0 || drive > 1)
+					return Opt_ShowError(OPT_IDEBYTESWAP, str, "Invalid IDE drive <id>, must be 0/1");
+				str += 2;
+			}
+			else
+			{
+				drive = 0;
+			}
+			if (strcasecmp(str, "off") == 0)
+				ConfigureParams.Ide[drive].nByteSwap = BYTESWAP_OFF;
+			else if (strcasecmp(str, "on") == 0)
+				ConfigureParams.Ide[drive].nByteSwap = BYTESWAP_ON;
+			else if (strcasecmp(str, "auto") == 0)
+				ConfigureParams.Ide[drive].nByteSwap = BYTESWAP_AUTO;
+			else
+				return Opt_ShowError(OPT_IDEBYTESWAP, argv[i], "Invalid byte-swap setting");
+			break;
+
 			/* Memory options */
 		case OPT_MEMSIZE:
 			memsize = atoi(argv[++i]);


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/