File Format
Fileheader #
| Byte | Content | |
|---|---|---|
| FX-502P filenumber | FX-602P filenanme | |
| -7 | Filetype byte 1 – see below. | |
| -6 | Filetype byte 2 – see below. | |
| -5 | Low nibble $A, high nibble last digit of file number. | low nibble is low nibble of 6th character of the file name, high nibble is low nibble of the 5th character of the file name |
| -4 | Low nibble second digit, high nibble first digit of file number. | low nibble is low nibble of 4th character of the file name, high nibble is low nibble of the 3rd character of the file name |
| -3 | $FF | low nibble is low nibble of 2nt character of the file name, high nibble is low nibble of the 1st character of the file name |
| -2 | $FF | low nibble is high nibble of 6th character of the file name, high nibble is high nibble of the 5th character of the file name |
| -1 | $FF | low nibble is high nibble of 4th character of the file name, high nibble is high nibble of the 3rd character of the file name |
| 0 | $FF | low nibble is high nibble of 2nd character of the file name, high nibble is high nibble of the 1st character of the file name |
| 1 | Start of real program or data. | |
Filenames #
The way file name are encoded is rather tricky.
| Step | Operation | Result |
|---|---|---|
| 1 | Original Filename | "ABab12" |
| 2 | The characters are reversed | "21baBA" |
| 3 | To continue we need to byte hex codes | $72 $71 $91 $90 $31 $30 |
| 4 | The byte hex codes are splitt into there nibbles. | $7 $2 $7 $1 $9 $1 $9 $0 $3 $1 $3 $0 |
| 5 | Nibbles reorder – see colour code. | $1 $2 $0 $1 $0 $1 $7 $7 $9 $9 $3 $3 |
| 6 | The nibbles are merged back to bytes | $12 $01 $01 $77 $99 $33 |
| 7 | File Header | $04 $E0 $12 $01 $01 $77 $99 $33 $00 |
If you want to know the file name you need to calculate as follows:
Char(1) = (Header(-3) AND $0F ) OR (( Header(0) AND $0F) LSHIFT 4)
Char(2) = ((Header(-3) AND $F0) RSHIFT 4) OR ( Header(0) AND $F0)
Char(3) = (Header(-4) AND $0F ) OR (( Header(1) AND $0F) LSHIFT 4)
Char(4) = ((Header(-4) AND $F0) RSHIFT 4) OR ( Header(1) AND $F0)
Char(3) = (Header(-5) AND $0F ) OR (( Header(2) AND $0F) LSHIFT 4)
Char(4) = ((Header(-5) AND $F0) RSHIFT 4) OR ( Header(2) AND $F0)
Filetypes #
The following file types are currently known.
| Byte 1 | Byte 2 | Content | Created with | Displayed Type |
|---|---|---|---|---|
| $40 | $40 | M-Register data file | Mode 1 SAVE "" EXE | DF |
| $41 | $40 | Display data file (numeric) | Mode 1 SAVE "" invEXE | DF |
| $42 | $40 | Display data file (alpha) | Mode 1 SAVE "" invEXE | DF |
| $04 | $0E | Program file | Mode 3 SAVE "" EXE | PF |
| $40 | $0E | Password protected program file | Mode 3 SAVE "" EXE | PF |
| $44 | $4E | All file (program and data) | Mode 3 SAVE "" invEXE | AF |
| $40 | $4E | Password protected all file | Mode 3 SAVE "" infEXE | AF |
Passwords #
Passwords - including numerical, are stored in clear text using the Alpha_Plane. The only encryption is that the characters are stored in reverse order. The end of the password is marked with a $EC.
In the Simulator I never implemented password protection as there are far to easy to crack. It is actually easer to extract the password from the file then the filename.
Datafiles #
Each Memory Register is stored in 8 bytes beginning with byte 1. The Memory Register are stored M00-M09, M0F, M10-M19, M1F, etc. Each number is BCD encoded and normalized to ±X.XXXXX×10±YY.
The mantissa if M register is only 10 digits (unlike the mantissa of L register which is 12 digits) and is stored in packed BCD, least significant digit first.
The exponent is three BCD digits in size and biased by 100 (See: Excess-N). That means an exponent of 101 stand for ×101, 100 for ×100, 99 for ×10-1 and so forth.
| Byte | High Nibble | Low Nibble |
|---|---|---|
| 1 | exponent digit 2 | exponent digit 3 |
| 2 | $0 (mantissa digit 12) | exponent digit 1 |
| 3 | mantissa digit 10 | $0 (mantissa digit 11) |
| 4 | mantissa digit 8 | mantissa digit 9 |
| 5 | mantissa digit 6 | mantissa digit 7 |
| 6 | mantissa digit 4 | mantissa digit 5 |
| 7 | mantissa digit 2 | mantissa digit 3 |
| 8 | sign $0=positive, $1 negative | mantissa digit 1 |
All-Files. #
In All-Files the program is stored first and then the data. Both are separated 8 consecutive $FF Bytes.
Filefooter #
The file ends with 8 consecutive $FF bytes. Anything following the footer is ignored. The original was using a tape and not all tapes drives could stop automatically.
Colour Codes #
The following colour code are used:
-
GhostWhite - Unused or True meaning not yet known.
-
cornsilk - True meaning not yet known but internally used by the Simulator.