Writing Atari 2600 games in BASIC:
In the 70's and 80's programmers spent thousands of hours writing Atari 2600 games in low level Assembly to directly control the electron beam as it drew each scan line on the Television screen. 
With Atari 2600 BASIC Programming released on Cartridge in 1979 it became possible to write small programs and games in just a few lines of BASIC. 
Flashback BASIC adds the ability to compile your code into lightning fast machine language - faster than classic Atari games with better graphics via a soft blitter chip that you control with simple BASIC commands! 
You can draw the sprite graphics and large virtual worlds with ASCII art and a built in tracker-sequencer allows you to add in game sound-fx and chip tunes to your BASIC creations. 
Alternately, an old-school vintage BASIC mode with line numbers is supported for classic programming and classic contests like the annual BASIC programming contest open to all 70's and 80's Computers. In this mode, games can be as simple as the 10 line contest entry above, One Player Tron - here's the BASIC listing: 

0 if g=0 then for x=18 to 239:virtualworld(x)=0:next x else f=f+1:goto 2:rem ini
1 for x=0 to 9:g=g+10:rowcolors(x)=g:next x:x=10:y=5:h=1: rem initial dir right
2 if f<4 then scrollvirtualworldtoggle=0:return else scrollvirtualworldtoggle=1
3 if joy0left=1 then e=1:h=0:i=0:j=0:AUDC0=8:AUDF0=BITIndex:SUSTAINFORFRAMES=15
4 if joy0right=1 then h=1:e=0:i=0:j=0:AUDC0=6:AUDF0=BITIndex:SUSTAINFORFRAMES=15
5 if joy0down=1 then i=12:e=0:h=0:j=0:AUDF0=y*3:AUDC0=15:SUSTAINFORFRAMES=15
6 if joy0up=1 then j=12:i=0:e=0:h=0:AUDC0=3:AUDF0=y*2:SUSTAINFORFRAMES=15
7 x=x-e:x=x+h:l=i/12:y=y+l:l=j/12:y=y-l:BYTErowoffset=BYTErowoffset+i:rem TRON!!
8 BITIndex=BITIndex-e:BITIndex=BITIndex+h:BYTErowoffset=BYTErowoffset-j:f=0
9 if vwpixel(x,y,on)>0 then COLUBK=100:SUSTAINFORFRAMES=100:goto 6:rem Atari VCS

How to play One Player Tron:

The game pans the camera to follow your character Tron about the virtual world and sets pixels to blaze your lightcycle trail. If Tron crashes into his own lightcycle trail the game purple screens and is over. If Tron leaves the borders of the virtualworld he can vanish and may be derezzed if he does not return promptly. The goal is to survive as long as possible on the game grid. 

Program design:

This program pans the playfield camera to follow Tron using BITIndex and BYTErowoffset, the X and Y*12 coordinates for the camera. And it sets pixels on the large virtualworld bitmap using the vwpixel command:
 
When setting the pixels, the vwpixel command also polls their prior state and returns a zero if the pixel had been off so the program is able to detect a crash in the last line and short circuits to eventually cause a timing error - this ideosyncracy is exploited to make the screen start to go unstable and shake apart after a crash. The game is technically over once you purplescreen but you can often go on for awhile before your lightcycle breaks apart :) 

This Tron game is hard, if you last more than a minute before crashing that's excellent! If you have the new handheld Atari console this game is perfect for playing against Traffic lights, you can usually get a few games in before the light turns green and once it does, the game can help you get in the right mindframe for drag racing the player in the next lane. 

A more classic BASIC view of the Tron Program: 

The contest rules limit games to 10 lines of 80 characters in the smallest footprint category (very similar to BASIC contests in the 80's) so the concatenator operator is used alot to fill up the space on the lines which can make the program more difficult to read and understand.

Here's what it would look like if we broke the program up to one statement per line: 

0 rem --- Tron for the Atari VCS, Initialization section:
1 if g<>0 then goto 20
2 for x=18 to 239
3 virtualworld(x)=0
4 next x
5 for x=0 to 9
6 g=g+10
7 rowcolors(x)=g
8 next x
9 x=10
10 y=5
11 h=1: rem initial dir right
12 rem --- End Initialization section, g is no longer 0 so line 1 will always skip init
19 rem ---- game start
20 f=f+1: rem f is a delay variable, game logic runs every 4 frames:
21 if f>3 then goto 24:rem used a goto to allow vertical structure:
22 scrollvirtualworldtoggle=0
23 return
24 scrollvirtualworldtoggle=1
30 if joy0left<>1 then goto 40: rem used a goto to allow vertical structure:
31 e=1: rem e,h,i,j are direction variables (light cycle is always moving)
32 h=0:rem if one is set, the other three are turned off (one direction at a time)
33 i=0
34 j=0
35 AUDC0=8
36 AUDF0=BITIndex
37 SUSTAINFORFRAMES=15
40 if joy0right<> 1 then goto 50: rem used a goto to allow vertical structure:
41 h=1
42 e=0
43 i=0
44 j=0
45 AUDC0=6
46 AUDF0=BITIndex
47 SUSTAINFORFRAMES=15
50 if joy0down<>1 then goto 60: rem used a goto to allow vertical structure:
51 i=12
52 e=0
53 h=0
54 j=0
55 AUDF0=y*3
56 AUDC0=15
57 SUSTAINFORFRAMES=15
60 if joy0up<>1 then goto 70: rem used a goto to allow vertical structure:
61 j=12
62 i=0
63 e=0
64 h=0
65 AUDC0=3
66 AUDF0=y*2
67 SUSTAINFORFRAMES=15
70 x=x-e
71 x=x+h
72 l=i/12
73 y=y+l
74 l=j/12
75 y=y-l
76 BYTErowoffset=BYTErowoffset+i
77 rem TRON!!
80 BITIndex=BITIndex-e
81 BITIndex=BITIndex+h
82 BYTErowoffset=BYTErowoffset-j
83 f=0
88 rem set pixel on virtualworld bitmap, and poll prior state for collision:
90 if vwpixel(x,y,on)=0 then return
91 COLUBK=100
92 SUSTAINFORFRAMES=100
93 goto 60
100 rem Atari VCS

 
Leveraging horizontal logic structures in classic BASIC:

Note that modern languages including BASIC derivatives include an end if block terminator, without which goto's are required to jump over the blocks as illustrated in the listing above. They are absent in the short listing (except one for the short circuit) because the horizontal structure provides a block terminator via the carriage return or line feed. 
