Автор: Alexander Livshits
Год: 1984
Издатели: Your Spectrum
Языки:
Формат:
Требования:
Ссылки:
Скриншоты:
Header Reader - Alexander Livshits (Your Spectrum-Issue 4-Page ??)
Here's a routine that should prove useful to all Speccy users - for
the Basic programmer who's forgotten where a program is supposed
to start, the machine codist sizing up a certain piece of code
and, of course, the Microdriver attempting the tricky task of
converting software for operation on cartridge.
When a program file is saved to tape it is stored in two blocks: the
first part, known as the file header, is always 17 bytes long and tells
the Speccy all it needs to know about the program block which
follows.
This routine reads the header into high memory and decodes it
into a more meaningful form which is then displayed on-screen for
the user. The information provided is: the name of the program; the
type of program (Basic, code block, numerical or character array);
the destination address (if you are examining a code block) or the
program area (for Basic); the variables area; and the autostart line
number (if any).
Should the program not find a file header, the message 'NOT A
HEADER' is dutifully printed on-screen.
Lines 60-80 The 'initial set-up' routine in which RAMTOP is lowered to
27999. The two variables 's' and 'd' setup the machine code
start address and the address to which the header is to be
loaded, respectively. The function defined in line 70 performs
a double byte PEEK (ie. this would be a DEEK on other
computers).
Lines 90-95 Read in and POKE the machine code data to the address
reserved for it.
Lines 100-150 The 'read header routine. This section of the program calls
the machine code which reads the header into memory from
location 'd' onwards. Line 150 sets the variable type to be
equal to the first byte of the header.
Lines 159-200 Read in the header name from bytes 'd+1' to 'd+10' and
print it.
Lines 210-230 Set up the following variables: 'len' - the file length; 'start'
- the start address; 'pa' - the length of the variables area;
and 'va' - the start of the variables area
Lines 239-280 Print details of the header for a Basic program file.
Lines 399-460 The part of the program which deals with the case of the
header not being for a Basic program file. t$ is set to equal
the file type. If it is a code file, line 440 prints the start
address.
Lines 600-630 Lines 120 and 150 checked that the data read in was a
header. And if it wasn't, then this routine prints the 'NOT A
HEADER' message and the user is asked if another header is
to be read in.
------------------------------------------------------------------------------
TYPE: Utility
COMMENT:
This info file was typed by Jim Grimwood
Downloaded from:
Desert Island Disks -- http://www.image.dk/~frankie/
Maintained by:
Michael Bruhn -- frankie@image.dk
Here's a routine that should prove useful to all Speccy users - for
the Basic programmer who's forgotten where a program is supposed
to start, the machine codist sizing up a certain piece of code
and, of course, the Microdriver attempting the tricky task of
converting software for operation on cartridge.
When a program file is saved to tape it is stored in two blocks: the
first part, known as the file header, is always 17 bytes long and tells
the Speccy all it needs to know about the program block which
follows.
This routine reads the header into high memory and decodes it
into a more meaningful form which is then displayed on-screen for
the user. The information provided is: the name of the program; the
type of program (Basic, code block, numerical or character array);
the destination address (if you are examining a code block) or the
program area (for Basic); the variables area; and the autostart line
number (if any).
Should the program not find a file header, the message 'NOT A
HEADER' is dutifully printed on-screen.
Lines 60-80 The 'initial set-up' routine in which RAMTOP is lowered to
27999. The two variables 's' and 'd' setup the machine code
start address and the address to which the header is to be
loaded, respectively. The function defined in line 70 performs
a double byte PEEK (ie. this would be a DEEK on other
computers).
Lines 90-95 Read in and POKE the machine code data to the address
reserved for it.
Lines 100-150 The 'read header routine. This section of the program calls
the machine code which reads the header into memory from
location 'd' onwards. Line 150 sets the variable type to be
equal to the first byte of the header.
Lines 159-200 Read in the header name from bytes 'd+1' to 'd+10' and
print it.
Lines 210-230 Set up the following variables: 'len' - the file length; 'start'
- the start address; 'pa' - the length of the variables area;
and 'va' - the start of the variables area
Lines 239-280 Print details of the header for a Basic program file.
Lines 399-460 The part of the program which deals with the case of the
header not being for a Basic program file. t$ is set to equal
the file type. If it is a code file, line 440 prints the start
address.
Lines 600-630 Lines 120 and 150 checked that the data read in was a
header. And if it wasn't, then this routine prints the 'NOT A
HEADER' message and the user is asked if another header is
to be read in.
------------------------------------------------------------------------------
TYPE: Utility
COMMENT:
This info file was typed by Jim Grimwood
Downloaded from:
Desert Island Disks -- http://www.image.dk/~frankie/
Maintained by:
Michael Bruhn -- frankie@image.dk