80-Bus News


May–June 1983 · Volume 2 · Issue 3

Page 21 of 59

FIX (X) returns the truncated integer part of X. It is equivalent to SGN(X) * INT(ABS(X)) and does not return the next lower number for a negative value of X, unlike INT(X).

HEX$(X) returns a string in which the value represents the hexadecimal equivalent of the decimal (X). OCT$(X) does the same in octal.

INSTR([I,]X$,Y$) looks for the first occurrence of the string Y$ in the string X$ and indicates the position. I is an optional offset in the range 0 – 255.

SPACES (X) returns a string of X spaces; SPC (X) prints X blanks on the terminal.

STRINGS (I,J) returns a string whose length is I and is composed of ASCII code J (J is in the range 0 to 255 but not all the codes are printable).

Other items of possible use....

The statement (or command) RANDOMIZE allows you to ‘seed’ (or set up) a random number generator.

The largest number that MBASIC will allow is 1.70141E38 and the smallest positive number is 2.9387E-38 .

There is probably no better way of finding out what MBASIC will do than trying it out on short programs – you will probably find out more this way than by studying the manual – although the manual is an invaluable source of reference if you get stuck!

One problem which you may come across is that of portability – not everybody has MBASIC on disk and most of the commands and statements mentioned in this article are only found in extended or disk versions. MBASIC is interpreted on a line by line basis and a program in MBASIC is slower in execution than would be the case with the same program which has been written and compiled using Digital Research’s CBASIC which is designed for use with CP/M. MBASIC is usable on systems with all sorts of DOS and appears to have more functions and facilities and, unless speed of execution is important, would be preferable if you were considering the purchase of a disk BASIC.

I would like to thank my colleague, Laurie Hodges for the opportunity to use the MBASIC facility on his machine; thanks are also due to Microsoft for producing a manual which provided the inspiration for this article, and to Dave Hunt for some constructive ‘hacking’.

Can Anyone Help?

The following books are out of print, and Rory O’Farrell would like to hear from anyone who can help him obtain copies – all reasonable expenses paid!

A.V. Hershey, “Calligraphy for Computers”. NWL Report No. 2101 (Dalgren, Va: U.S. Naval Weapons Laborarory, Aug 1967) NTIS number AD662398.

Wolcott, N.M. and J. Hilsenrath. A Contribution to Computer Typesetting Techniques: Tables of Coordinates from Hershey’s Reportory of Occidental Type Fonts and Graphic Symbols. Washington D.C.: National Bureau of Standards Special Publication No 424, U.S. Dept of Commerce, U.S. Government Printing Office, 1976.

Page 21 of 59