General-purpose file commands and utilities

Files can be regarded as copies of the computer's memory which are stored on

disc. They may contain BASIC programs, word processed text, machine-code

programs, copies of the computer's screen or arbitrarily complex data.

Languages such as BASIC provide commands to save and load programs, but

when sections of the computer's memory have to be saved or loaded the MOS

filing system commands are used.

The *SAVE command saves a 'snapshot' of the computer's memory straight

onto the disc, and it has several forms; for example:

*SAVE RAM 0 8000

*SAVE area 3969+452

The first command saves the all of the computer's main memory, betwee

addresses &0000 and &7FFF. Addresses given to, and displayed by, filing

system commands are always in hexadecimal. The first number following the

name is the address of the first byte to be saved; the second number is the

address of the byte after the last one to be saved. It is a common practice in

Acorn products to state upper limits in 'byte after' form (e.g. HIMEM in

BASIC). This tends to simplify lengthy calculations.

The second command saves the area of memory between &3969 and &3DBB

(&3969+&452) in the file called 'area'. This form of the command uses a '+'

followed by the length of the area of memory.

Having issued a *SAVE command, it is informative to look at the file's *INF

information. For example, try typing these commands into BASIC:

>*SAVE chunk 1C00+200RETURN

>*INFO chunk RETURN

chunk WR (15) 00001C00 00001C00 00000200 000FE2

Name Access Load Execute Length Disc address

The entries marked 'Load','Execute' and 'Length' are of most interest. 'Load' is

the address in memory at which the file will be reloaded (using the *LOAD

command, see below). Notice that this is the same as the start address of the

block of memory when saved, so it will be restored to the same place. The

'Execute' entry is the address which will be called if the file is executed with

*RUN or one of its equivalents. By default it is the same as the load address,

but it may be changed if required. The next entry, 'Length', is the length of the

file in bytes which was given with the command; if you use the alternative form

the MOS will calculate this automatically. The last entry is the disc address,

which need not concern us.

F 20