162
edits
(→Pulses: Initial polarity does not matter.) |
(data block array format) |
||
Line 56: | Line 56: | ||
|} | |} | ||
The type is 0,1,2 or 3 for a Program, Number array, Character array or Code file. A SCREEN$ file is regarded as a Code file with start address 16384 and length 6912 decimal. If the file is a Program file, parameter 1 holds the autostart line number (or a number >=32768 if no LINE parameter was given) and parameter 2 holds the start of the variable area relative to the start of the program. If it's a Code file, parameter 1 holds the start of the code block when saved, and parameter 2 holds 32768. For data files finally, the byte at position 14 decimal holds the variable name. | The type is 0,1,2 or 3 for a Program, Number array, Character array or Code file. A SCREEN$ file is regarded as a Code file with start address 16384 and length 6912 decimal. If the file is a Program file, parameter 1 holds the autostart line number (or a number >=32768 if no LINE parameter was given) and parameter 2 holds the start of the variable area relative to the start of the program. If it's a Code file, parameter 1 holds the start of the code block when saved, and parameter 2 holds 32768. For data files finally, the byte at position 14 decimal holds the variable name: | ||
{|border="1" | |||
!Bits | |||
!7 | |||
!6 | |||
!5 | |||
!4 | |||
!3 | |||
!2 | |||
!1 | |||
!0 | |||
!Description | |||
|- | |||
|Numeric array | |||
|1 | |||
|0 | |||
|0 | |||
|x | |||
|x | |||
|x | |||
|x | |||
|x | |||
|xxxxx = CODE(''Name'') - 0x60; e.g. DIM a() ⇒ 0x81, DIM y() ⇒ 0x99 | |||
|- | |||
|String array | |||
|1 | |||
|1 | |||
|0 | |||
|x | |||
|x | |||
|x | |||
|x | |||
|x | |||
|xxxxx = CODE(''Name'') - 0x60; e.g. DIM a$() ⇒ 0xc1, DIM y$() ⇒ 0xd9 | |||
|} | |||
=== Data block === | === Data block === | ||
Number and string arrays are stored on tape in the same format as in RAM [http://www.worldofspectrum.org/ZXBasicManual/zxmanchap24.html|] except that the very first byte (the name of the array) is absent. The name of the array stored in the second byte of ''Parameter 1'' in header block. | |||
For example data block of a 2x3 numeric array (with small integer numbers): | |||
{|border="1" | |||
!Byte (decimal) | |||
!Length | |||
!Example value | |||
!Description | |||
|- | |||
|0 | |||
|1 | |||
|0x02 | |||
|Number of dimensions - DIM(2,3) | |||
|- | |||
|1 | |||
|2 | |||
|0x02 0x00 | |||
|Dimension 1 - 2 | |||
|- | |||
|3 | |||
|2 | |||
|0x03 0x00 | |||
|Dimension 2 (0x03 0x00 - 3) | |||
|- | |||
|5 | |||
|5 | |||
|0x00 0x00 0x6f 0x00 0x00 | |||
|First number - 111 | |||
|- | |||
|10 | |||
|5 | |||
|0x00 0x00 0x79 0x00 0x00 | |||
|Second number - 121 | |||
|- | |||
|... | |||
|5 | |||
|.. .. .. .. .. | |||
|... number | |||
|- | |||
|30 | |||
|5 | |||
|0x00 0x00 0xd3 0x00 0x00 | |||
|Last number - 211 | |||
|} | |||
''(Of course on the tape there are two more bytes: a 0xff -- marker of data block -- at the beginning and a checksum byte at the end.)'' | |||
Program files are stored as a sequence of lines each stored the same way it is in RAM: | Program files are stored as a sequence of lines each stored the same way it is in RAM: |
edits