Sparse Invaders Source - simondotm/stardot-wiki GitHub Wiki

Sparse Invaders : v1.0 Source Breakdown

Introduction

Having never developed for the Beeb, I thought it was about time. Within a matter of minutes I had a document containing the 6502 instruction set, SWIFT installed with P65 and I was watching the videos supplied by Steve. Thus 'Sparse Invaders' was born.

To develop a game or application on the Beeb, the following knowledge is needed:

  1. The idea - as in the game or app you want to develop!

  2. Patience!

All else can be learnt, by reading and also asking questions. That's what I did, as I'm sure a lot on the forum will agree! Please do not be put off by the fact that it's 6502 assembler.

From my experience the only other assembler as easy as the 6502 is the 8080 (this is from memory as I last did that in 1984). It has a limited register and instruction set, simple to pick up - however it does enable you to do some pretty wonderful stuff on the BBC B. I only need one example, Elite!

Tools for this development -

SWIFT is perfect for starting your first project. It contains project management, text editor for the source, graphic editor for the sprites and with a simple click on an icon - it will build your app and create the disk THEN launch the BBC B emulator so you can see it playing.

How EASY is that!!

Going back to Sparse Invaders, I picked Space Invaders as my game of choice, as to be honest it's a simple game to write, but not that simple as to not supply a little challenge while writing it.

Final thought, when developing, as long as you understand what you need to code, it's fun. If you have any confusion then take time out to contemplate the problem and discuss the issue.

Programming on the BBC should be fun!!

Summary of the v1.0 source

Sparse Invaders is not optimised. That said, I used techniques in drawing the invaders that allows the game to run very smoothly. However the source code has been left as is, to enable better understanding of what is going on.

I have provided the complete source below giving a brief summary of what is actually happening in each of the files and tried to explain the techniques used and the reasons why.

Please note that this online source breakdown is useful reading, however viewing the source in SWIFT adds colour and correct tabbing etc making it far more pleasing to the eye! :-)

Any questions please ask away on the forum.

Sparse Invaders Source Files

The v1.0 Source Zip

At last the v1.0 source is here! Once you have SWIFT setup, just open the Sparse Invaders project and ENJOY!

  • THE v1.0 SOURCE * \/ \/ \/ \/ \/

[Sparse Invaders v1.0 Source](./images/SparseInvaders Source.zip "wikilink")

  • THE v1.0 SOURCE * /\ /\ /\ /\ /\

v1.0 Source Description

Source

Description

Main.txt

Starting point, main setup and control loop for game

BlockDrawer.txt

Basic Block drawer

Keyboard.txt

Keyboard handler

Screen.txt

Screen drawing functionality

Sound.txt

Sound initialization and generation

Timer.txt

Timer interrupt

SpriteController.txt

Sprite Controller (Over complex)

Invaders_Baddies.txt

Setup,draw and control for invaders and mother ship

Invaders_Bases.txt

Setup, draw and control for the three bases

Invaders_Bullets.txt

Bullet control.

Invaders_Hiscore.txt

Hiscore calculations and display

Invaders_Player.txt

Player control

Constants.txt

Constants used throughout the game

Macros.txt

Macros used throughout the game

Blocks.bin

Block sprite collection

Boot.bin

Boot txt file - loads main and then runs reloc

LookUpTable640.bin

640 lookup table used for screen navagation.

SpriteTest.bin

Main sprites (not really test)

Relocate.txt

Small code, loaded into 0x880 to relocate invaders down to 0x900

Beeb-Invaders.swfpj

Swift 4.2.2 (onwards) project file.

BeebDisk1.ssd

Build disk image

'''LICENSE '''

GPLv3 - Please read.

The Shell (stripped bare project for starting that new game)

UPDATE: THE SHELL

[Shell Source v1.0 Source](./images/Shell Source.zip "wikilink")

This is the invaders source stripped leaving a basic shell. It does show text display, sprite creation and moving in a good documented effort. Please download and use the shell to create your game, using Sparse Invader source as a working example.

⚠️ **GitHub.com Fallback** ⚠️