80-Bus News

  

May-June 1983, Volume 2, Issue 3











Page 30 of 59











The workings of NASCOM ROM BASIC Ver 4.7

PAGE 6

FPREG

10E4

Floating point register.
This is a floating point number for the current value. It is a four byte store using 24 bit normalised sign and magnitude representation for the mantissa and excess 128 representation for the exponent of two.
Example of the number 35.25 in floating point:-

35.25 in binary is100011.01
Which is the same as100011.01 *2^ 00000000
The binary point is moved so that it precedes the first “1”
This gives.10001101
The point was moved left 6 times dividing the number by 2^6 so 6 must be added to the exponent to re-multiply by 2^6.
This gives.10001101 *2^ 00000110
As the bit after the point is ALWAYS “1” this bit can be used to store the sign of the number “0” for +ve, “1” for -ve
So +35.25 is stored as.00001101 * 2 ^ 00000110
Which in 24 bits is.000011010000000000000000 *2^ 00000110
128 is added to the exponent so that overflows and underflows can be more easily detected.
So the whole number in binary is:-
Which is
00​0011​0100​0000​0000​0000​0010​0001​10
0D000086HEX
The bytes of the mantissa are stored in reverse order.
This gives the value for +35.25 as00 00 0D 86
And -35.25 would be stored as00 00 8D 86

SGNRES

1088

Sign of result.
This contains the sign of the result for multiplication. Both values to be multiplied are tested and if their signs are different then the product will be negative otherwise it will be positive. The sign for the product is stored here so that it can be tested after to make the result correct.

PBUFF

10E9

Number print buffer.
When a floating point number has to be converted into ASCII for PRINT or STRS the ASCII number is built up in this buffer by NUMASC so that it can be output or assigned to a string.

NULVAL

10F6

Multiply value.
This contains the 24 bit multiplier because there are not enough registers to hold the multiplier, multiplicand and product all at the same time.

PROGST

10F9

Program start.
This is the byte before the first line in the program. It must be zero to tell the execution driver that the next (actually the first) line is to be executed.

The workings of NASCOM ROM BASIC Ver 4.7

PAGE 7

******** How a program is stored in memory ********

Example:- The program:-

  10 FOR A=1 TO 5:PRINT A,SQR(1):NEXT A
  20 END

is in memory, it would look like this:-

PROGND111C Pointer to byte after program

10FA15 11 Pointer to next line (1115)
10FC0A 00 Line number (10)
10FE81 FOR token
10FF20 Space
110041 A
1101B4 = token
110231 1
110320 Space
1104A6 TO token
110520 Space
110635 5
11073A :
11089E PRINT token
110920 Space
110A41 A
110B2C ,
110CBA SQR token
110D28 (
110E41 A
110F29 )
11103A :
111182 NEXT token
111220 Space
111341 A
111400 End of line
11151A 11 Pointer to next line (111A)
111714 00 Line number (20)
111880 END token
111900 End of line
111A00 00 Pointer to next line (0000 = End of program)
111C

This is an OCR’d version of the scanned page and likely contains recognition errors.











Page 30 of 59