What's new

ekorz

Multi Boyz 4 Pi
Legendary
Multi Boyz
Joined
Aug 21, 2016
Messages
5,187
Reaction score
7,770
Location
Boston, MA
Edit: First release here
Go play your Namco 20th Anniversary board without flipping your yoke wires!

Original post in spoiler now

I've been thinking about a post from this thread for a while. Namco tate rotation is backwards and as such I barely ever use my Namco 20th Anniversary pcb. Having dipped my toe into mame debugger (thanks @Hammy) I decided to give it a shot.

Looking at the Namco Anniversary boards, both of them have "cocktail" mode. which means that player 2 has the screen flipped.

this can work as a simple way to play in the alternate rotation and it also means that the code exists to flip the screen so hacking it is more a matter of permanently setting it to flip for P2.

I'll update this first post with the patch as soon as it's ready, but it's not quite ready so I wanted to update folks on where I am, ask a few questions, and probably ask for some help. There some notes in here that will certainly be useful for anyone wanting to build a patch for the actual Ms. Pac Man (maybe even normal Pac Man) or the other anniversary boards. More than anything this disassembly is the key.

i/o for flipping is sent to 0x8b, so I force set that to 01 and patch all the other calls in the rom to nop.
4e72 is the address where the cocktail/flipping bit lives
flipping just flips the map and background, not the ghosts or ms.pac
most of the sprite flip checks look like "check for cocktail and check for p2, then do the sprite math" (ref) so I change them to "check for cocktail OR p2..."

The result is a currently running Ms. Pac Man in permanent p2 cocktail mode.

First question... permanent p2 means the game can be one player, or can alternate between p1 and p2, but always uses p2 controls. I think I can patch that so the controls get handed off between players. I think I could force it to be always p1 controls. I can see arguments for either. What would people want?

Second question... anyone applying this patch, do you actually desire the ability to set it back to "normal" somehow in the service menu? If so, what does "normal" look like for you?

Third question... how important is *also* flipping Galaga :D Because that one is being more difficult and if I can't solve it, I'll either ask for some help here or just post the patch anyway.
 
Last edited:
First question... permanent p2 means the game can be one player, or can alternate between p1 and p2, but always uses p2 controls. I think I can patch that so the controls get handed off between players. I think I could force it to be always p1 controls. I can see arguments for either. What would people want?
Well on the original uprights both players shared P1's controls, the cocktails had 2 control panels since players sat on either side. I'd suspect one of those cocktail mode checks you patched is checking for controls and maybe needs to be un-patched? I'd think there's an argument for both players being mapped to P1 since that's how the original played, but also allowing P2 to have their own controls makes sense too.

Second question... anyone applying this patch, do you actually desire the ability to set it back to "normal" somehow in the service menu? If so, what does "normal" look like for you?
To me the "ideal" patch is one that makes the game how Namco should have shipped it in the first place. That would mean a way to set the screen flip in either direction and still allow cocktail mode to function.

Third question... how important is *also* flipping Galaga :D Because that one is being more difficult and if I can't solve it, I'll either ask for some help here or just post the patch anyway.
See the answer to question 2 :P


I've never attempted a screen flip patch but I wonder if there's a less brute-force way to go about this.... or maybe the difficulty here is why Namco themselves didn't bother.
 
It doesn't seem crazy difficult, but since as you say Namco knew the hardware they were shipping for - I think they didn't bother. Then when they went to do the anniversary versions they pretty much did the minimum. Bad news for potential enhancements. But good news for me, since I'm looking at disassembly of the originals!

I'm sure someone with more experience could swing this more cleanly, which is part of the reason why I'm going to add my documentation here. I just want to play it, but I may never get it perfect. If it holds my interest I will keep at it though... So the ideal state is to have Upright/Cocktail still function, but just another toggle on the service menu called e.g. Flip Screen?

So I'd always use Flip-Screen and Upright, but I'm still undecided about if P2 should use P1 controls or not.

done: pac gameplay, galaga gameplay. both play with p2 controls all the time due to Galaga's handling of sprite-flip & controls with the same bit afaik.
tbd: sprites in master game-select-screen, sprites in galaga attract mode scoring table. Then patch checksum!
 
Last edited:
Cool project! I did not realize this limitation exists in the anniversary edition, always thought it was strictly on the original game. Dang Namco and their rebel flip!
 
small road block... hopefully someone can clear it up for me.

In the static game-select screen on this, it renders a ghost and a ship (which spins). I can see these in the sprite ram, notes in the spoiler. What I can't figure out is how to adjust the overall sprite offset, or even find it. By offset, I mean that if I take the Y value and zero it out, it only moves a few pixels. Then if I max it out, it drifts the wrong direction... so I'm assuming there is some sort of offset at play, otherwise the 0x and 0y values would be the bottom corner, which they are not.

4e000 = start of sprite ram space
000 = red ghost looking/movement
001 = color of ghost
002 = sprite of the ship 00 through 06

