After hopefully curing the hardware problem I can return to software issues.
Playing the real PCB in my cab feels a lot slower at some parts when the bunkers get busy compared to playing in MAME.
I can't help thinking that all the extra interrupt code to re-map the buttons that I described here
http://www.ukvac.com/forum/gravitar-on-space-duel-pcb_topic349983_post980511.html?KW=buttons#980511 is taking up too many CPU cycles.
How can this be improved I wondered?
Well the real Gravitar code uses the interrupt service routine to decide whether it's player 2 in a cocktail cab or an upright cab and makes up a single byte bit pattern that is then stored in RAM at $1D. The main game code then looks directly at this RAM data at $1D and takes action based on which bits are set representing which buttons are pressed.
I thought that instead of using lots of shifts to reconstruct the same bit pattern Gravitar expects in the RAM copy, it may be faster to change all the locations in the main code that look at that RAM copy to suit the pattern Space Duel hardware has. A search of instructions that read location $1D soon found all of them, so it looked a possible speed up solution.
Space Duel hardware has the buttons mapped across several memory locations just using bits 6 and 7 rather than a single 8 bit byte. For any player only three memory locations need to be read for all buttons while in a game. For speed I thought that it would be best to simply read all three hardware button locations and store them in three RAM locations. This meant finding two extra bytes, preferrably in zero page for speed. After some more digging I found two unused locations at $8A and $8B.
So the interrupt service routine code can now be reduced to
LDA $900 ;7-Shields 6-Fire
STA byte_1D
LDA $902 ;7-Rotate left 6-Rotate right
STA byte_8A
LDA $904 ;7-Thrust 6-P1 start
STA byte_8B
which is a lot less instructions than all the shifting I had previously.
I then went through all the main code and replaced all the reads of $1D and subsequent logical AND instructions to match the new locations and bit positions.
For example the thrust button handling code
LDA $1D
AND #10h ; Check Thrust button (Gravitar hardware)
becomes
LDA byte_8B
AND #80h ; Check Thrust button (Space Duel hardware)
After replacing all the locations for each button I tested in MAME and verified it worked. After a few failed attempts I managed to get it to play.
The next step will be to burn a EPROM and try it in the actual cab and see if I can see an improvement in speed. After that it will need to be compared side by side with a real Gravitar by a more experienced player than me. Backflipper is on that list
Arcade Club now has a working Gravitar too, I saw someone playing it just this last Saturday night that was doing very well on the negative gravity level, but I left before I could chat to him. If Andy gets a Space Duel cab working I will ask if I can put my conversion in there for some testing by such players maybe.