FX-602P $WikiTagline
 

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 filename, 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 filename, 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 filename, 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 filename, 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 filename, 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 filename, high nibble is high nibble of the 1st character of the file name
1 Start of real programm 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 $3 3
7 File Header $04 $E0 $12 $01 $01 $77 $99 $3 3 $00

If you want to know the 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
Display data file (numeric) Mode 1 SAVE "" invEXE DF
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
All file (program and data) Mode 3 SAVE "" invEXE AF
Password protected all file Mode 3 SAVE "" infEXE AF

Passwords

Passwords - including numerical, are stored in clear text using the . 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 (unlinke the mantissa of L register wich is 12 digits) and is stored in packed BCD, least significat 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 exponent digit 1
3 mantissa digit 10 $0
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:

gainsboro
True meaning not yet known.
cornsilk
True meaning not yet known but internally used by the Simulator.