Example 8
Rebound

 

 

Introduction

I have had on my harddisc for a long time a game called "rebound". I do not know exactly where it came from, but I suspect it was either on a cover disc or downloaded from a BBS. It dates from 1992, and judging by the style of programming, it was either originally written for a BBC micro, or it was written by a person brought up on the Beeb.

If you are the author, please get in contact with me so that I may properly credit you.

 

It seemed, to me, to be a perfect project for conversion to assembler for several reasons:

I won't detail the internal workings, as it is commented to distraction. :-)

 

 

Improvements

The following improvements have been made, over the BASIC original:

 

 

Comments

I'm sure it can be optimised, but I don't see a necessity for it as the program is really quite small - a mere 1680 bytes. If you do wish to optimise, here are some ideas:

 

 

The 1K challenge

The "rebound1K" version is a challenge. You see, often you get a 'challenge' in which to write something in 1K, or in 4K. Whether or not this is possible depends not only upon your coding skill, but also upon your optimisation skill. Cutting strings took out some space. Ripping out stuff like the high score name and the time delay (blah blah) took us closer. Then the above optimisations, only more extreme. And it got us down to exactly 1024 bytes.
A lot of the gloss and niceties have gone, but the game is just as playable (though the speed is now dependent upon the screen VSync rate).

Why 1K? Because it represents an amount of memory that was typical in early machines. Look in a computer book written in the late sixties. Mainframes did their work with tape drives and 4K of memory. It is a 'throwaway' amount these days, yet still a good challenge to code something useful, yet squeeze it into a mere 256 instructions (or less, if you have output to describe).

 

 

Last, but not least...

Many thanks to Stewart Brodie for the floating point routines. Calling FNfp() is so much easier than using the PRMs to try to figure out what the instruction should be...

 

 


Download example source: rbsrc.basic

Download example source: rbextsrc.basic (for use with ExtBASasm)

Download example source for 1024 byte version: rbsrc1k.basic


Return to assembler index
Copyright © 2004 Richard Murray