Packed six-bit characters: Difference between revisions
m (Typo: bit endian -> big endian) |
m (added Glossary category) |
||
Line 43: | Line 43: | ||
*{{ND-doc|60.128.04 | Rev. A, page 2-64a}} | *{{ND-doc|60.128.04 | Rev. A, page 2-64a}} | ||
<!-- Add a category [Category:??]] --> | <!-- Add a category [Category:??]] --> | ||
[[Category:Glossary]] |
Revision as of 21:46, 23 July 2014
Packed six-bit characters is a method used by Norsk Data to create compact character strings. Each character is encoded in 6 bits, and a string is composed of 6-bit characters packed into a continuous bit stream, and stored in a number of 8-bit bytes or 16-bit words, right-aligned so that the least significant bit of the last character is the least significant (or rightmost) bit of the last byte or word (words are big endian on ND).
The character encoding is as follows:
6-bit value | Character | 7-bit ASCII value |
---|---|---|
0x00 | (No character) | - |
0x01 - 0x1F | "A" - "_" | 0x41 - 0x5F |
0x20 - 0x3F | <space> - "?" | 0x20 - 0x3F |
To convert a 6-bit character to ASCII, add 0x40 to the value if the 6-bit value is above 0 but below 0x20, otherwise use as ASCII (or ignore if value is zero).
S-group
The BRF format, i.e. compiled, non-linked ND-100 object code, stores symbols in packed 6-bit characters. These symbols are called S-groups. The symbol may be stored in two 16-bit words for BRF files generated by MAC and NPL, and contain up to 5 characters, or stored in three 16-bit words for BRF files generated by language compilers like FORTRAN. In the latter case the maximum symbol length is 7 characters, even though technically there is room for 8 characters inside 3 words (16*3 = 48, and 48/6 = 8).
The 6-bit characters are always packed and right-aligned so that the last character terminates at the end of the last word. For strings shorter than the maximum length the leading 6-bit field(s) are encoded as value 0.
Example
- String 'AB5DE' encoded as short S-group (2 words) or long S-group (3 words)
- The ASCII values are 0x41 0x42 0x35 0x44 0x45
- The 6-bit values are 0x01 0x02 0x35 0x04 0x05 (ref. translation table above).
- Translated to binary:
000001 000010 110101 000100 000101
- Encoded in two 16-bit big endian words (short S-group):
0000000100001011 0101000100000101
- Note how the two first bits are always padding and not part of the first character.
- In case of a shorter string, 'B5DE', the encoding would be:
0000000000001011 0101000100000101
- 'AB5DE' encoded in three 16-bit big endian words (long S-group):
0000000000000000 0000000100001011 0101000100000101
Other uses
The monitor call GRTNA/GetRTName, mon 152, returns the name of the RT program encoded as packed 6-bit characters in the three 16-bit registers T, A, D.
References
- Norsk Data Document ND–60.196.01 BRF-LINKER USER MANUAL Chapter 6
- Norsk Data Document ND–60.128.04 SINTRAN III REFERENCE MANUAL Rev. A, page 2-64a