6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Tue Jun 25, 2024 6:09 am

All times are UTC




Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Found the bug!!!
PostPosted: Thu Mar 22, 2012 6:12 pm 
Offline

Joined: Thu Mar 22, 2012 6:03 pm
Posts: 2
Hi guys,

I'm Gerrit "Gaston" Volkenborn from PinMAME, the guy that Rusty referred to before.

So I finally found the bug in that area of the code! :)

before:

Code:
0AAC: C0 03     cpy  #$03
0AAE: B0 07     bcs  $0AB7
0AB0: A0 03     ldy  #$03
0AB2: A0 E6     ldy  #$E6    <-- These two instructions
0AB4: 0A        asl  a       <-- are in fact one JSR!
0AB5: 91 31     sta  ($31),y
0AB7: A5 EE     lda  $EE
0AB9: 48        pha
0ABA: 20 2E 0B  jsr  $0B2E


now:

Code:
0AAC: C0 03     cpy  #$03
0AAE: B0 07     bcs  $0AB7
0AB0: A0 03     ldy  #$03
0AB2: 20 E6 0A  jsr  $0AE6   <-- like this (see $A93!)
0AB5: 91 31     sta  ($31),y
0AB7: A5 EE     lda  $EE
0AB9: 48        pha
0ABA: 20 2E 0B  jsr  $0B2E


The game works just as fine as with Lee's fix - maybe even better.
I cannot really tell what the $AE6 subroutine does, but it fiddles with the $31 RAM value that's used in the code after the subroutine execution for sure;
it also makes sense to load Y before the JSR call:

Code:
0AE6: B1 31     lda  ($31),y
0AE8: 08        php
0AE9: 29 0F     and  #$0F
0AEB: C9 0F     cmp  #$0F
0AED: D0 02     bne  $0AF1
0AEF: A9 00     lda  #$00
0AF1: 28        plp
0AF2: 60        rts


If the carry flag is set, the entire kaboodle is being skipped.

So, as I expected, one more hi bit (mask 0x80) was toggled:

00000073: FF 7F
00000076: 80 00
000000B2: 81 01
00000174: 86 06
0000017E: 80 00
000002B2: A0 20 <-- that one! Was it the last one???


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 23, 2012 12:42 am 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
Quote:
I cannot really tell what the $AE6 subroutine does, but it fiddles with the $31 RAM value that's used in the code after the subroutine execution for sure;

The routine at $0AE6 reads the indexed score digit, Y = $00 being the most significant and Y = $05 the least, and returns $00 to $09 converting the leading zero blank pattern $0F to $00.

In this case it just reads the 100s digit and writes it back, nothing changes because that digit must have been unblanked by a previous call to $0AE6 at $0A93 when a value was added to the score.

Lee.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 23, 2012 1:07 pm 
Offline

Joined: Tue Mar 06, 2012 7:38 pm
Posts: 16
Location: Spring, Tx
Great work guys!

I had the gentlemen that did the electronic repair on my board burn the new BIN file provided by Gerrit and installed that on my machine.

The initial tests seem to indicate that the new code works better than the previous. I ran it through the test and set modes and everything worked as expected. I then ran it through a series of games. The first game was a single player game it worked fine. I then tried a two player game and it worked well including the fact that there was not problem at the 1,000 point level on player two... YEAH!

However, at some point, I think it was during player one's following turn, the process broke down. It seems like it jumped to the middle of the 'sound test' routine and it played the sounds from the high pitch to the low pitch and then repeated that until I turned it off. After I turned it back it seemed to want to do the same thing. I put it in test mode and then in set mode (where all the settings appeared normal) and then back to play mode.

The Test/Set/Play switch process seems to clear out any current game settings by the way.

Anyway, when we got it back to play mode, we tried another few games (single and 2 player) and it seemed to work okay but doesn't seem to recognize the 'Ball Home (out hole)' switch (#1). It was late at that time and I obviously wasn't thinking clearly ... I decided that since I didn't have my ohm meter handy I would wait till the next day to set the switch contacts. I should have just put it in test mode and see if it recognized the ball going in.. duh.

So... when I get off of work (around noon) I'll go home and run a few more test and see what I come up.

The code does seem to be a lot more stable but there is still something amiss. When I can narrow down the exact processes that create and issue and I can repeat it, I will post that here so maybe ya'll can go direct to that piece of code and see what gives.

Oh... I did discover that my 'rotational tilt' switch board (uses an optic sensor) was too sensitive and that was really freaking out the machine. I de-sensitized it a bit and that issue cleared up.

Thanks again for everyone's great work! You guys are awesome!

Rusty

