Chickens on the Freeway

Copyright © 2022 by Víctor Parada

Chickens on the Freeway

This is a little game for the 2022 NOMAM's BASIC 10-liners Contest. This program fits in the PUR-120 category, and it was written using FastBasic 4.5.2 for the 8-bits ATARI XL/XE. Development started on 2022-03-16, and it took 1+2 days. The final version's date is 2020-03-18.

UPDATE: It obtained the 3rd place of 13 entries in the category.


Chickens must go to the other side of the freeway. Who will help more of them?


FREEWAY start This is a game for two players, so two joysticks are required.
There is a 10 lanes freeway in front of the chickens, and you must guide them to the other side as many times as you can in a little more than 2 minutes.
Press [START] to begin.
FREEWAY move Use the joystick to move a chicken.
The joystick in port 1 moves the chicken at the left, and the joystick in port 2 moves the one at the right.
You can move only forward o backward, not to the left or right.
FREEWAY hit If a car hits a chicken, it will go back a couple of lanes. Beware, another car could hit it again while recovering.
FREEWAY score When a chicken reaches the other side, you will score 1 point, and another chicken will appear at the bottom.
FREEWAY finishing When 2 minutes has been completed, the scores will flash, and only few seconds remain.
FREEWAY end The game is over when the freeway is freezed.
The player who scored the most is the winner.

Development of the game

Freeway is a game created by David Crane for the Atari 2600 VCS console, published in 1981 by Activision. It was ported to the A8 by Glurk and released two weeks ago, using enhanced graphics to get more colorful cars and detailed chickens.

2600 Freeway

David Crane's Freeway for the 2600

A8 Freeway

Glurk's Freeway for the A8

I thought that this game could be simplified to fit in a tenliner, so I build a quick proof of concept in FastBasic, but in some hours I got a working version of the first variation of the game, the one with only one car per lane.

Prototype 1

Freeway with 10 lanes PoC

Prototype 2

Adding the chickens.

The next day, I had to optimize the code to make it fit in 10 lines of 120 chars each, but during the code revision I found that it could be enhanced a bit to make it more challenging. I also fixed some sound effects and colors, and modified the double lines to be continuous just because I like them in that way, and that allowed me to reuse them for the shoulders. The timers were also adjusted in order to use the same amount of time than the original game, for both PAL and NTSC versions.

Prototype 3

Final prototype

In order to not be mistaken with the A8 port, I changed the name to "Chickens on the Freeway".

Download and try

Get the FREEWAY.ATR file and set it as drive 1 in a real Atari. Turn the computer on and the game should start after the loading completes. Two joysticks are required, one for each player.

The code

The abbreviated BASIC code is the following:

The full and expanded BASIC listing is:

Chickens on the Freeway
(c) 2022 Víctor Parada

45056 = $B000 = Charset -> PMBASE
46080 = $B400 = PM0 PMADR(0)
48480 = $BD60 = DList DPEEK(560)
48512 = $BD80 = Screen DPEEK(88)
graphics 8
Clears the top 8K of RAM
graphics 17
Sets 20x24 4-color text mode
move $E080,$B080,80
Builds a custom charset.
Copies digit bitmaps from ROM
move adr("{binary data}")+1,$B00E,10
Adds segmented and continuous lines
poke 756,$B0
Activates the new charset
move adr("{binary data}")+1,704,9
Sets the color palette (PAL)
mset $BDD0,20,65
move $BDD0,$BDF8,300
mset $BDA8,20,66
mset $BF38,20,66
mset $BE70,20,130
Builds the playfield (freeway)
poke $BD63,198
poke $BD67,134
move $BD67,$BD69,18
Adds interrupts to the display list
Just a constant to save some bytes in the listing
pmgraphics 1
Initializes P/M graphics mode with single scanline resolution
- P0: Left chicken
- P1: Right chicken
- P2: Stripe of cars
data p() byte = "{binary data}"
data q() byte = "{binary data}"
data r() = 0,-1,-2,-3,-4,-5,5,4,3,2,1
Freeway arrays
- P(): horizontal position of a car in the lane
- Q(): Color of each car
- R(): Speed of every car (negative ones go to the left)
Strings has a leading byte (blank bitmap, not used)
move adr("{binary data}")+1,a,26
Sets up car bitmaps in the highway
a=pmadr(2)+121 -> both left lines in the center of the freeway.
-move a-48,a-64,64
move a+16,a+32,64
Copies cars from the left lane to the 4 corresponding right lanes
dli set d = p wsync into $D002,
  q wsync into $D014,
  0 wsync wsync wsync wsync wsync wsync wsync wsync into $D014
Sets the DLI to position and color each car
dli d
Activates the DLI
dim s(2),t(2),n(2),o(2)
Players arrays
S(): height of the chicken
T(): timer while moving back after been hit, including a delay before getting the movement control
N(): Timer for the FX when a player reaches the top
O(): Score of the player
pmhpos 0,88
pmhpos 1,160
Initializes the horizontal position of both chickens
b=adr("{binary data}")+1
Chicken bitmaps, including extra white to remove previous height of the player.
Images are standard, walking and been hit
move b,$B4D7,10
move b,$B5D7,10
Displays the chickens at the bottom
  poke 708,42
Restores the score color
  until peek(53279)=6
Waits for START key
  poke 77,0
Disables ATRACT mode
  for i=0 to 1
Sets up the players
    mset j,256,0
Cleans the player area for the chickens
Sets the current height at the bottom
Resets timers and score
    position 4+10*i,0
    print #6,"0 "
    move b,j+z,10
  next i
Prints the corresponding zero score
  poke 20,0
  dpoke 18,0
Resets system timer
    if peek(19)>23 then poke 708,
Flashes the score for the last few seconds
Waits for VBLANK
    poke $D01E,0
Clears P/M collisions
    for i=1 to 10
Computes next position of each car
      p(i)=((p(i)+128+r(i)) mod 168)+40
    next i
Limits the position to the visible area of the playfield plus 8 bits of margin
Waits for another VBLANK to allow the screen to be completely drawn
    for i=0 to 1
For each player
      if peek($D00C+i) and t(i)<11
Hit by a car? Allows also while in the delay
Starts the push down animation
Checks the time counter
      if j
Is the animation going on?
        if j>11
Not in delay mode?
          sound i+2,9+(j mod 6),10,8
Move down 2 scanlines
          if s(i)>z then s(i)=z
Limited by the bottom/initial position
          move b+20*(j&1),
Displays first and third bitmaps for the animation, one at a time
        elif j=11
          sound i+2
No chirps when the delay starts
        dec t(i)
Updates the timer
Check if the player needs to be updated
Read the joystick
Calculates the step for the movement
        if k
          sound i,200+16*i,10,3
Step FX
Calculates the player's new position
          if j<43
Reached the top?
Starts celebration FX
            inc o(i)
Increases score
            position 4+10*i,0
            print #6,o(i)
Displays new score
            mset pmadr(i)+j,12,0
Removes player
Sets player at the start position
          elif j>z
Limits the moving down to the bottom/start position
          move b+10*(j&2>0),
Displays the player in the new position
Saves the new player position
          sound i
Shuts up the step FX
      if n(i)
        sound i+2,78+4*i,12,n(i)-1
        dec n(i)
    next i
Sound FX when a chicken arrives to the top
  until peek(19)>26
Game is over after a couple of minutes
$2000 = 2:15 -> 32 (NTSC)
$1B00 = 2:18 -> 27 (PAL)
Shuts up pending FX.
Returns to main loop:

Return to my 10-liners page.

© 2022 by Víctor Parada - 2022-03-18 (updated: 2022-03-09)