Verify what you SAVE, then you won't be sorry
When you have spent hours punching in a program you want to
be sure that it really is saved correctly on disc. MARK SMIDDY
shows you how with his verify routine ...
THE object of this verify routine is to check that the contents
of a program file on disc (or tape) are exactly the same as the
contents of memory. Or to put it another way, to check that the
five hours of work you have just SAVEd will actually be what you
typed in when you reload it.
The program, which is assembled at & 1800, is suitable for
use with model A or B with Acorn DFS or standard cassette, and
is compatible with all operating systems.
After running the program you can call the verify routine by
using CALL &1800. Of course, the program you wish to verify
should be in memory!
Instructions showing how to save the assembled code are displayed
when the program is run. It will remain resident during most filing
operations, but it is wise to reload the assembled code whenever
it is required.
Here's a full program description. In the following text A refers
to the 6502 accumulator, X refers to the 6502 index register X,
and Y refers to the 6502 index register Y.
The program can be split into five main sections:
1. GET the filename.
2. Open a read only file.
3. Check the file byte by byte.
4. Close the file.
5. Output any messages.
1. This section uses the rarely used call OSWORD with A=0 to
input a string of Ascii characters of specified range up to a
specified string length. The string input will be used as the
The maximum string length is set to 7 in line 130, and should
be changed to 10 if the utility is to be used with cassette.
2. This uses the OS call OSFIND with A=&40 to open a file
for read only. The file handle (the number assigned to it) will
be returned in A and not in Y as is stated in the User Guide.
OSFIND returns with the zero flag set if no file could be opened.
3. This uses OSBGET to take each byte sequentially from the
file and check to see if it is the same as the next byte in memory.
4. OSFIND is used again to close the file whose file handle
is held in Y.
5. This outputs any messages using OSWRCH, starting at a point
in the text pointed to by the X register.
10-60 Initialise variables.
70-80 Output 'Input Filename' message.
90-180 Set up OSWORD parameter block.
190-220 Set up X and Y and call OSWORD with A=0.
230 Jump out if ESCAPE is pressed.
240-310 Initialise M/C variables, and call OSFIND with A=&40
to open a file for read only.
320 Test to see if any file was opened.
330 Save file handle. 340-360 Get next byte from the file.
370 Test for End Of File marker.
380-480 Compare with next byte in RAM and increment pointers.
490-520 Output End Of File error.
530-560 Output file not found message.
570-590 Output Verify error.
600-640 Close the file.
650-710 Output messages.
720-760 Make a BEEP.
770-820 Reserve some space for the OSWORD control block.