_________________
Rutsy key
me@rustykey.com
www.rustykey.com


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 23, 2012 6:08 pm 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
If you get the chance I still need you to confirm the rotate tilt and test switch wiring.

The test switch should go to J1 pin 3 and the rotational tilt switch should go to J1 pin 4 according to the schematic.

With that information I should be able to complete commenting the disassembly.

Lee.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 23, 2012 7:13 pm 
Offline

Joined: Tue Mar 06, 2012 7:38 pm
Posts: 16
Location: Spring, Tx
I will check this once we arrive in X
Dallas for the Texas Pinball Festival. I do know that it seems to not recognize the ball in the out hole (switch 1) on like every second or third ball. I verified that the switch is making contact. It is like three hours to Dallas so it will be later before I can check it.

AT THE TEXAS PINBALL FESTIVAL NOW.

I have not had the chance to trace the Test and Tilt switch but will do that a bit later this morning.

However, here is something to consider. There is places that it stores temporary values used by the game that is in non-volatile memory such as number of players currently playing, current feature lane level, etc. along with 'permenant values' such as games to date, coins to date, etc. I say these are in non-volatile memory because when I pull the batter and short the battery contacts to force a full drain, all the 'regular' values that you can change in 'Set Mode' are reset or nullified, but 'permanent values' that I mentioned are not lost or reset.

The reason I bring this up is that I have see the number of players go to 6 (when the machine freaks out) and other values that don't really make sense on the display field. I think this is also going only in the current problem the machine is having.

Currently, the machine is hung in a 'feature lane' scoring loop. When I turn the machine on and try to start a game, it imediately start running up the player 1 score and at the same time cycling through feature lanes lights and attempting to play the rising sequence of tones associated with the feature lane score. I think it's doing this because there is a bad value in the 'feature lane level' field and thus it never equals the 'highest value' possible and keeps cycling (it's checking for = and not >=). Since I can't reset the current game values, I can't get it out of this loop.

Any help quickly would be great! I think this proboble will be solved in one of two methods, I leave the game alone and let it cycle through the scoring until it 'wraps around' through the maximum value back to zero or I can clear that value.

Suggestions?

_________________
Rutsy key
me@rustykey.com
www.rustykey.com


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Mar 25, 2012 3:28 am 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
Quote:
when I pull the batter and short the battery contacts to force a full drain, all the 'regular' values that you can change in 'Set Mode' are reset or nullified, but 'permanent values' that I mentioned are not lost or reset.

There is only the 256 bytes of battery backed page zero RAM for the game to store any values in. The 128 bytes or RAM in the RIOT are used as the stack and nothing else, no game values are stored there.

What you are probably seeing is the 'random' state that the RAM comes up in after having power removed. Unlike when erasing EPROM or flash ROM when static RAM is first powered it isn't all 1s or 0s, each bit can be either but is most likely to be the same as when it was last powered up. So if removing the battery didn't fix the problem it is unlikely to do so if tried again.

Quote:
Suggestions?

Apart from making a special EPROM to clear the RAM your best bet is to try the "special technique" of forcing $5A onto port B of the RIOT by pulling down the four 0 bits with 220 ohm or 330 ohm resistors. This will cause the reset code to clear all of the battery backed values at powerup.

It should be possible to add code that in future would allow this by powering up with certain switches closed.

Lee.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Mar 25, 2012 9:26 am 
Offline

Joined: Thu Mar 22, 2012 6:03 pm
Posts: 2
leeeeee wrote:
... your best bet is to try the "special technique" of forcing $5A onto port B of the RIOT by pulling down the four 0 bits with 220 ohm or 330 ohm resistors. This will cause the reset code to clear all of the battery backed values at powerup.

Perfect analysis there, Lee!!! :D

I added a dip switch to the PinMAME code that will apply the 0x5a value on reset if the switch is set, and all the settings are cleared out this way!
So a modification of the real game should be a push button that will pull the correct data lines up or down on power on. Easy to do, one should think...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Apr 09, 2012 2:49 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
Or a code mod to force the RAM clearing at each power up of the volatile game variables, but leave the nonvols alone?

_________________
"My biggest dream in life? Building black plywood Habitrails"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Apr 09, 2012 3:42 pm 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
wrkey and Gaston I still need someone to confirm the rotate tilt and test switch wiring. With this information I can finish documenting the Spetra IV code.

Lee.


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 18, 2012 4:11 am 
Offline

Joined: Tue Mar 06, 2012 7:38 pm
Posts: 16
Location: Spring, Tx
Okay, first let me apologize for the delay in responding. Since I have returned from the Pinball festival I have had to catch up at work, taken my kids to Washington DC on Spring break (Smithsonian!!!), was sick for about a month, purchased and restored a 1950's Vendo 39 coke machine and currently in the middle of refinancing my home. Everytime I walked past the Spectra IV I told myself, tomorrow I'll have time. Tonight I took the time.

