Electron User 1.12 ================== Haunted House ------------- Haunted House is a fast and challenging arcade-style game for the Electron and BBC Model B written by Peter Scott. If your nerves are reactions are up to it, you take the part of a man trapped in a haunted room being constantly harassed by spooks, spectres and - don't ask why! - aliens. To get out of the room the man must collect all the keys lying scattered around the screen. At the same time he has to get rid of all the nasties by shooting them with a laser. He can then escape by running to the door at the top left of the screen. On the way he can gather various objects left around the room - and collect bonus points - but avoid the ghosts and cans. You have a slight disadvantage in that the little man can only fire if you are facing sideways and, no matter what you do, the man keeps on moving. The reward for all this is that you move onto a harder room with more obstacles, more treasure and up to twelve aliens. The game features a high score table, sound on and off functions, a pause facility and, if you reach the fifth room, a bonus life so that you can face more of the dead. It's weird and it's wonderful. Dare you play HAUNTED HOUSE? Speed-Up Hints Use integer variables Use increments of one for line numbers Avoid lots of IF...THEN comparisons Use as few spaces as possible Avoid the use of VDU5 wherever necessary Use VDU codes instead of COLOUR, GCOL and PRINT TAB commands wherever feasible Use GOTO and GOSUB variables instead of IF ... THENs Place subroutines at the beginning of the program to avoid searching through lines Variables x%, y% Horizontal and vertical position of the man man$(4,2) Various shapes of men for each direction d% Direction of movement, selected for man$() man% The particular position of the man's feet key%(139) ASCII values for the key pressed containing subroutine location screen%(159) ASCII values of characters read on the screen, containing line numbers dx%(3), dy%(3) If x% and y% are decremented, value held in this dx%, dy% Values for incrementing or decrementing x% and y% sc% Score li% Number of lives you have left lev% The current level you are on bo% Amount of bonus you have left inc% Increment bonus is reduced by doory% Vertical position of exit door mekey% Number of keys you have collected hit% Number of aliens you have hit need% Number of aliens on the screen for this level scr1%, scr2% C of character read on the screen hi%(10) Hiscores hi$(10) Names of highest scorers loop% General loop variable   Variables for Machine Code xp% Located at &70-&7F, the x positions of the aliens yp% Located at &80-&8F, the y positions of the aliens di% Located at &90-&9F, the direction number of the alien dead% Located at &A0-&AF, is the indexed alien dead or not scr% Screen code located at &B0 rnd% Random number for use in changing directions, located at &B1 number% Number of aliens on the screen, located at &B2 xc% The X register is stored in here when testing the screen, held in &B3 mhit% If you are hit, it holds a 1 else it holds a 0; located in &B4 OS Operating System call &FFEE code_space Space needed for machine code p% Program counter, set to code_space to provide space for m/c   Procedures PROCinit Initialise user-defined graphics, the main variables and arrays PROCassemble Assemble machine code for moving the aliens PROCinstruct Print the instructions in Mode 4, play a tune and continue PROCdrawscreen Draw the screen, reset variables and start the game PROCnewscreen Move onto the next screen - check for bonus life PROCstartgame Clear keyboard buffer and check the keybaord for starting game PROCman Move the man, check for collisions, etc PROCgame Play the game, call the m/c, decrement the bonus and check status PROCdead You have hit an obstacle or an alien - lose a life PROCtimeup Your bonus has ran out - lose a life PROCfire Fire your laser if you are facing sideways, check for hits PROCleftfire Draw the laser if you are facing left PROCrightfire Draw the laser if your are facing right PROChit You've hit an alien - increment score and kill it suitably PROCalldead All your lives have run out PROCaliens Place the aliens on the screen PROCobjects A general procedure to place objects on the screen PROCw Wait for a while PROCscore Print the score in the form '00750' PROClives Print the number of lives on the screen PROClevel Print the level in the form '01' PROCtune Play a tune on a defined channel for a defined duration PROCinputname Input your name for the high score table in a certain place PROCswap Swap variables for the high score tableMATHS TEST Try to beat the clock in this mental arithmetic program by Alan McLachlan It seems the Electron is never satisfied. After all, it is the one that's supposed to have the mathematical brain - but in MATHS TEST, it asks you all the questions. Still, it is fun trying to guess - I mean calculate - the answer before you run out of time. And you can make the test as easy as you like. Variables A, B Random number for maths C Result of maths D Your answer ENDTIME Time up HI Highscore DF Delay factor to make 1 sec. SF Length of time factor is on screen R Right answer W Wrong answer T% Time variable time% A flag - TRUE if out of time SPEED Speed rate of input NUMBER Maximum range of input BONUS Bonus based on NUMBER final$ Number input in string form TIMENOW Temporary storage for actual time while setting TIME to 0   Procedures PROCinst Instructions PROCspeed Sets time question on screen PROCnumbers Sets highest number in your range PROCmenu Menu of mathematical operations PROCadd Addition PROCsub Subtraction PROCtimes Multiplication PROCscore Prints scoreboard PROCans Tests right or wrong PROCdelay (sec%) Variable delay PROCsoundright Sound for right answer PROCsoundwrong Sound for wrong answer PROCsoundnoans Sounds for no answer (out of time) FNget_number (DL%,TL%) Checks that the only inputs are numbers and waits for (DL%, TL%) secsSPLASH SPLASH by Rog Frost is a two-player game of mathematical strategy that will entertain and intrigue both adults and children. The idea is that a little man moves across a promenade towards the sea. He can only take a certain number of steps - chosen by the Electron - before he falls into the water. Each time it is your turn, you must choose how many steps he takes by selecting a number from nought to nine. Players take turns to pick a number and once that number has been chosen, it can't be used again. Meanwhile, the little man gets nearer and nearer the edge. The idea is to force your opponent to pick a number that will make him fall into the sea. As you can imagine, it's all good, clean fun. The target figure, running total and the numbers available are all displayed on screen, allowing the players to concentrate on strategy. The controls are simple. You just type in the number that you want and press RETURN. The rest is up to you. Don't get wet! Variables PROCinit Sets up the variables, text and graphics windows, and draws the starting screen PROCtext Sorts out whose go it is and receives a valid input number PROCgraphics Updates the position of the man and keeps a record of the running total PROCsplash Makes the man fall in the water if the target number is exceeded. It informs the loser and invites you to play again