Atari 2600 Home | Profile | Archives | Friends
My programming of the atari 2600

Playfield 321/3/2008

Today I'm going to try and do some actual programming. First Im going to create a program that draws a border around the screen using the playfield registers. Then Im going to draw a cross in the middle of the screen.


The code

I would like to draw the smallest border possible, so that I have room left for the actual game. The border should be of equal width.


So, the horizontal resolution is 160 pixels and the vertical resolution is 242 (PAL).

The playfield registers are only 20 bits (40 bits reflected). SO


160 pixels / 40 = 4 pixels across (Minimum)

Verticaly we have 242 scan lines. So, then first 4 and the last 4 need to be solid lines...

 


Looks like I made a mistake....... 8 scan lines makes it look square.


Another thing .... when I use the following
 

 3 Scanlines -> vertical synchronisation
 37 scanlines -> vertical blank time
 192 (NTSC) or 242 (PAL) lines -> picture
 30 scanlines -> overscan

 

Things dont look right?, I cut and pasted some code from the tutorial and it didn't work :(.

I changed the code to the following?????

 3 Scanlines -> vertical synchronisation
 25 scanlines -> vertical blank time
 242 (PAL) lines -> picture
 30 scanlines -> overscan

 

This made thing look right......maybe I will try it on a different emulator.
I will stick with 300 scan lines until I figure out whats wroung.

0 Comments | Post Comment | Permanent Link

Playfield 221/3/2008

 

More playfield stuff......

 


Below is some info from Andrew Davie tutorials. I summarised some stuff to better my understanding.

 


CTRLPF

    This address is uded to write into the playfield control

    register (a logic 1 causes action as described below)

 

    D0 = REF (reflect playfield)

 

    D1 = SCORE (left half of playfield gets color of player 0,

    right half gets color of player 1)

 

    D2 = PFP (playfield gets priority over players so they can

    move behind the playfield)

 

    D4 & D5 = BALL SIZE

              D5   D4   Width

              0    0    1 clock

              0    1    2 clocks

              1    0    4 clocks

              1    1    8 clocks


So, concentrating on D0

You can use ram if You want to modify an individual bit as follows

  
   lda CTRLPF_shadow          ; load the shadow register from RAM

   ora #%00000001             ; SET bit 0 (D0 = 1)

   sta CTRLPF_shadow          ; save new register value back to RAM

  
   ----codes
  
  
   lda CTRLPF_shadow

   sta CTRLPF

You dont read from CTRLPF..... (write only).

 


Reflecting the playfield through the Y axis makes things a lot simpler, at least for a basic playfield.

I understand how to create playfields now. I will write a couple of demos to get better acquainted with the

6502 assembly language.

More notes:

ORA ->OR the contents of A
EOR ->Exclusive OR of the contents of A

0 Comments | Post Comment | Permanent Link

The Playfield18/3/2008

Below is a summary of what I have learnt so far.


There is 20 bits of playfield data stored in the TIA that correspond to 20 pixels on the screen

Each playfield pixel is 4 colour clocks wide.

Note:The Playfield is reflected through the middle of the screen (Y axis) ,so the 20 bits of playfield data
 account for 40 pixels on the screen

Now, focusing on the simplest playfield register pf1.

Looks simple,
             
               lda #$45

               sta COLUPF

The Hex value is stored in a register a, and is then copied to COLUPF in the TIA.
You then set the pattern you wantin a similiar fashion.

        
       

               lda PATTERN            ; use our saved pattern

               sta PF1                ; as the playfield shape


So, looking back at session 7


 3 Scanlines -> vertical synchronisation
 37 scanlines -> vertical blank time
 192 (NTSC) or 242 (PAL) lines -> picture
 30 scanlines -> overscan

also, you have 228 colour clocks of which  160 are used to draw the pixels on the screen.

 

 


 

All I have to do is set the colour in COLUPF and load a pattern into PF1, then I just wait 242 scanline (PAL)


After running the demo I see that I get 2 8 bit vertical stripes.

Looking ahead the TIA playfield registers (PF0, PF2) map to the onscreen pixels in reverse order.

 

Writting a game for this system looks like it is going to be headache.........The lowest level program I have written was a space invaders clone (In C and ASM) for the PC (DOS). I thought that was hard at the time even though I had 320x200 of video memory to play with as well as a huge amount of RAM.

0 Comments | Post Comment | Permanent Link

My first day16/3/2008

So I stumbled upon a site www.atariage.com and found some info on how to program the atari 2600. The atari 2600 was my first console and now looking back I can say it is my favourite. Although it has been 15 years since I owned one, I'm realy looking forward to developing games on this relic.

 

I set up an editor "Crimson Editor" so that i now have syntax highlighting. I also configured the IDE so that im now able to compile(DASM) and run binarys(Z26) at the press of a button. The Atari 2600 uses a  6507 Microprocessor which appears to be similiar to the 6502. I have programmed  the 8086 under dos and windows so hopefuly this won't be to much of a stretch.

 

I originaly wanted to make a game that is a variant of the classic game Pong. However, after looking around I noticed that this has been done to death so I will probably look at doing something else.

 

Anyway I'm slowly working through a tutorial set written by Andrew Davie that can be found at the above link. 

0 Comments | Post Comment | Permanent Link