![](/squares_tiny/publisher/0/0/0/1/0/5/3/1/micro_mart.jpg)
Micro Mart
![](/themeForest/images/clock.png)
Published in Micro Mart #897
Continuing from last week, Jonathan Cauldwell explains the weird and wonderful world of the bedroom programmer
Retro Mart: Return Of The Bedroom Programmer Part 2
Step by step the blocks are constructed, beginning with a sprite routine and a simple control loop to manipulate the character around the screen. This first control loop rarely takes long to write, but it is one of the most important periods in any game's development: if the character moves smoothly and convincingly around the screen the game will start to develop a feel of its own. If a game doesn't feel right it simply won't be fun to play, so
it is important to get this right. Subtle changes to the way a character moves can make a lot of difference to the way a game feels. When the player sprite is moving around properly other bits of the engine are added. Enemy sprites also need to be smooth, although fewer animation frames are needed than for the main player.
The Spectrum doesn't have any support chips to handle graphics processing so this has to be done by the main processor. Any program code to manipulate sprites or scroll the screen has to be as fast as possible, so tricks are employed to speed up such tasks. For example, a sprite routine works by moving a line of pixels to the screen one at a time, moving to the next line down, counting how many lines it has drawn, then jumping back to the beginning of the loop until all lines are complete. Instead of programming a routine which loops round sixteen times it is faster to have the contents of that loop written out in full sixteen times, as keeping count of how many lines have been drawn and jumping back to the start of a loop take up valuable processor time.
Scrolling routines are another area where trickery may be employed to improve speed. It makes little sense in wasting precious time scrolling empty patches of the screen, so a programmer can cheat by only scrolling certain areas of the display at different times.
Level design is a chore, so levels are created one at a time over the course of a game's development. As these accumulate, they inspire new ideas for extra features for which graphics are drawn and code is written along the way. New hazards need to be introduced to later levels to stop a game becoming boring and repetitive, and when these have been added the engine itself is pretty much complete and attention can then be focussed on audio effects.
Beeps And Tones
The Spectrum has two methods of generating sounds. The simplest method involves toggling the machine's internal speaker, or beeper. Every time the speaker is toggled, it produces a click, and by repeating these clicks regularly a variety of weird and wonderful noises can be generated. The more often the speaker is toggled, the higher the frequency of noise, and to produce a note at a particular pitch the beeper timings have to be fairly accurate.
This usually means that all of the processor time needs to be dedicated to the task, so any other processing stops while the speaker is being driven. Another option is to use the three-channel AY38912 sound chip - pretty much the only help a distraught Spectrum programmer has. This can be instructed to get on with the task of playing music or sound effects while the processor gets on with other duties.
Lastly, scoring routines, Game Over messages, and front-end menus are written. If there is any memory remaining, novel high-score name entry routines or end game sequences are considered. Even when every byte is used, there is still room for extras. Most games make use of extensive buffers which are initialised once the game starts, so instead of filling them with blank spaces they become hiding places for intro sequences, hidden mini-games and secret messages.
In summary, a great deal of effort goes into the process, so why do I bother writing Spectrum games today? Perhaps eight-bit developers do need a healthy dose of insanity to keep going, but if that makes retro games more inventive then by all means bring on the men with white coats. Let's face it; originality in mainstream games suffers as the genius of Smith or Minter is diluted in enormous development teams. Fortunately, the bedroom programmer is free to unleash his unfettered lunacy upon the world, for better or worse.