Jump to content
IGNORED

7800 wierdness


Bruce Tomlin

Recommended Posts

Saturday, I typed in the tank demo from Harry Dodgson's monitor cart documentation. When I ran it, the screen was totally screwed up! Hey, how did I get the Maria to do that? It was all herringboned, and the lack of sync meant it was all in black and white. But I could still see all the little tanks moving around in spite of this!

 

Eventually I figured out that I needed to set the stack pointer (the tank demo wasn't designed to run standalone, so it depended on the stack already being set up).

 

I wondered what the stack was set to, and why. Here's the code from the boot rom that jumps into a 7800 cart:

 

SETMARIA  LDX     #$16                  ;~~~~~~~~~IN 3600 MODE, CART...

         STX     INPTCTRL

         TXS

         SED

         JMP     ($FFFC)               ;VECTOR INTO THE CART IN 360...

So for some reason, the stack is intentionally set to $16. And decimal mode is set too, but the tank demo had a CLD early enough that this wasn't a problem. Maybe someone wanted to make absolutely sure that people weren't going to depend on startup conditions of stack or decimal mode set by the boot ROM, by setting them to annoying values instead.

 

The 2600 startup mode, on the other hand, leaves S=$FF, CLD, so go figure.

 

Apparently something about using JSR was writing to a register that caused problems with the graphics. Not sure whether it was TIA's fault or MARIA's fault, but the TIA is still accessible at those low addresses. And then there's the question of why the code was still running properly anyhow! My guess is that the $110-$11F range works in such a way that it mirrors reads and writes to RAM (like the rest of the $140-$1FF range), but it still ends up writing to TIA registers. Then when reading, RAM is read back with the correct return address. It'll be hard to be sure without a good internal debugger or an ICE.

 

Hmm, $15/$16 is AudC0/AudC1. At least now I know why the sound I started at the beginning of the code stopped immediately. Below that is ResBl/M1/M0/P1/P0, so even with a couple levels of subroutines, it would have taken some work to do things to make the TIA screw up graphics.

 

Anyhow, don't forget to set the stack pointer. :-)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...