A downloadable game

SPACE INVADERS

This is Space Invaders for the Amstrad CPC!

Keyboard left and right arrows are used to move the laser and SPACE to fire.

The goal is to defeat wave after wave of descending aliens to earn as many points as possible.


TECHNICAL PART

The game works on all Amstrad CPC (using only BASIC 1.0)

1) Control Characters

The game use a lot of Control characters to replace MODE, PAPER, BORDER, INK, SYMBOL in only one PRINT in the first line :

MODE is CHR$(4)+"1" FOR MODE 1

PAPER is CHR$(14)+"0" FOR PAPER 0

BORDER is CHR$(29)+CHR$(64+0)+CHR$(64+0) for BORDER 0,0

INK is CHR$(18)+CHR$(64+v)+CHR$(64+v) for INK v,v

SYMBOL is CHR$(25)+CHR$(i)+CHR$(a)+CHR$(b)+CHR$(c)+CHR$(d)+CHR$(e)+CHR$(f)+CHR$(g)+CHR$(h) for SYMBOL i,a,b,c,d,e,f,g,h

CHR$(12) is also used to clear the screen

CHR$(8),CHR$(9),CHR$(10),CHR$(11) are used to move cursor one character to the left, right, bottom and top for example to draw the green bunkers.

2) POKE &B28B,79

This POKE is used to work around a PRINT bug on CPC 464 when using control characters in strings.

Indeed, the size of text is not calculated correctly and the text is wrapped even if it fits in window.

This POKE is used to simulate a 80 columns windows in MODE 1 to avoid this wrap.

On other machine this POKE has no visible or harmful effects.

3) PEEK from screen memory

Instead of using COPYCHR$() which don't exists on CPC 464 I used PEEK from screen memory.

The second line of the screen (&C800-&C7FF) was used because the 4 first pixels was different for all 3 aliens and shots so only one PEEK is needed to know what is hit.

Values depend of PEN used :

PEN 1

48 is Alien 1

32 is Alien 2

112 is Alien 3

16 is Player shot

96 is Alien shot

PEN 2

15 is Bunker

PEN 3

17 is first part of Mystery alien

255 is second part of Mystery alien

4) Listing description

Line 1: Graphics initialization in one PRINT / Variables initializations for graphics tiles / Go in line 10 to finish initializations

Line 2: Work around POKE / Printing score, bunkers / Printing lifes / Drawing vertical line / Aliens wave array initializations / Variables initialization

Line 3: Player moves / Current alien moves / Checking bottom reached / Next alien / Player display

Line 4: Waiting vertical blank / Mystery alien / 4 musical notes

Line 5: Alien shot

Line 6: Player shot

Line 7: Alien hit checks

Line 8: End of wave checks / Mystery hit checks

Line 9: Player explosion / Life update and game over checks / DATA for tiles's strings and 4 musical notes

Line 10 : Game Over / Variable initialization / Sound initialization / Alien moves precalculation / Go to first wave

5) Variables

z$       : CHR$(0)

w$       : Triple CHR$(0)

a$()     : Aliens tiles

b$       : Bunker tile

s$       : Laser tile

m$       : Mystery alien tile

p        : Score

i        : Current alien index

x,y      : Horizontal / Vertical loops

x(),y()  : Aliens position

s$()     : Aliens tiles

o        : Offset for starting line of aliens (to increase difficulty of aliens waves)

n        : Aliens remainging

j        : Current alien move index

u        : Player move offset

q        : Mystery horizontal position or 0 if not active

r        : Mystery move offset (1 / -1)

m$()     : Mystery alien tiles (0 when moving to the left 2 when moving to the right)

e,f      : Alien shot position (e=0 if no shot)

b        : Alien shot screen memory address for quick tests

z,y      : Player shot position (z=0 if no shot)

a        : Player shot screen memory address for quick tests

s        : Byte read at player shot video screen memory address

c        : Alien type (or 0 if no aliens or mystery)

m,k      : Used to iterate over aliens

StatusReleased
Rating
Rated 5.0 out of 5 stars
(2 total ratings)
AuthorBASIC 10Liner
GenreAction
Tags8-Bit, Amstrad CPC, basic, basic10liner, schneider-cpc

Download

Download
invaders.dsk 190 kB
Download
invaders.txt 4 kB
Download
invaders_full.bas 5 kB

Install instructions

HOW TO RUN IN THE WINAPE 2.0 BETA 2 EMULATOR

1) With the dsk

File / Drive A: / Insert Disk Image... or CTRL+F1

Choose the invaders.dsk file

then just type :

RUN"INVADERS

2) With the invaders_full.bas file :

Select all the text in an editor and Copy in the clipboard with CTRL+C

In the WinAPE emulator use File / Paste or CTRL+F11

You can also use Settings / High Speed (1000%) or Shift+F4 to speed up copy (restore normal speed with Settings / Normal Speed (100%) or Shift+F3)

After the Paste :

RUN 100

then

RUN

Comments

Log in with itch.io to leave a comment.

Awesome port game !

Very impressive Space Invaders on 10 lines code!