[stella] Strange software, and weirder hardware (long)

Subject: [stella] Strange software, and weirder hardware (long)
From: Chris Wilkson <cwilkson@xxxxxxxxxxxxx>
Date: Thu, 16 Apr 1998 21:04:39 -0700 (PDT)
Ok, I said I'd tell you guys a story about misunderstood instructions,
code that works on real hardware, but only sometimes, and a fledgling
programmer who spent nearly a year beating his head against the wall
trying to figure out what was wrong.  So here it is.  But be warned, it's
kinda long...

A couple of weeks after the "How to Draw a Playfield" demo was posted here,
I took it home and started playing with it.  I added single scanline color
cycling in the background with the option to freeze the background and color
cycle the bat, via the BW/COLOR switch.  So I get the thing working on the
2600, but the switch doesn't work in PCAE.  Weird.  Oh well, it worked on
my *real* VCS, and that's what counted.  I intended to use it to test the
hardware mods I'm doing.

So I struggle with data bus contention in the new hardware (or so I thought)
for a few weeks with no luck whatsoever.  At this point I have 2 oscilloscopes
3 power supplies, a function generator, and a logic analyzer hooked up to the
thing...it looks like it's on life support in Dr Frankenstein's lab.

So I decide that I'll monitor a known working cart...my modified bat demo.
But it doesn't work any more.  "Whaddya know?  That's odd..."  I say to myself.
Then proceed to spend a few more weeks trying different consoles with the
same non-performance resulting.  "Damn..."  I try burning the eprom again.
Repeatedly.  No luck.  I build a new cart from scatch.  No luck.  I try a
Frogger cart.  Hmmmm...seemed to work, but I couldn't see what was happening.
The cart was so big I had to disconnect all my equipment!  I didn't feel like
hooking up all the test leads again, so I gave up for a while.  During this
time, I designed a daughter board that lets me just plug the logic analyzer
cable directly into the board.  Got it back a couple of weeks ago.  It rocks!

While I'm testing the new board, I try the bat demo cart.  Works like a charm.
"Huh???"  So I plug in the logic analyzer to see what's going on, and it quits
working!  Eeeek!  Something definitely screwy going on here.  So I spend a
couple of days setting up the analyzer to decode the address bus for all the
TIA and RIOT registers.  Now it tells me that "VSYNC" was just accessed,
instead of $0001.  :)  So I'm looking at the code as it gets executed and
notice that INPT0 is being accessed right after the read to SWCHB.  So I go
look at the code and find the problem.  I'm trying to use immediate adressing
with the BIT instruction.  That's a no no!  The hell of it is that I made a
typo way back when.  I typed "BIT $8" instead of "BIT #$8".  So my assembler
didn't flag it as an error...it just said "ok boss" and assembled it.

That still doesn't answer the question of why it quit working when I plugged
the analyzer in.  Or why it worked in the first place.  After all, it was 
successfully reading the BW/Color switch at address $8.  On every console I
have...about 15 of them.  Weird.  Turns out that the signal was being coupled
to the INPT0 capacitor.  Hooking up the logic analyzer increased the capacitance
enough to interfere with this.

Pretty crazy huh?  Don't ever let someone tell you that "it's ok because it
works on a real Atari"....  :)


Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/stella.html

Current Thread