Jump to content
IGNORED

TIA Questions


retrocon

Recommended Posts

It's likely I'll have some questions regarding the tia chip from time to time as I work on my project.

 

I'll post all these questions on this one thread to keep things organized. Some of them may be dumb, simple, naive, whatever, but please bear with me. I'm going through all the docs I have, but still not all is clear yet.

 

First question:

 

Are any of the values of registers, memory, etc initialized on power-on or reset on an original 2600? Are they set to 0? Are they usually 0? Do programmers always initialize first or are they any known cases where game programmers make assumations about unknown values?

 

Next question:

 

Regarding the 6507 that the 2600 uses. Does it include the BCD functions? If so, is it known if any games much use of this functionality? I know the NES doesn't have the BCD stuff, so I haven't coded it yet. If it's not in the 6507 then I probably won't bother.

Link to comment
Share on other sites

Are any of the values of registers, memory, etc initialized on power-on or reset on an original 2600?  Are they set to 0? Are they usually 0? Do programmers always initialize first or are they any known cases where game programmers make assumations about unknown values?

Yup, all those values (incl. TIA, RAM, flags, stack-pointer etc.) are (usually!) initialized by the programmers themselves. If you look at a game code you always find some initialization code executed first.

 

AFAIK all the power-on values are undetermined. And a few games (e.g. Berzerk) rely on those undetermined values to initialize their random number generator.

 

Regarding the 6507 that the 2600 uses. Does it include the BCD functions?  If so, is it known if any games much use of this functionality?

Yup, it has BCD and AFAIK it is used by almost all games (for scoring).

Link to comment
Share on other sites

Ok, I have been working on the hardware sim and I was using Andrew Davie's simple kernel from here:

 

http://www.atariage.com/forums/viewtopic.php?t=27194

 

But my sim which I thought was correct seemed to be giving some weird results. Then I noticed that on Z26 emulator, it also seemed to display the color bars with some sort of offset. So I rewrote the kernel in a way I thought was correct. When I tested it in Z26, there was no longer any offset. Even better, my sim is now giving me expected results.

 

Could someone please explain what is up with this? Is one more correct than the other or am I just going crazy? Why would the original code clear VBLANK before the 37 scanlines of VBLANK have passed?

 

Here is my newly modified kernel:


           processor 6502

           include "vcs.h"

           include "macro.h"



           SEG

           ORG $F000



Reset

StartOfFrame



  ; Start of vertical blank processing

   

        lda #%01000010

    sta VBLANK



           lda #2

           sta VSYNC

          

              ; 3 scanlines of VSYNCH signal...



               sta WSYNC

               sta WSYNC

               sta WSYNC



    lda #0

    sta VSYNC



              ; 37 scanlines of vertical blank...



               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               

           lda #0

           sta VBLANK

          





              ; 192 scanlines of picture...



               ldx #0

               REPEAT 192; scanlines



                   inx

                   stx COLUBK

                   sta WSYNC



               REPEND





           lda #%01000010

           sta VBLANK                     ; end of screen - enter blanking



              ; 30 scanlines of overscan...



               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC

               sta WSYNC



           jmp StartOfFrame





           ORG $FFFA



           .word Reset          ; NMI

           .word Reset          ; RESET

           .word Reset          ; IRQ



      END

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...