Pac-Man Mame driver bug??

Hurray Banana

Moderator
Staff member
vacBacker
Feedback
8 (100%)
Credits
2,766CR
Ok so I have resolved my sprite issues with my short Ghost Hunt game running on Pac-Man hardware. I'll explain more about that in the thread about that.

Now that I have the sprites working correctly I can explain a bug I think I've found in the Pac-Man driver

I've done a video of my code running in Mame 0.171 (I also tested this in 0.174 and it has the same wrong behaviour) and on my Midway Pac-Man board.

here's the video


Basically when a sprite is partially off the bottom of the screen (Y values less than $10) the hardware draws the missing parts at the top of the screen, basically wrapping the sprite. Unfortunately it appears in mame that the driver is ignoring the x and y flip bits (bits 1 and 0 of the sprite number register - that's the first byte in each sprites info values) so if the sprite is flipped vertically (bit 1 is set in the sprite number regsiter) it is drawn at the bottom of the screen ok but the wrap at the top is rendered as if the bit is clear.

This renders properly on the Pac-Man board.

If anyone knows how to report this to the Mame dev team can you let me know how please.

Thought this might be interesting as this bug would not have surfaced as the sprites never wrap the top and bottom of the screen on Pac-Man because of the maze layout and the horizontal wrap as 32 pixel locations that don't render on screen at all, so you would never see a wrap problem.

Hurray Banana2016-06-12 22:35:57
 

cmonkey

Active member
vacBacker
Feedback
4 (100%)
Credits
1,659CR
it's interesting to note that in src/mame/video/pacman.c there's a FIXME comment in the screen_update_pacman method re. bit flipping :-

/* also plot the sprite with wraparound (tunnel in Crush Roller) */

m_gfxdecode->gfx(1)->transmask(bitmap,spriteclip,

( spriteram[offs] >> 2 ) | (m_spritebank << 6),

color,

fy,fx, //FIXME: flipping bits are really supposed to be inverted here?

sx - 256,sy + m_xoffsethack,

m_palette->transpen_mask(*m_gfxdecode->gfx(1), color & 0x3f, 0));
 

big10p

Coins detected in pocket!
vacBacker
Feedback
13 (100%)
Credits
6,097CR
Sure looks like a bug, but as you say it never manifests in Pac-Man. On the subject of bugs, I've noticed that the red ghost sprite gets offset on the X axis by 1 pixel when an energiser is eaten, and the ghosts turn blue. So, when it moves up/down, one side of the blue ghost is touching the maze wall, instead of there being a pixel gap on either side. Can someone confirm this happens on original Pac-Man hardware?
 

cmonkey

Active member
vacBacker
Feedback
4 (100%)
Credits
1,659CR
This issue is also mentioned in the video driver. I don't know how it compares to real hardware as I don't own a Pac-Man board :-

/* In the Pac Man based games (NOT Pengo) the first two sprites must be offset */

/* one pixel to the left to get a more correct placement */
 

Hurray Banana

Moderator
Staff member
vacBacker
Feedback
8 (100%)
Credits
2,766CR
cmonkey said:
This issue is also mentioned in the video driver. I don't know how it compares to real hardware as I don't own a Pac-Man board :-

/* In the Pac Man based games (NOT Pengo) the first two sprites must be offset */

/* one pixel to the left to get a more correct placement */

I might have to look into that, seems a bit odd, that an offset is needed for just two
 

big10p

Coins detected in pocket!
vacBacker
Feedback
13 (100%)
Credits
6,097CR
Interesting. I wonder why this offset is needed? "to get more correct placement" doesn't make sense to me, really. I'd like to know if this is present in the original hardware.
 

silverfox0786

Beware the Hillman
Feedback
47 (100%)
Credits
2,699CR
was this not a big you found Eric

Code:
- 06235: [Graphics] (pacman.c) pacman: X and Y flip bits are ignored when sprite is rendered at top of screen due to vertical wrapping (Robbbert)
 

Hurray Banana

Moderator
Staff member
vacBacker
Feedback
8 (100%)
Credits
2,766CR
silverfox0786 said:
was this not a big you found Eric

Code:
- 06235: [Graphics] (pacman.c) pacman: X and Y flip bits are ignored when sprite is rendered at top of screen due to vertical wrapping (Robbbert)

Yeah I reported it on Mametesters and Robbert went and fixed it. Ade spotted a comment in the source that hinted at there being a potential issue but the pac-man code doesn't ever show the problem as the sprites never wrap top and bottom of the screen.
 

Hurray Banana

Moderator
Staff member
vacBacker
Feedback
8 (100%)
Credits
2,766CR
silverfox0786 said:
ok i see they added the fixers name not the finder

although adding you as well would have been nice of them to to

I am credited on MameTesters.org. Nice thing is it now means Mame will render the things I'm planning to do on Pac-Man hardware properly now
smiley1.gif
 

silverfox0786

Beware the Hillman
Feedback
47 (100%)
Credits
2,699CR
Hurray Banana said:
silverfox0786 said:
ok i see they added the fixers name not the finder

although adding you as well would have been nice of them to to

I am credited on MameTesters.org. Nice thing is it now means Mame will render the things I'm planning to do on Pac-Man hardware properly now
smiley1.gif

yes i thought the same thing

least the bug is fixed
 

Robert

Newbie
Credits
33CR
silverfox0786 said:
ok i see they added the fixers name not the finder

although adding you as well would have been nice of them to to

Whatsnew is created by an automated procedure. It isn't usual to credit the reporter, only the fixer. Sorry if anyone felt left out.

The good thing is that now MAME should display exactly the same as the real hardware, no matter what.
 
Top