Can reproduce, investigating ...


F.J. McCloud wrote:
Aha!  soldivid on X86-64 is another array index problem, this
time in src/vidhrdw/psikyosh.c, line 324.
http://www.anthrofox.org/code/mame/64bitclean/index.html
bg_pri[i] = (psikyosh_bgram[(BG_TYPE(i)*0x800)/4 + 0x400/4 -
0x4000/4] & 0xff000000) >> 24;

BG_TYPE(0) returns 0 and makes the array index -3840.  I guess
somehow X86 memory allocation is just alot more forgiving about
this behavior.  Yikes!  So is BG_TYPE returning the proper
value?

It's a bug on all platforms, not just 64-bit.  Should I ping
mametesters directly about this?
----
Now comes my halloween night scare!
It's so weird.
If I introduce an intermediate integer I don't change the
negative index value at all.  Zero is still zero,  But soldivid
works again on X86-64.  If anyone can explain that I'd be
grateful.  (Is one new int enough to change memory allocation
that much?)


--- src/vidhrdw/psikyosh.c.orig 2004-11-01 01:08:06.000000000 -0800 +++ src/vidhrdw/psikyosh.c 2004-11-01 23:32:53.150463544 -0800 @@ -312,6 +312,7 @@ static void psikyosh_drawbackground( struct mame_bitmap *bitmap, const struct rectangle *cliprect, UINT8 req_pri ) { int i, layer[3] = {0, 1, 2}, bg_pri[3]; + int steve, steve2; /* How to fix a problem without really fixing it! */

        /* Priority seems to be in range 0-7 */
        for (i=0; i<=2; i++)
@@ -321,7 +322,14 @@
                else if ( (BG_TYPE(i) == BG_NORMAL) )
                        bg_pri[i]  = ((psikyosh_bgram[0x17f0/4
+ (i*0x04)/4] & 0xff000000) >> 24);
                else /* All the per-line types, take first
row's value */
-                       bg_pri[i] =
(psikyosh_bgram[(BG_TYPE(i)*0x800)/4 + 0x400/4 - 0x4000/4] &
0xff000000) >> 24;
+                       steve = BG_TYPE(i);
+                       printf("BG_TYPE is %x %d\n", steve,
steve);
+                       steve2 = (BG_TYPE(i)*0x800)/4 + 0x400/4
- 0x4000/4;
+                       printf("original array index %x %d\n",
steve2, steve2);
+                       steve2 = (steve*0x800)/4 + 0x400/4 -
0x4000/4;
+                       printf("hacked array index %x %d\n",
steve2, steve2); /* just to prove we didn't change anything */
+                       //bg_pri[i] =
(psikyosh_bgram[(BG_TYPE(i)*0x800)/4 + 0x400/4 - 0x4000/4] &
0xff000000) >> 24;
+                       bg_pri[i] =
(psikyosh_bgram[(steve*0x800)/4 + 0x400/4 -
0x4000/4] & 0xff000000) >> 24;  /* But magically this works on
X86-64 */
        }

 #if 0




__________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com



_______________________________________________ Xmame mailing list [EMAIL PROTECTED] http://toybox.twisted.org.uk/mailman/listinfo/xmame


-- EuropeSwPatentFree http://EuropeSwPatentFree.hispalinux.es

_______________________________________________
Xmame mailing list
[EMAIL PROTECTED]
http://toybox.twisted.org.uk/mailman/listinfo/xmame

Reply via email to