Your Spectrum
YS MegaBasic manual - Getting Started
Home YS MegaBasic Contents

GETTING STARTED

Loading YS MegaBasic is simplicity itself. Just type:

  LOAD ""

YS MegaBasic is supplied on tape, together with another program called Sprite Designer; the latter allows you to design sprites easily for later use in your own programs. If you want to transfer the Sprite Designer program to Microdrive, just select the 'copy' option from the main menu. YS MegaBasic has a built-in transfer function - as soon as it's loaded, it'll ask you if you want to transfer YS MegaBasic to Microdrive; press the 'M' key if you do - if not, press any other key. Sinclair Research has distributed Interface 1 devices with two different ROMs, so if you're going to be using YS MegaBasic with Microdrives you'll have to sort out which Interface 1 ROM you have. The simple way to do this is to type:

  CLOSE #0: PRINT PEEK 23729

Should you get a '0' on-screen, you're the proud owner of an Interface 1 with an old ROM and, consequently, there's no need for any alterations to YS MegaBasic as it stands. However, if you get an '80' flashed on-screen, then you've got yourself an Interface 1 unit with a new ROM. To get full compatibility with YS MegaBasic, you'll need to type:

  POKE 47006,183

once the program has loaded. As long as you carry out this simple operation each time you load YS MegaBasic, there should be no problem.

THE KEYBOARD

Once YS MegaBasic has loaded, you'll be greeted by a short copyright message and an inverse space in the bottom left-hand corner of the screen; this is the new cursor and it indicates where your input will be appearing. With YS MegaBasic the whole of the screen is now used for input instead (as with the normal Spectrum) of the screen being split into two parts.
  Try typing a few characters on the keyboard and you'll notice that the keys aren't producing their usual keywords ... instead you see just single characters. From now on, you'll have to type out each command in full rather than use the infamous keywords - a facility which transforms your Spectrum keyboard into something approaching that of a 'normal' computer.
  Although removing the keyword system has many advantages, the
2

change does have a drawback. Certain commands such as 'PRINT' could be typed in just by pressing the 'P' key, whereas now you'll have to type out 'P', 'R', 'I', 'N' and 'T'; for that reason, YS MegaBasic allows you to abbreviate many of the keywords.
  Here follows a complete list of keywords and their new abbreviations; you can assume that keywords omitted from the list cannot be abbreviated and therefore must be typed out in full. Also note that an abbreviated keyword must finish with a full stop; for example, the abbreviation for 'CONTINUE' is 'CON.'.
A.TTR ER.ASE ME.RGE RES.TORE
BE.EP E.XP M.OVE RET.URN
B.IN FL.ASH NE.XT R.ND
BO.RDER F.ORMAT N.OT SA.VE
BR.IGHT GO S.UB OP.EN # S.CREEN$
CH.R$ G.O TO OV.ER ST.R$
CI.RCLE I.NKEY$ PA.PER T.AB
CLE.AR INP.UT PAU.SE TH.EN
CL.OSE # INV.ERSE PE.EK U.SR
C.ODE L.EN PL.OT V.AL$
CON.TINUE LI.NE P.OINT VE.RIFY
DA.TA LL.IST PR.INT 
D.EF FN LP.RINT RA.NDOMIZE 
DR.AW LO.AD RE.AD 
Remember that if you're going to be typing commands such as 'GO TO' and 'OPEN #' in full, you'll have to remember to insert the necessary spaces; the computer will understand 'GO TO' but 'GOTO' will result in a "Syntax error" message being flashed on-screen.
  The bottom line of the display is used to indicate the current mode of the cursor. Below is a table showing the normal Spectrum modes, along with the relevant on-screen message you'd expect on the bottom line.
Cursor mode Bottom line display
'L' CAPS OFF
'C' CAPS ON
'E' CAPS OFF EXTENDED
'G' CAPS OFF GRAPHICS
The cursor's mode is changed in the usual way - using the Caps Lock, Graphics, Caps Shift and Symbol Shift keys.
3

THE EDITOR

The line editing capabilities have been greatly enhanced by YS MegaBasic and, as a result, some keys produce different effects to those found on the standard Spectrum.
EDIT Copies the current program line into the input line, ready for editing.
TRUE VIDEO Deletes the whole of the input line.
INVERSE VIDEO Deletes the character to the right of the cursor.
CURSOR LEFT Moves the cursor left one character.
CURSOR DOWN Moves the cursor down one line within the input line.
CURSOR UP Moves the cursor up one line within the input line.
CURSOR RIGHT Moves the cursor right one character.
DELETE Deletes the character to the left of the cursor.
'<=' Moves the cursor to the beginning of the input line.
'<>' Deletes all the characters from the cursor to the end of the line.
'>=' Moves the cursor to the end of the input line.
SCREEN$ Displays the automatic listing (output to window one). The top line in the listing is the current line.
OR Moves the current line up one and displays the automatic listing.
AND Moves the current line down one and displays the automatic listing.
STOP Moves the 'copy' cursor left one character square.
NOT Moves the 'copy' cursor up one line.
STEP Moves the 'copy' cursor down one line.
TO Moves the 'copy' cursor right one character square.
AT Copies the character at the 'copy' cursor to the 'input' cursor. This command can also be used to copy characters which are of standard size; it will not copy 64 column characters, double height characters or double height/double width characters.
OVER Moves the 'copy' cursor to the next window.
INVERSE Resets the 'copy' cursor to the top left of the current window.
4

  Note first, however, that the screen is split up into three different sections or windows - for more information on windows see page 6 - and each is used for a specific task: window zero displays user input and error messages; window one displays automatic listings produced by the line editor; window two displays all output produced by Basic commands; and window three is used by the front-panel, see page 20. When YS MegaBasic is first loaded you may think there's only one window on-screen; you'd be wrong - in fact, there are four, all of which overlap.
  Note too that a second cursor may be used to copy text from another part of the screen to the 'input' cursor. This cursor appears as a flashing square on- screen and can be moved around the current window via a number of pre- programmed control keys. The 'copy' cursor will only function in windows zero, one and two.
  As well as using Caps Shift '1' to edit the current line it's possible to edit any line in the program using the 'EDIT_' command. This command is followed by a numeric expression that shows which line is to be edited. If the required line doesn't exist, then the next program line is used; if there's no next line then the "Line not found" error message is displayed on-screen.

USER-DEFINED KEYS

It's possible to program the top row of keys to produce strings of up to 255 characters. To program a user-defined key, you use the 'KEY_' command, followed by a numeric expression and a string expression (separated by a comma). The numeric expression defines which key is to be programmed, and the string expression provide the means. Placing an 'ENTER' character (CHR$13) at the end of a string will enable the key to execute itself automatically. To save you defining your own 'RUN' and 'LOAD' keys, YS MegaBasic already includes them:
VERIFY Comprising the string 'RUN+CHR$ 13', this key runs the current program in memory.
VAL$ Comprising the string 'LOAD"":RUN+CHR$ 13', this key loads and then runs the next program on tape.


CONTROL KEYS

During RUN-time the Space key is used as a new Shift key. Consequently, to obtain a space between characters, both the Symbol Shift and Space keys must be pressed simultaneously. The Space key - when used together with another key - will from now on be referred to as the Control key. Here follows a number of Control functions available during RUN-time.
5

CONTROL F Calls up the front-panel (see page 20 for more details).
CONTROL E Stops program execution, prints the "Escape" message and returns to the line editor.
CONTROL R Resets the YS MegaBasic system. It stops program execution, sets BORDER, PAPER and INK to their start- up values, prints a copyright message and returns to the line editor. This function does not erase any Basic programs in memory.
6.a