EUG PD


Licking Whoopsy

 
Published in EUG #56

I read the recent review of Whoopsy and wonder if it is possible to get the game to work from disk on a system where PAGE is higher than &E00. I have the tape game but I prefer not to wait around if possible. The files all transfer to disk - but the game hangs after the opening screen on both the BBC Model B's DFS (PAGE at &1100) and the Electron's ADFS (PAGE at &1D00). On the Master 128 it's fine but I would rather have a version compatible with all machines if possible. Any advice?

Kevin Etheridge

Problems like this are depressingly all too common because professional programmers try to make their games as polished as possible by cramming code into every last orifice of the machine. When loading from tape, the respective machine normally has more memory to spare. When loading from disk, the Disk Operating System usually uses some of that memory for its operation. So if you have the disk loading a game which is writing to the area of memory the ADFS or DFS has reserved, you get an almighty crash and the machine locks up. The bad news is that this is a problem you can only fully get around with gadgets like the Advanced Plus 4 chip (or by buying a Master).

The good news is that Whoopsy is one of the few games that can be made to work on any machine with the addition of a 'downloader' program to the code. Many of the demos and more professional programs that make it onto each EUG magazine incorporate such 'downloaders'. The problem file is loaded into a higher PAGE of memory (possibly even screen memory which is why you get 'rubbish' all over the screen) and isn't executed until the (A)DFS has been disabled and the code 'relocated' to its 'proper' PAGE. Then the execution address is called and the program works correctly. If you are new to BBC programming, you will probably need to study the Memory Map in the appropriate User Guide in conjunction with the following explanation.

With Whoopsy, you need to make alterations to two of the loader programs. LOAD"WHOOPSY" (the first loader with the sprites), LIST then type:

      >DELETE 1,4 (the lines putting PAGE at &E00)

It's best to add another line too so that the loader screen doesn't only appear for a second before it is blanked as soon as the next file is loaded.

      >215COL.7:P.'SPC(4)"PRESS SPACE";:OSCLI("FX 21"):REPEATUNTILGET=32

Now SAVE"WHOOPSY". If you decide to RUN the game at this point, it will still 'lock up'. This is because, after you press SPACE, "WHOOPS2" is CHAINed and it *RUNs "FULGAME" which causes the error. So LOAD"WHOOPS2" and LIST.

In order to stop the screen filling with rubbish, it's necessary to get out of MODE2, which WHOOPSY has changed the Mode to. So add the line:

      >5MODE6:VDU23;8202;0;0;0;

Now alter line 10 to:

      >10choice=&8C:?choice=1

and

      >DELETE 20,30

The statements in these two lines are important but they cause problems with the 'downloader' and need to be put elsewhere. Now change line 80:

      >80COLOUR0

If you choose to omit this, you will see the downloader code on screen. However, make sure to delete the old line 80 in such case.

Now the code itself. It is put into two of the function keys (the first calling the second) and the final command of the program executes function key 0 to *LOAD the problem file into memory:

      >90*KEY 0 "*L. FULGAME 2000|M*T.|MFORI%=0TO&21FFSTEP4:I%!E00=I%!&2
      000:NEXTI%|M*FX138,0,129|M"
      >100*KEY 1 "MODE2:VDU23;8202;0;0;0;:?&224=&A6:?&87=&B7:?&88=&97:?&
      89=&9E:?&8A=&BD:?&8B=&9D:CALL&1899|M"
      >110*FX138,0,128

The extra commands deleted from the old lines 20 and 30 are stuck back in here and, after carefully checking you have entered all of the code above correctly, SAVE"WHOOPS2" will complete the 'compatibilisation'. The new version of Whoopsy can then be loaded from the disk with:

      >PAGE=&1D00
      >CH."WHOOPSY"

Incidentally, most games will require simply the code contained in line 90 (replacing the last *FX command with the execution address of the program). Programming a function key with:

      "*L. problem 'above1D00'|MFORI%=0TO'&length'STEP4:I%!'&start'=I%!
      'above1D00':NEXTI%:CALL'&execute'|M"

and substituting the 'above1D00' with, say, 2000, and the other hexadecimal values (&xxxx) with those of the problem file (which you can discover with the *EX (RETURN command) will work on a fair number of games. It is easy to mix up the addresses - so if things don't work first time, check them first before deciding the game cannot be 'downloaded'. As an experiment, try Danger UXB, Galactic Commander, Kayleth and Stock Car. With the right addresses inserted, all should work! You can also check out the version of Woodbury End supplied with this EUG which was also made possible with a 'downloader'.

Dave E, EUG #56

Kevin Etheridge