Father Christmas' Crackers

By Chris Dewhurst

Originally published in EUG #61

It's Christmas Eve, and Father Christmas is setting out to deliver the presents - when he discovers that the mischevious gnomes have rigged the crackers with explosives! Can you defuse them all before they really go 'bang'?

Move around the screen using the A, S, P and L keys. Pressing SHIFT in conjunction with the A or S key will move the row of blocks Father Christmas is on left or right, except when a cracker is also on the same row. If you fail to defuse the cracker before its timer runs out, you will lose a life. The game ends when you have lost all of your lives.

You will also die if you run into the deadly holly, or collide with mutant stockings which roam the screen on later levels. But drink a glass of brandy for bonus points. Upon defusing six crackers, you proceed to the next level via a bonus screen. Wait until Father Christmas is aligned with the brandy at the bottom and press the Space Bar.

Have fun and Happy Christmas!

Technical Info

The game is in two parts. "G.CRACKER" assembles the machine code and "G.CRACK2" runs the game from BASIC.

"G.CRACKER"
Machine Code Subroutines
calcCalculates screen address given the text co-ordinates in X and Y
checkEach time Father Christmas moves, the notes for each crotchet beat are played. The 'beats' table counts up the number of quavers sounded on each channel. Another note on the current channel will be played only if the value in 'beats' is 1 or 2. 0 means the previous note was a rest or minim, and a value 3 means that two quavers have been played
crackerPrints cracker sprite at 'scr'+&280
getposGets the right position in 'M%', the map, given the co-ordinates in X and Y. Because the playing grid is 14x14 squares big, Y is multiplied by 14 by successively adding 14, Y number of times, and added to X. This is then used as an index into 'M%'
incscrAdds &280 (one character line) to 'scr'
mrlMoves row number Y left by one position
mrrMoves row number Y right by one position
playPlays a note of the carol, the data for which is poked in from the DATA statements in lines 1660-1840. Note how notes above a certain pitch are played on channel 2, and notes below this pitch are sounded on channel 1. This saves having to store the channel number for each note
rmapReads from the map given the co-ordinates in X and Y. Result in A
rowPrints row of bricks, holly etc. CALLed with row number in Y
spacePrints blank space starting at 'scr' by writing zero bytes to screen
spritePrints sprite at 'scr'. Entered with sprite number in A
sptabTable of addresses of sprites
wmapWrites item A to 'M%'
 
Variables
fromUsed to store the address of the data for a sprite
ptrTune pointer
scrCurrent address on the mode 1 screen
xpos,yposTemporary storage for X and Y co-ordinates
 
"G.CRACK2"
Procedures
bonusPlays bonus screen
crckSearches for suitable place on playing grid to place next cracker
ctimeDecrements and displays cracker timer above a cracker
delCreates a short delay
dhstDisplays high-score table
eraseErases Father Christmas at his co-ordinates
expl(X%,Y%)Explosion animation at (X%,Y%), either at the current cracker position when the timer runs out, or at Father Christmas's position when he runs into some holly or a mutant stocking
ints, intss, intsIntroduces or removes mutant stockings
levl(A%)Adds or subtracts 'A%' to the level number and prints it on the panel
liv(A%)Subtracts or adds 'A%' to the number of lives left and displays them as a number of Father Christmases on the panel
locfcLocates safe place on grid for Father Christmas
mc(Z%)Calls machine code subroutine number Z%
movstMoves mutant stockings
readyPrints "READY!" message and waits a short while
santa, sant2Prints Father Christmas at his co-ordinates
screenCreates the playing grid, prints holly, brandy and cracker in random places
searchSearches the high-score table to see if the last score is equal to or greater than any champion scores
shft(A%), sl, srShifts current row on grid left or right and calls relevant machine code routine
showReveals the playing grid
snow(A$,X$,Y%)Prints fancy 'snow-covered' letters by PRINTing text as normal but then overprinting at the graphics cursor using a graphics character with GCOL 2
titleDraws the title screen
winDraws a green border
win2Clears the text area inside the green border. Note how this procedure can be called by itself to clear an area of the screen without drawing the border
 
Variables
C%Number of crackers remaining on current level
bc%Time remaining on current cracker
bx%(),by%()Co-ordinates of cracker
dx%(),dy%()Selection box of directions for stockings to move in
ex$()Graphics character strings of explosion frames
fs%()Direction in which stockings are facing
hs%(),hs$()Scores and names of people in high-score table
K%Level number
ns%Number of stockings active on current level
xm%,ym%Co-ordinates of Father Christmas
xs%(),ys%()Co-ordinates of stockings
V%Number of lives left