The SHELL.S program is the building block of some of the games written
by Budgie UK. It needs Devpac 2 (GenST2) to operate.
Open shell folder. Double click on shell.s
Click on 'assemble'. Choose 'disk assembly'
rather than 'memory' unless you have 1 meg RAM. Name the object code
T.PRG or whatever. The source code will take about 20 seconds to
assemble to hard disk. More to floppy. The resulting object code
can be run like a normal Gem program by double clicking over it.
When SHELL.S is assembled, it automatically appends a few libraries
which must be stored on the disk you are working from.
A typical working disk should be Double Sided and have on it:
SHELL
INCLUDES
COMMON
FONTS
GenST2.PRG
GenST2.INF
Desktop.INF
Inside SHELL is: SHELL_37.S or whatever version is current
HISCORES.ASC
TEXT.S
Inside INCLUDES is : INCLUDE1.S
INCLUDE2.S
INCLUDE3.S
INCLUDE4.S
INCLUDE5.S
INCLUDE6.S not essential
INCLUDE7.S not essential
SOUNDS.S
MACROS.S
Inside COMMON is: BUDGIE.TIT a small degas picture
GAMES.S
DRUM1.SPL some unimportant sampling
PENNY.PI1 introduction picture
WRITER.UK another binary file (incbin)
etc...
Inside FONTS are 8 and 16 pixel fonts
When SHELL.S is being assembled, it will expect to find
the INCLUDE files.
INCLUDE1 and INCLUDE2 are essential
so is INCLUDE5 if sound replay is to be used
INCLUDE1.S contains such things as file reading routines,
bios trap calls, supervisor mode, quit, reveal,joystick,
mouse,from_to,sort,vbi,etc..
INCLUDE2.S contains h/blank,pic_dump,mfp etc..
INCLUDE3.S contains pixel plot,sprite,etc..
INCLUDE4.S contains flip,fonts,message scroll,starfield,etc..
INCLUDE5.S contains replay
SOUNDS.S contains mainly sound effects
TEXT.S contains ascii messages, hi-scores tables, etc..
GAMES.S contains an ascii list of all Budgie games
Presently SHELL.S expects to find these files and folders
on DRIVE A. Do change if required.
So, what does SHELL.S do anyway?
1. It 'includes' a few handy macros
2. It gives back to gem (m_shrink) any memory it doesn't need to
start with.
3. It goes into supervisor mode
4. It finds out where physbase is
5. It asks gem to reserve some space (malloc) for work areas
which will be needed later on (spare screens, buffers,..)
I also asks gem to reserve space for files to be loaded soon
(sprites for instance)
6. It initializes the A-line so that we may change the fonts later on.
7. It hides the mouse, the cursor, etc..
8. It goes into low res, unless monochrome is detected
9. It loads the new fonts from disk, and some tunes.
10. It installs the horizontal blank interrupt routine, if any
11. It installs the vertical blank interrupt routine, if any
12. It does the same with the mfp interrupts
13. It checks whether ascii files have been interfered with...
14. It checks whether the boot sector is still clean (virus)
15. It executes the opening sequence (title page, etc..)
16. It installs the joystick handler routine
17. It installs the mouse handler routine (optional)
18. It declares some of the main initial variables
19. It choose an initial screen to start with
20. It goes on the the MAIN LOOP, called 'main'
Fine, the prolog is over.
Now for the MAIN LOOP.
This is the conductor of the orchestra.
The program counter comes back to this LOOP 50 times a second,
even if there is nothing to do (if PAUSED for instance).
What does this MAIN LOOP do?
1. It reads the JOYSTICK (or mouse).
If there is a request, a BRAnch is made to this appropriate routine
2. It reads the KEYBOARD. If a key has been hit, again
a suitable BRAnch is made. Approx 33 keys can be detected.
With the exception of ESC, P, and Functions, most of them
are for de-bugging purposes.
A BRAnch to one of these routines is terminated with
a BRAnch back to main (and not with RTS)
3. It then swaps the 2 video pointers so that at the next
vertical blank, a different screen will be drawn by the
electron gun.
4. It now waits for the vertical blank. At this point, the video
chip redraws the screen (which is the one we were working on
during the LAST cycle)
5. The coordinates for all 'automatic' sprites are now being updated
6. The clock is updated. So is the score, etc..
7. It checks whether the level or the game is finished
8. All sprites are RESTORED. The background is temporarily spriteless
9. All targeted backgrounds are SAVED unless unnecessary
10. Finally, all sprites are DRAWN in their new positions.
All this restoring/saving/drawing takes place on the screen
which is NOT BEING SHOWN (logbase)
11. it now checks whether such minor things as Pause or
Slow Motion are required.
12. at this point, a 1/50th of a second has almost elapsed
and it's time to go back to MAIN !
The main KEYS which are possibly implemented are:
H toggle 50/60 Hz
* debug
Z popple's scroller
F1 restart game
F2-F3 copyright notice and credits
F4-F8 Budgie ads
F9 reset hi-score table
F10 display Options screen
HELP load Help screen
ENTER similar thing
X clear current screen
M a selection of sounds
C single step
V vertical scroll
P Pause
L Load a file (ex. spr*.pi1)
D Dump current screen to disk
1-2-3-4-5-6 display these screens (first press P)
UP/DOWN scroll through ram
keypad 0-5 sprites on/off
FIRE reveal horizontal raster (only if joysprite 0 is on)
etc...