License Plates

Copyright © 2018-2019 by Víctor Parada

License Plates

This is a little game for the 2019 NOMAM's BASIC 10-liners Contest. This program fits in the "stock" PUR-80 category, and it was written using Atari BASIC for the 8-bits ATARI XL/XE. Development started on 2018-10-21, and it took 2+1 days. The final version's date is 2019-03-02.

UPDATE: It obtained the 27th place of 35 entries in the category.


Memorize the licence plates of the bank robbers and give them to the police. How many can you catch?


PLATES step1 You witness an assault on a bank, and fortunately they did not hurt you with the shooting.
PLATES step2 You could see the license plates on the car where the robbers escaped.
PLATES step3 The police will ask for information that will help them capture the robbers.
PLATES step4 If the information was correct, they will ask you the same about other relevant cars to solve the case, but having had less time to memorize.
PLATES step5 If the plate was not correct, you will be out of the case. The police will thank you anyway by telling you how many robbers you helped capture. Press RETURN to help in another assault.

Development of the game

The first computer games I wrote were done in a Sinclair ZX-81. I don't remember the year, but a friend of mine got one of those cheap computers and he lost his interest on it in a couple of weeks, so he lent me that little jewel with an 8K memory expansion and a cassette unit. I used it for some weeks during holidays and 3 games were written by me. I cannot recall the order, but they were: "LACER" (instead of "Laser", a shooting game which I ported to Atari as soon as I got access to one), "Carrera de Sapitos" ("Frog Race"), and "¿Le tomó la patente?" ("Did you see the license plate?"). Unfortunately, I've tried to find the compact cassette tapes I used in that ZX-81 machine and recover my games without success. Those tapes could be lost during a flood which happened a couple of years later. Or they might be overwritten with Atari stuff at school.

Thinking on a simple game for the PUR-80 category to be written in Atari BASIC, I remembered those games and decided to try the license plates one, which was a memory challenge game, with a cool animation with 3D perspective at the beginning.

I started to code with the game loop part, where a license plate is shown for a while and then it is requested. If you miss, the game is over, but if you match it, a new one is displayed, but for less time than before. The score is the number of successfully remembered plate numbers in a row.

When I programed this game in the 80's, the plates in Chile had 3 letters and 3 numbers, and now there are two formats: 2 letters and 4 numbers, or 4 leters and 2 numbers. But I wanted to change this for the contest, and I found that plates in Europe are longer, but the first chars only says the place of the residence, so I simplified it to only 5 chars for the individual codes: 2 letters and 3 numbers, or 3 letters and 2 numbers.

It wanted to use graphics mode 2 (ANTIC 7) because it has larger fonts and more colors, but in that mode is not possible to perform an INPUT statement without using a text box. As Atari BASIC would require too many statements to replace a single INPUT with a routine to read from K: device and print each typed char to screen, I tried other alternatives, which included tricking graphics mode 2 to believe it is in graphics mode 0, and modifying the display list of the text box to change from ANTIC 2 to ANTIC 7 every line. What I used at last was to change the whole graphics mode 0 to graphics mode 2, and adjust the POSITION to find the relative points in screen to print the messages.

As there was some available space after finishing that code, I thought on adding a simple animation like the original one in the ZX-81, but as that would take too much space, I decided to turn that into a smaller one... with sound!!! And that animation was done in the graphics mode 0 before modifying it to simulate mode 2.

Download and try

Get the PLATES.ATR file and set it as drive 1 in a real Atari (or emulator). Turn on the computer with BASIC enabled (without pressing OPTION key) and the game should start after loading.

The code

The abbreviated BASIC code is the following:

The full and expanded BASIC listing is:

graphics 0
setcolor 2,0,0
poke 752,1
Sets graphics mode 0 (ANTIC mode 2), turns text background color into black and turns off the cursor.
? "{binary string}";
Draws a bank, a car and a robber.
for x=0 to 4
  sound 1,99,10,14
  sound 1,16,8,8
  sound 1,0,0,0
  ? "{binary char}";
  for y=0 to 99+400*rnd(5)
  next y
next x
Performs the animation of the robber and some gun shot sounds.
? "{binary char}";
Positions the cursor in the car's line.
for x=0 to 33
  ? "{binary char}";
  sound 0,60,12,7-x/5
next x
Moves the car to the right by inserting spaces at the beining of the line.
? "{binary char}"
Clears the screen.
sound 0,0,0,0
Turns off the sound of the car.
Fixed memory address of the Display List of graphics mode 0 with BASIC cartridge/ROM enabled. Same as:
poke r+3,71
for x=0 to 11
  poke r+x+6,7
  poke r+28-x,0
next x
Modifies the display list and turns it into a graphics mode 2 like one (ANTIC mode 7). The advantage is that printing to channel #6 is not required and it is possible to INPUT in this wide character mode.
dim a$(5),b$(5),f$(6),m$(35)
Reserves space for some strings.
f$="{binary string}"
F$ has the patterns for the plates format.
m$="{binary string}"
M$ stores the "DID YOU SEE THE LICENSE PLATE" message to be used later.
N is the time limit counter, decreasing on each iteration.
I is the counter of hits. Starts with -1 because it will be increased in the loop.
? "{binary char}";
Clears the screen.
setcolor 2,0,0
Sets the plates text color to black (invisible).
for x=1 to 5
  poke 40047+x,y+144
next x
This loop creates a 5 caracters plate number. G selects a format (2 letters and 3 numbers, or 3 letters and 2 numbers), Z identifies the max number of the corresponding digit, Y is the actual digit value, which it is placed on screen (invisible) and stored in A$ string at the same time.
Selects a random color for the license number.
setcolor 2,c,10
Displays the plate number in the selected color (makes the license visible).
for x=0 to n*40
next x
Performs a pause.
setcolor 2,0,0
Hides the plate number by turning it black again (invisible).
position 5 ,2
? m$
Displays the plate request message.
position 27,3
? "{binary string}";
input #16,b$
Requests for a plate number and stores it in B$.
setcolor 2,c,10
Displays again the plate number to verify a miss or success.
K turns in 1 if there was a hit.
for x=0 to 99 step 3
  sound 0,30+(99-x)*k,12-2*k,8*(x<99)
next x
Performs a sound effect, based on hit or fail.
Sets the current iteration number.
Decreases the pause lenght counter, and 5 is the minimum value.
on k goto 5
If it was a hit, go to the next plate.
position 21,4
? i;" robbers caught";
Prints the score.
input #16,b$
Waits for a RETURN to play again.
Restarts the game.

Return to my 10-liners page.

© 2018-2019 by Víctor Parada - 2019-02-24 (updated: 2020-08-15)