C O V E R S T O R Y|
M E G A B A S I C
Announcing ... the ultimate software sensation - Mike Leaman's MegaBasic - a completely new concept in Spectrum programming. Discover the delights of QL-style windows, sprites galore, stunning sound effects, single letter entry, named procedures ... and much, much more!!
YS MegaBasic is a machine code program which dramatically enhances the
capabilities of the 48K Spectrum. Mike
Leaman's long-time labour of love leaves
the user with about 22K of usable memory, while at the same time providing the
kind of features you'd expect to find on a
computer five times the price - windows, different character sizes and fonts,
procedures, as well as stack of new
commands. Not only that, the program
was written specifically to iron out the
Speccy horror number one... the non-
standard keyword entry system. |
Overall, YS MegaBasic is a unique way of upgrading the Spectrum - and one which doesn't involve paying out huge sums of money for expensive pieces of hardware. Fancy a trip to new worlds of Spectrum versatility? Then read on!
KEYBOARD MAGICJust take a look at the way the keyboard operates under YS MegaBasic. The keys now work as they would on a 'normal' computer, that is they only give single ASCII characters; now, all commands
and functions have to be typed in letter
by letter. This will allow the YS MegaBasic owner to use all the new commands
easily and, of course, any user new to the
Spectrum will no longer have to convert
to Sinclair Research's idiosyncratic keyword system. |
In the land of YS MegaBasic, the Space key is used as a new Shift key and that's how you squeeze all the new functions out of the keyboard. Just one single key stroke, for example, will RUN the current program in memory or LOAD and RUN the next program on tape!
Lo and behold, the Spectrum is now provided with user-defined keys. The top row (keys '1' to '0') can be programmed to produce a string of up to 255 characters. What's more, the usual 'hack' method of editing on the Speccy has been replaced by a slick sequence that's more reminiscent of the BBC Micro. The method used involves the use of a second cursor which can be moved around the screen independently of the usual input cursor. Text can be copied from the second cursor to the input cursor by just a
single keystroke. |
The standard Spectrum screen divides up into two parts ... YS MegaBasic employs three! There's a section for inputting commands and displaying error messages, another for program output, and finally an area for automatic listings. The size and position of these screen areas are completely user-definable, and the same area can even by used for two (or all three) functions.
SCREEN DREAMSYS MegaBasic has done amazing things to the Spectrum's screen output facilities. Now, it offers no less than three different sizes of character:
1. 64 columns by 24 lines Here, even though the width of each character is halved, the characters still remain quite clear - even on a standard TV set. This size of character is ideal for applications like word processing.
2. 32 columns by 24 lines This is the normal size used by the standard Spectrum.
3. 32 columns by 12 lines Now you can
This listing as printed in the magazine has several errors in it; see the end of the article for a corrected version.
|C O V E R S T O R Y|
produce characters which are twice the
normal height. |
And another bonus ... when you're using options 2 and 3, it's also possible to select between two different character sets; in effect, this gives you five different ways of displaying characters on the Spectrum screen.
Ever thought you'd have a QL-like windowing system on the Speccy? Well, courtesy of YS MegaBasic, there's now a way of keeping the display confined to a particular area of the screen. The size and location of windows is totally user-definable, and different character sizes can also be mixed within the same window. The user can even switch between several different windows at any time; in fact, the total number of active windows is only really limited by the amount of memory available. Each window can be cleared or inverted individually, and scrolled up, down, left or right.
SMASH SPRITESNow, for the first time ever, the Spectrum incorporates its own sprite routine. All
Although it might not make too much sense to you just yet, the listing on the left creates the display shown on the screen. You'll notice that, as well as producing three windows, the windows each contain multicoloured text in three character sizes: double height, normal height and that used for 64-columns. Look closely and you'll see that the double height and 'standard' size text comes in two different fonts.
you do is define the direction you want
the sprite to move in and then send it on
its way; once started, the sprite continues
of its own accord. You can also define
what happens when the sprite hits
another graphic object ... it can either
stop or keep moving. |
A Speccy sprite is defined by bytes in memory - just as with a user-defined graphic - and each byte represents a horizontal line of eight pixels. Each sprite can be any multiple of eight pixels wide and any number of pixels deep. In addition, each square of eight by eight pixels can have its own attribute - so sprites can be multi-coloured!
With YS MegaBasic, your MegaSpectrum will automatically provide you with 10 sprites - although there are ways of getting more. Remember though, the speed at which your YS MegaBasic program runs is dependent on the size and number of sprites that you're using. The more sprites there are, and the larger their size, the slower your program will run.
Since defining sprites is a very complicated process, a 'sprite designer' program is supplied free with every copy of YS MegaBasic. The program allows you first to define the sprites on the screen, and encode them into memory as bytes. You can then save these bytes as CODE which can be loaded into your own programs.
MEGA COMMANDSA whole bundle of new commands will fly to your fingertips - thanks to YS MegaBasic. For instance, there's ones to handle the windows and different character sizes - such as MODE, CURRENT, WINDOW and CLW. And commands are provided which make it easier to write programs - such as TRON, TROFF, AUTO, SPEED and DELETE. These are all entered into your MegaSpectrum just as you would
|C O V E R S T O R Y|
command word and the start of the argument. For example, the command to
print an 'A' character on the screen using
the keyword 'VDU' would be VDU_65. |
Although the existing keyboard system is non-standard and usually more of a hindrance than a help, it does actually have some advantage too. For example, when entering the command PRINT, it's quicker to stab the 'P' key than to press all five individual letters of the word. Well, the good news is that with YS Mega Basic, it's still possible to abbreviate some commands and functions (a list of minimum abbreviations can be seen as a separate table). You'll notice that the commands are input by way of a full stop, but the abbreviations are expanded out to their full form when they're displayed as a screen listing. Any word not included in the table cannot be abbreviated and has to be typed out in full.
CUSTOMISING POWERAnother neat little bonus is that it's possible to customise YS MegaBasic to suit your own particular needs - simply by adding named subroutines. The system is similar to procedures in other Basics, except you can't use local variables. Parameters can be passed to the subroutines just as normal and a subroutine is terminated by a Basic RETURN instruction. You activate it by entering its name, together with any parameters required. The word 'Proc' is not required. The named subroutine really does become just like another Basic command. For example:
The program example given shows how a named subroutine is defined. You activate it by entering 'CHARA_165', which results in the characters from 165 up to 255 being displayed on-screen. Subroutines can be called from anywhere in a YS MegaBasic program ... they can even call themselves. Thus, lines such as 'IF A$="TOKENS" THEN CHARA_165' are valid!
EXAM RESULTSA small front-panel program is hidden in the depths of YS MegaBasic ... small and self-contained, and written in machine code (of course). It allows us to examine the internal workings of the MegaSpectrum, enabling the user to examine and alter memory and registers, execute machine code programs, set break-points, and move and fill blocks of memory. The program works with hexadecimal numbers only and you can activate it at any time by just pressing the Space bar and the 'F' key together. It can also be activated from within a program, by execution of the command MON.
YS MEGABASIC COMMAND ABBREVIATIONS
AND NEXT?From next issue on, author Mike Leaman will be presenting a series of tutorials to help you along with YS MegaBasic - the software key to a new dimension of Spectrum computing. DON'T MISS IT!!
5 BORDER 0: INK 9 10 DISPLAY_3,64,18,0,0," DOUBLE HEIGHT " 20 DISPLAY_2,32,8,0,16," NORMAL SIZE " 30 DISPLAY_1,32,8,32,16," 64 COLUMNS " 40 GO TO 40 50 @DISPLAY_M,XS,YS,X,Y,A$ 60 WINDOW_Y,X,YS,XS 70 MODE_M:FONT_0 80 FOR A=0 TO 7: IF A=4 THEN FONT_1 90 PAPER A 100 PRINT A$; 110 NEXT A 120 ENDPROC_DISPLAY