A 10-line TurboBASIC XL program for the Atari 8-bit computer
Written for 2014 NOMAM programming competition

Bill Kendrick, March 27, 2014

An entry for the NOMAM 2014 10-line TurboBASIC XL game competition.


This game is based on "Isolation" for the Commodore 64, written by John Dearden and published in Compute!'s Gazette for Commodore 64/128 Users, Issue 83, Vol. 8, No. 5 (May 1990). I originally ported it to Atari BASIC the same year (as a teenager!), and you can find that version within my Atari Relics: "Isolation". This version is a rewrite from scratch.

The game is played with 2-4 players on a 7x5 grid of cells. Each player attempts to trap their opponents by destroying cells on the board, and move around to avoid being trapped themselves.


This version of the game is played with 2-4 players and one joystick. When the game begins, you will be prompted for the number of players ("PLAYERS?"); press the [2], [3] or [4] key on the keyboard.

Each player takes turns playing. Each turn has two steps: moving to an adjacent cell (you are prompted, e.g., "P1 MOVE"), and destroying an adjacent cell ("P1 FIRE"). During each step, push the joystick in any direction (including diagonal) and press the [Fire] button to move or fire.

Note: In the original C=64 version, the theme of the game was that of a boat battle. The boats could not fire directly at each other due to the danger of explosion; instead, you could fire at any unoccupied cell on the board. My version is simplified in that you may only fire at an unoccupied cell adjacent to your ship.

Dark-colored cells may be occupied by a player, or destroyed during the firing phase. Four light-colored cells near the center may be occupied by a player, but may not be destroyed (they are indestructible). Each player starts on one of these cells. Black cells have been destroyed, and may not be occupied or fired upon. Players' positions on the board are denoted as numbers within a dark- or light-colored cell.

If you are unable to fire (because none of the adjacent cells are unoccupied (no other player) and destructible (dark-colored)), the firing step will be skipped ("P1 SKIP" is shown).

If you are unable to move (because all 8 adjacent cells have been destroyed), your game is over ("P1 OVER" is shown), and your player is removed from the board.

If you are temporarily unable to move (because all non-destroyed adjacent cells are occupied by other players), your entire turn is skipped ("P1 SKIP" is shown).


The game ends when only one player can make any valid moves. At this point, the game will get stuck in a loop, stating that all of the other player's games are over, and asking the one remaining player to make a move.


Unlike my previous NOMAM entries, this game was written in a text editor under Linux, and processed through linux2tbasicxl, a simple tool I wrote that converts plain ASCII (include sequences for escape and control characters) into ATASCII that can be ENTER-ed into Atari BASIC or TurboBASIC XL.

This allowed me to "cheat" (like some other NOMAM entries) by producing code that, even when all BASIC keyword abbreviations are used and all whitespace removed, are longer than the 120 characters (3 physical lines, 1 logical line) that the Atari's editor device ("E:") would normally allow. Code ENTER-ed can apparently be up to 256 characters long.

For testing, I used the Atari800 emulator, a Stelladaptor and a real Atari CX-40 joystick.

Line-by-line Breakdown of the Source Code


10 GRAPHICS 17:DIM A$(2),SZ(4),A(4):CH=(PEEK(106)-16)*256:MOVE 57344,CH,1024:POKE 756,CH/256:SC=DPEEK(88):DPOKE 708,210:SZ(0)=SC+106:SZ(1)=SC+232:SZ(2)=SC+112:SZ(3)=SC+226 20 MOVE ADR(".................."),CH+208,16:MOVE ADR("................................................................"),CH+8,64 30 MOVE ADR("................................................................"),CH+72,64:POKE 712,192:DPOKE 710,23567


40 OPEN #1,4,0,"K:":? #6;"PLAYERS?":REPEAT :GET #1,K:K=K-49:UNTIL K>0 AND K<4:? #6;".":FOR P=0 TO K:A(P)=1:NEXT P:K1=1000:K2=2000:K3=3000

Draw Game Board

50 FOR Y=1 TO 5:A$=":;":IF Y MOD 2:A$=":;":ENDIF :? #6:FOR I=1 TO 2:? #6;":; :; ";A$;" :; ";A$;" :; :;";:NEXT I:NEXT Y:? #6:GOSUB K2

Main Loop

100 FOR P=0 TO K:SZ=SZ(P):POSITION 0,23:? #6;"P";P+1;" ";:N=63:GOSUB K3:IF AZ=0:A(P)=0:? #6;"OVER":PAUSE 60:ELSE :IF AC=0:? #6;"SKIP":PAUSE 60:ELSE :? #6;"MOVE":GOSUB K1:C=PEEK(SZ)&192:C3=(26!C)*257 110 DPOKE SZ,C3:DPOKE SZ+20,C3:SZ(P)=S2:N=191:GOSUB K2:POSITION 3,23:GOSUB K3:IF AC=0:? #6;"SKIP":PAUSE 60:ELSE :? #6;"FIRE":GOSUB K1:DPOKE S2,0:DPOKE S2+20,0:ENDIF :ENDIF :ENDIF :NEXT P:GOTO 100


Get directional input

1000 REPEAT :REPEAT :S=STICK(0):UNTIL STRIG(0)=0:S2=SZ(P)+((S&8=0)-(S&4=0))*3+((S&2=0)-(S&1=0))*60:UNTIL PEEK(S2)&N=26:REPEAT :UNTIL STRIG(0):RETURN

Draw players

2000 FOR R=0 TO K:IF A(R):SZ=SZ(R):Q=1+R*4:C=PEEK(SZ)&192:POKE SZ,Q!C:POKE SZ+1,(Q+1)!C:POKE SZ+20,(Q+2)!C:POKE SZ+21,(Q+3)!C:ENDIF :NEXT R:RETURN

Check state of cells surrounding a player

3000 AZ=0:AC=0:XX=(SZ(P)-SC) MOD 20:FOR Y=-1 TO 1:FOR X=-1+(XX=0) TO 1-(XX=18):IF X OR Y:W=PEEK(SZ(P)+Y*60+X*3)&N:AZ=AZ+W:AC=AC+(W=26):ENDIF :NEXT X:NEXT Y:RETURN FIXME


Bill Kendrick, 2014,, New Breed Software
Other games I wrote for NOMAM 2014