6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 8:44 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: STZ bug?
PostPosted: Wed Apr 08, 2009 7:52 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
Still working out the pinball program. Yes, 5 years and still going strong. when I revamped a bit, my self test died a horrible death and I couldnt find worth a damn. Did some wolf trapping last night and some tricks to find out my difference. This one has me scratching my head.

the problem is the VIA timer test on the 65C22. I originally wrote it in 6502 plain and on the revamp, I changed to take advantage of the STZ command to clear things out. THAT is causing me a new headache now.

Original working code:

ViaTimerTest4
SEI
LDA #$00
STA Via_ACR
STA Via_IER
STA Via_IFR
STA IrqMode
STA IrqSource
JSR FlashLEDOnce


and the new exploding code:

ViaTimerTest4
SEI
STZ Via_ACR
STZ Via_IER
STZ Via_IFR
STZ IrqMode
STZ IrqSource
JSR FlashLEDOnce


I am scratching my head o this one...

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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 08, 2009 7:56 pm 
Offline

Joined: Sun Sep 15, 2002 10:42 pm
Posts: 214
Here are a few guesses:

o STZ generates a spurious read cycle either before or after the write cycle.
o STZ generates a spurious write cycle before the write of the zero value.

Toshi


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 08, 2009 8:47 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
STA abs and STZ abs share the same cycle-by-cycle sequence in WDC's instruction operation table, both taking four clocks: one for op-code fetch, one for ADL, one for ADH, and one for the data store, with no spurious reads or writes. I've never had any problem with STZ, so I expect there could be a problem in the assembly process. Picking through the output .hex code should tell you.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Apr 08, 2009 10:03 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
Thanks. I still have yet to put it back to LDA #$00 to test it out, but the rest of the routine is identical between old and new versions with the difference being the change to STZ. (had a nasty bug after during the init where I deleted an INX in a clean memory area loop, causing the bugger to freeze and stay there and I figured I had something stupid I did like that in there. Tons of fun)

And on that aside, someone asked me to repair one of those kind of pinballs last week. Brought it home, dead CPU. So it had to await this bugger being finished. (my fault for taking so long)...

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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 10, 2009 5:49 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Another test: put the LDA #$00 back in, but leave the STZ instructions. It could also be the case that some subsequent code depends on A being zero, as cleared by the initialization routine.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 10, 2009 2:47 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
I put the actual game init code right after that test finishes up. I think I have it cleared up, according to the Good Housekeeping Seal. will be trying it out....

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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 20 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: