[hatari-devel] Wotanoid problem : final fix before commit ?

Laurent Sallafranque laurent.sallafranque at free.fr
Sun Jan 24 12:07:51 CET 2010


Hello,

I've changed the Size type from Sint32 to Uint32.

If you're OK with this, I can commit tonight.

RQ : compendium says that if Size ==0, it  generates a system crach on 
GEMDOS version lower than 0.15.
Should this be emulated ?

Regards

Laurent



diff -r ebc4d432fc2e src/gemdos.c
--- a/src/gemdos.c    Fri Jan 22 00:44:43 2010 +0100
+++ b/src/gemdos.c    Sun Jan 24 12:03:32 2010 +0100
@@ -1718,7 +1718,7 @@
     char *pBuffer;
     long CurrentPos, FileSize, nBytesRead, nBytesLeft;
     Uint32 Addr;
-    Sint32 Size;
+    Uint32 Size;
     int Handle;
 
     /* Read details from stack */
@@ -1746,9 +1746,9 @@
     fseek(FileHandles[Handle].FileHandle, CurrentPos, SEEK_SET);
 
     nBytesLeft = FileSize-CurrentPos;
-   
+
     /* Check for bad size and End Of File */
-    if (Size <= 0 || nBytesLeft <= 0)
+    if (Size == 0 || nBytesLeft <= 0)
     {
         /* return zero (bytes read) as original GEMDOS/EmuTOS */
         Regs[REG_D0] = 0;
diff -r ebc4d432fc2e src/ioMemTabFalcon.c
--- a/src/ioMemTabFalcon.c    Fri Jan 22 00:44:43 2010 +0100
+++ b/src/ioMemTabFalcon.c    Sun Jan 24 12:03:32 2010 +0100
@@ -236,6 +236,7 @@
 
     { 0xff9200, SIZE_WORD, Joy_StePadButtons_ReadWord, 
IoMem_WriteWithoutInterception },    /* Joypad fire buttons */
     { 0xff9202, SIZE_WORD, Joy_StePadMulti_ReadWord, 
Joy_StePadMulti_WriteWord },     /* Joypad directions/buttons/selection */
+    { 0xff9206, SIZE_BYTE, IoMem_VoidRead, IoMem_VoidWrite 
},                               /* No bus error here ; fix Wotanoid*/
     { 0xff9210, SIZE_BYTE, IoMem_VoidRead, IoMem_VoidWrite 
},                               /* No bus error here */
     { 0xff9211, SIZE_BYTE, IoMem_VoidRead, 
IoMem_WriteWithoutInterception },          /* Joypad 0 X position (?) */
     { 0xff9212, SIZE_BYTE, IoMem_VoidRead, IoMem_VoidWrite 
},                               /* No bus error here */




Laurent Sallafranque a écrit :
> Hello,
>
> I was really tired yesterday.
>
> The corect code is of course :
>
>     if (Size == -1)
>         Size = FileSize;
>
>
> But I think Size should be declared as unsigned instead of signed.
>
> Do you agree ?
>
> Regards,
>
> Laurent
>
>
>
> George Nakos a écrit :
>   
>> Hello Laurent,
>>
>> Sunday, January 24, 2010, 1:21:17 AM, you wrote:
>>
>>   
>>     
>>> Sorry, little mistake, the problem is in Fread, not Fopen.
>>>     
>>>       
>>> I've looked at the compendium.
>>> I haven't found anything about this -1 length call.
>>>     
>>>       
>> My  memory  is  a bit hazy, but I think this just tells gemdos to read
>> $ffffffff  bytes  from the file. Of course gemdos will read as much as
>> the  file  size  and then return an error in d0.l. It's the lazy man's
>> approach  to  doing  things  the  Right Way(tm) (i.e. getting the file
>> length  -or knowing it beforehand- and calling fread() with the proper
>> amount of bytes)
>>
>>   
>>     
>
> _______________________________________________
> hatari-devel mailing list
> hatari-devel at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/hatari-devel
>
>
>   




More information about the hatari-devel mailing list