80 = x of ghost (we want instead ship's x, C0)
81 = y of ghost
82 = x of ship (we want the ghost's x, 30)
83 = y of ship

100 = flip of the red ghost ****must set this to 01!!!
101 = ghost on/off (we want on, it is on, 01)
102 = orientation of the ship 00-03 combines with 002 to give it 16 variations
103 = ship on/off

Here it is with ghost and ship X of 00

1618285961056.png


and with ghost and ship X of 40 (more and they just keep going off the screen)
1618286049424.png


...But I really need them down the screen, just above the namcoarcade.com url. Yes this is my flipped version but the same thing applies for the normal version... I can't make these sprites travel the length of the screen, I figure there's an offset value at play but I don't know how to find it.
 
sprite ram 000 , 080 and 100 for the title screen by the looks of things they all work in conjunction.

4 bytes length and updated every frame - the write to ram needs to be fixed before sending over to the ram.
There will be an "add" or something at some stage that can be modified before it sends over.

Also seems it has multiple checksums for each rom.
One of them is @ FBD5 , however adjusting this triggers another rom error :P
The remaining checksum code will prob. be copies of this same check with the changes you'd expect.
 
Last edited:
@Hammy ive got those locations in my spoiler above but I’ll keep playing with the values. Maybe 100 isn’t just the flip. You think one of those is the offset? Is there even such thing as a sprite layer offset?

I looked at the main game code and have no trouble reorienting the sprites in there.

Also yesc it does pull all values into one of the registers(?) and load it all in a dump, I’ve seen those spots. I just can’t get the dang sprites in the right spots so I know what values to change!
 
Ok here's version 0.1F for permanently flipping Namco 20th Anniversary Ms. Pac Man / Galaga.

Released now because I'm tired and just want to play it a little bit! I made a hex joke at dinner and nobody laughed
It's not done, but if you want to run the IPS and give it a shot, I'm totally open for any feedback/bugs
It's based on 20pacgal as of Mame0229 but it's probably been the same rom for a long while
Use an IPS patcher and apply it to ms_pac-galaga_v1.08.u13
Write the resulting patched file to 27c020 (or equivalent, 27c2001 etc. I like W27c020 since it's not ceramic) and replace u13
My notes are a bit of a mess but I'll try to consolidate them all later

The Good:
Boot up notes revision "REV 0-1F" for 0.1 Flipped
Test menu has, in general settings Cabinet Type "Broken!" and "Flipped". You must pick "Flipped" before playing
Both players always use p2 controls; it's permanent p2/cocktail mode
Both games play well/good/fine(/perfect?) to me, a casual
The hidden game Pac Man also works fine (UUUDDDLRLRL using player 1 controls on the game select screen, then press start for Ms Pac Man)
I haven't touched the controls, and if you recall this thing isn't exactly jamma, I might try to remap this next rev
For now, to start a game if you used a jamma cab:
MsPac 1player start = P1 Start
MsPac 2players start = P2 Start
Galaga 1player start = P1 B2
Galaga 2players start = P2 B2

The Bad:
Checksum is not exactly fixed, but rather skipped
Game select screen has star-field scrolling the wrong way
Game select screen has improperly placed sprites for the ghost and the ship. They're upright and x position is fixed, but y position is not
Attract Mode "Score" screen demo on Galaga places the enemies in the wrong spots, and generally doesn't work
Attract Mode & "Score" screen on Galaga both have the star-field scrolling the wrong way

P.S. If you run it in MAME... use the flags "-flipx" and "-flipy" from command line since MAME rotates it the other way automatically :D
 

Attachments

  • ms_pac-galaga_v1.08.ips.zip
    446 bytes · Views: 116
Last edited:
Wow I should not have left this so long. My notes are messy and my memory is foggy. Just dropping this stuff in case someone else wants to poke around, hopefully I kept them current when I was working, because now I can't recall if they're 100% accurate or not. If anyone has q's feel free to ask, I'll be happy to dive back in and refresh my memory to help someone out.

Consolidated:
0x8b is the i/o for the flip bit
memory address for the bit is at 4e72
all instances of checking logic, then setting that bit are hard-coded to return 01

pac disassembly that's super helpful:
https://github.com/BleuLlama/GameDocs/blob/master/disassemble/mspac.asm

the sprites don't flip, but the evaluation is determined here
3A 09 4E A0 C8

exact location in disassembly:
https://github.com/BleuLlama/GameDo...26497b32941eafa0a/disassemble/mspac.asm#L4322

So we just patch the logic to return FLIP if either player is playing
3A 09 4E B0 C8

Galaga was harder, the flipping seemed tied to the player controls

9983 is cabinet type 0=upright,1=cocktail, and is only checked at the beginning.
9840 is the player playing
9215 true is if to flip, and if to use p2 controls

intro/animation:
coin = 44BF2

4e000 = start of sprite ram space
000 = red ghost looking/movement
001 = color of ghost
002 = sprite of the ship 00 through 06

80 = x of ghost (we wnat the ship's x, C0)
81 = y of ghost
82 = x of ship (we want the ghost's x, 30)
83 = y of ship

100 = flip of the red ghost ****must set this to 01!!!
101 = ghost on/off (we want on, it is on, 01)
102 = orientation of the ship 00-03 combines with 002 to give it 16 variations
103 = ship on/off

checksum:
first attempt
at bp F6B3 it looks like it will jump if the zero flag is set. it's not on mine. I'm forcing the jump anyway
A7 28 05 21 81 F6 86 to A7 18 05 21 81 F6 86


Galaga patch notes to keep the cocktail bit set:
;on load

001C: ret
02E3: out ($8B),a
02E5: ld ($9215),a
02E8: ld ($99B9),a
02EB: dec a
02EC: ld hl,$92CA
02EF: ld b,$10
02F1: rst $18

00 32 15 92 32 B9 99



;after that

033C nop 00
033D nop 00
033E ld ($9215),a 32 15 92
0341 ld ($9012),a 32 12 90
0344 ld b,$80 06 80
0346 ld hl,$9200 21 00 92
0349 rst $18 DF
034A ld a,$06 3E 06
034C ld ($99BE),a 32 BE 99
034F rst $28 EF
0350 call $003C CD 3C 00
0353 call $1230 CD 30 12
0356 ld a,($4BF1) 3A F1 4B
0359 and a A7
035A ld a,$01 3E 01
035C jr z,$0360 28 02
035E ld a,$02 3E 02
0360 ld ($9201),a 32 01 92
0363 jr nz,$037D 20 18
0365 xor a AF
0366 ld ($9203),a 32 03 92

32 15 92 32 12 90



;in an HL loop

0016 rst $38 FF
0017 rst $38 FF
0018 ld (hl),a 77 ; hl at this point is 9215
0019 inc hl 23
001A djnz $0018 10 FC
001C ret C9
001D rst $38 FF
001E rst $38 FF
001F rst $38 FF
0020 ld a,e 7B
0021 sub $20 D6 20
0023 ld e,a 5F
0024 ret nc D0
0025 dec d 15
0026 ret C9
0027 rst $38 FF
0028 ld hl,$9100 21 00 91
002B ld b,$F0 06 F0
002D xor a AF
002E rst $18 DF
002F ret C9


;can't find a place in the HL loop to fix things, so this seems like an OK place to do it instead

0344 ld b,$80 06 80
0346 ld hl,$9200 21 00 92
0349 rst $18 DF
034A ld a,$06 3E 06
034C ld ($99BE),a 32 BE 99
034F rst $28 EF
0350 call $003C CD 3C 00
0353 call $1230 CD 30 12
0356 ld a,($4BF1) 3A F1 4B
0359 and a A7
035A ld a,$01 3E 01
035C jr z,$0360 28 02
035E ld a,$02 3E 02
0360 ld ($9201),a 32 01 92
0363 jr nz,$037D 20 18
0365 xor a AF
0366 ld ($9203),a 32 03 92
0369 inc a 3C
036A ld ($9002),a 32 02 90
036D ld a,($4BF1) 3A F1 4B
0370 and a A7

on 034C pop out to where I patched the other thing.

32 AO FC ; load zero into A
3C ; increment it to one
32 15 92 ; send it to 9215
3E 06 ; the instruction that resets A
32 BE 99 ; the instruction I wrote over
C3 4F 03 ; jump back to

zero at FCAO


;on a mid-game flip 5DC hits the stack

05DA nop 00
05DB nop 00
05DC ld ($9215),a 32 15 92
05DF ld a,$3F 3E 3F
05E1 call $12C3 CD C3 12
05E4 scf 37
05E5 ex af,af' 08
05E6 call $117F CD 7F 11
05E9 ld a,($9843) 3A 43 98
05EC and a A7
05ED jr z,$060F 28 20
05EF ld c,$03 0E 03
05F1 rst $30 F7
05F2 ld a,$80 3E 80
05F4 ld ($99B4),a 32 B4 99
05F7 ld hl,$900E 21 0E 90
05FA ld a,$01 3E 01
05FC ld (hl),a 77

32 15 92 3E 3F

just loading what I know is 01 into A first, the cocktail bit
05DB = 3A 83 99 ; ld ($9983),a
 
  • Like
Reactions: nem
After watching my sister get incredibly frustrated with the 60-in-1 MsPac, I decided to buy one of these for eventually going in a small bartop build for her.
I'll be enjoying this little board for the time being and will screw around with this.
Thanks for this little project.
I didn't know these had no monitor flip.
 
For a bar top you might be able to just rotate it “namco” style and be good flipping other games. But hey, now you have an option!
 
For a bar top you might be able to just rotate it “namco” style and be good flipping other games. But hey, now you have an option
We shall see depending on what her goals are.
As soon as my eeproms get in, I'll get this cook'n.
Thanks again.
 
Back
Top