Now, let me say THANKS to Leeeeee and others who have helped debug the game so that I could bring it to the Texas Pinball Festival. Because of the rarity of this machine and all the work that had gone into making it work and keeping it going during the show...

The Spectra IV was award 1st place in the Most Original Machine category!

Here's a link to the award page: http://texaspinball.com/tpf/previous-shows/tpf2012/

Now, back to the business at hand.

I traced the wires as requested. The Rotational Tilt signal circuit traces to J1 edge connecter to Pin 4. The test signal circuit traces to J1 edge connecter to Pin 3. The actual circuitry matches the schematic in my documentation.

In my tracing of the rotation tilt circuit I discovered that the signal wire had been cut at sensor board. I repaired that and hoped that would solve the problem. But it made no difference in the game. Now that I think about it, does this indicate that the machine is acting goofy even though it never senses a tilt error?

Currently the machine is in the following state:

1. Test process works flawlessly. However, activating the Rotational Tilt does not display a switch number in the switch test mode. The plum bob tilt does display the correct switch number. However, there is no switch number assigned to the Rotation Tilt in the manual so this may not be an error... it just may not function in test mode.
2. Set up process works flawlessly.
3. When set to play mode the machine will go into Attract mode as expected.
4. Activating the coin switch adds a credit as expected.
5. Starting a game causes the machine to 'reset' but it immediately starts to cycle the feature lane and running up the score.

While at the festival, the machine into this mode and it was only after I pulled the battery and shorted to the battery connections to drain the memory caps did it reset. I have not done this yet but hope to do so soon.

A thought about the currently feature lane cycle problem. In previous instances when the machine 'freaked out' I found erroneous values in the various configuration variables, it number of players = 6, number of balls = 7, etc. I'm wondering if the variable that retains the number of times the feature lane was activated is corrupt and this makes the machine do funky things once a game starts. I do know that the feature lane eject hole switch is working properly.

Well, there we go. Hopefully with the information I provided above, Leeee can complete the documentation process which would then lead to a more intelligent diagnosis of the problems. Again I can't says thanks enough for all the help I have received and I am very excited about the prospect of getting this machine and the 15 or so others known to exist up and running at full potential soon!

_________________
Rutsy key
me@rustykey.com
www.rustykey.com


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 18, 2012 11:27 pm 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
http://mycorner.no-ip.org/6502/spectraiv/index.html

Lee.


Top
 Profile  
Reply with quote  
PostPosted: Thu Apr 19, 2012 1:49 am 
Offline

Joined: Tue Mar 06, 2012 7:38 pm
Posts: 16
Location: Spring, Tx
Lee, Dude! You are awesome!

I hope to update my Spectra IV restoration page soon and when I do I will include the above link. If you think this link and it's information may be moved or deleted over time, let me know and I will duplicated on my personal website.

You are the man!

So... With the information I just provided about the Test and Tilt circuits, were you able to complete the documentation? If so, is that was is in the last link of your page?

Again, thanks so much! Your insight and assistance has been a huge benefit for getting these machines back to working as they should!

_________________
Rutsy key
me@rustykey.com
www.rustykey.com


Top
 Profile  
Reply with quote  
PostPosted: Thu Apr 19, 2012 2:11 am 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
The information you provided and the not having looked at the code for a month meant I saw immediately where I had been confused before. With this confusion gone I could understand what the last few bits of code were doing and finish the disassembly to a point where I'm happy to share it.

Also credit to Gaston for spotting the JSR to LDY transformation that caused the score bug.

I plan on keeping my site up, it's been around on one host or another for over a decade so far. The link should be good for some time to come.

Lee.


Top
 Profile  
Reply with quote  
PostPosted: Tue May 08, 2012 4:14 am 
Offline

Joined: Tue Mar 06, 2012 7:38 pm
Posts: 16
Location: Spring, Tx
Okay, I've now taken Lee's commented code.. which he did an incredible job with BTW.. and created a complete Flow Chart in MS Visio. I think I've got everything flow charted. These files are now on my website on the last page of my Spectra IV project page for those of you who want to view it.

There are now three files, the commented ASM file, the Visio Flow Charts and a Cross Reference for routines/address to the Flow Chart pages.

_________________
Rutsy key
me@rustykey.com
www.rustykey.com


Top
 Profile  
Reply with quote  
PostPosted: Tue May 08, 2012 3:26 pm 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
Can you export the information in them in a more portable format such as pdf, html or even text for those of us without Office 2007?

Lee.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 39 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: