Sharp logo

MZ-800 course Chapter 2 
2. BASIC-800 ( 1Z016 / 5Z-009 )


2.2 'Extra' BASIC instructions

The word Extra is placed between quotes because the instructions described in this section are not really extra, they are just instructions not mentioned in the manual. These instructions will be discussed below in more detail.

BEEP

After issuing this instruction a short tone of 440 Hz will be audible.

EDIT


After issuing this instruction the last line which you edited will be displayed. The function of this instruction is to edit the line in question, or to redisplay this line.

It is also possible to display an arbitrary line with EDIT, for example:

EDIT 10.

The EDIT instruction is followed by the line number. EDIT is closely related to LIST ( followed by one line number ), the main difference is that the cursor is placed right after the line number when you use the EDIT command.

FRAC


With this instruction you can move the part of a real-valued number after the decimal point in front of it. Just try this:

PRINT π and then PRINT FRAC(π)

Can you see the difference? Hopefully this example made the function of FRAC clear.

HEX$(x)


With this instruction you can convert a decimal number to a hexadecimal number. Just try this:

PRINT HEX$(15)

The inverse ( from HEX to DEC ) can be done by just printing the hexadecimal number. Just try this:

PRINT $A0

MOD


MOD will give you the remainder of an integer division. An example:

PRINT (26 MOD 4) This will yield: 2 ( 26:4 = 6 mod 2 ).

SPACE$


With this instruction you can put a number of spaces in a row up to a maximum of 255. Some examples:

PRINT SPACE$(20);"SHARP"

This will put twenty spaces and then the word ”SHARP” on the screen.

PRINT SPACE$(80);"SHARP"

This will put eighty spaces and then the word ”SHARP” on the screen. etc.

This probably clarified the function of SPACE$. It looks a lot like TAB, but TAB will not clear all characters in the target domain. SPACE$ will do so.

LOAD ALL


This instruction will load all programs from QD to the RAM-card, provided a RAM-card is present, otherwise an Unformat error
will occur. When the programs are present on the RAM-card, they can be changed with the instructions RENAME or DELETE.

Because only a few people use a RAM-card in their SHARP, this will be one of the sporadic times we will go into the RAM-card.

SAVE ALL


All programs on the RAM-card will be written to QD. This instruction does the opposite of LOAD ALL.

By using these two instructions it it possible to rename programs on a QD and to remove programs from QD. You will have to reformat the QD to do the latter. This can only be done if you own a RAM-card, otherwise you must use the DELETE program.

In the next part of this chapter we will discuss some instructions you can add to BASIC yourself. The function of these new instructions will also follow in the next part of this chapter. You must realize however, that adding new instructions will go at the expense of other instructions.

According to the investigation preceding this book, few people use a plotter extensively. That is why most new instructions will replace the instructions specifically meant for the plotter. With each new function the replaced function will be mentioned.

Previous page
Next page
Contents


Go to the top of this page Home

last updated July 1, 2004
Arjan Habing, Mark de Rover, Jeroen F. J. Laros, sharpmz@sharpmz.org