English
Language : 

NSB8 Datasheet, PDF (135/158 Pages) List of Unclassifed Manufacturers – BASIC interpreter for Z80 family
ITALIAN TECHNOLOGY
grifo®
IMPLEMENTATION NOTES
This appendix is designed to provide important details concerning some of the internal workings of
NSB8, and the internal representations of data within BASIC, in order to help you better understand
the operation of the system, and to facilitate writing of programs which performs tasks which would
be difficult or impossible to undertake without such information.
DISKETTE DATA STORAGE FORMATS
All numbers which have been written to diskette by a BASIC of a given precision will have a standard
fixed storage size in bytes. However, the storage size of a number written to disk by 6 digits BASIC,
for example, will be smaller in size than that of a number written by 10 digits BASIC. Here is a chart
which tells how many bytes a number will require on disk, depending upon the precision of the
BASIC writing it:
PRECISION
6
8
10
12
14
BYTES
4
5
6
7
8
Numbers are stored in packed, binary coded decimal (BCD) form. The representation is as followa:
first byte:
bits 7÷4 = most significant digit of value in BCD coding
bits 3÷0 = next most significant digit of value
middle bytes: bits 7÷4 = next significant digit of value in BCD coding
bits 3÷0 = next significant digit of value
last byte:
bit 7 = sign (1=negative, 0=positive)
bits 6÷0 = exponent in excess 64 binary representation (if all bits in the last byte
are 0, the entire number is 0).
All values are normalized.
The decimal value of the first byte in a number stored on disk will always be greater than 15, even
when the number is zero. This is how the TYP function determines if the next data element is
numeric.
Strings are stored using a number of bytes equal to the length of the string plus two or three overhead
bytes. Strings of length less than or equal to 255 are stored with two overhead bytes, the first one
being of decimal value 3, and the second containing the number of characters in the string. The
information bytes (the string itself) follow the overhead bytes. A string value of length greater than
255 is stored with three overhead bytes, the first one being of value 2, and the second two being the
low and high bytes, respectively, of the length of the string, expressed as a 16 bits integer. Again, the
string itself follows the overhead.
The endmark for a sequential file is a single byte of value 1.
NSB8
Rel. 5.10
Page 123