As changes occur to the BAM in DOS memory, the BAM on disk will be
updated to reflect these changes. Updates to the BAM occur when a program is
SAVEd or a CLOSE or DCLOSE is performed on a new RELative or SEQuen-
tial data file.
1. Operate you Commodore Computer
2. Do elementary programming in BASIC
3. Open and close files.
NOTE
The BASIC statements described in this chapter
apply specifically to the 2031. Certain commands
and statements may follow a slightly different for-
mat or produce different results from those des-
cribed herein when they are used with the computer
or with other peripherals. Consult the appropriate
manual for the exact use of these commands and
statements in other applications.
This chapter will first acquaint the user with those fundamental disk commands
that perform disk maintenance and file manipulation and will then progressively
advance toward an understanding of those BASIC commands used for data
handling. Approached in this manner, the user will then have developed the
necessary confidence and programming skills to proceed to advanced disk pro-
gramming techniques. Practice the disk commands, read the examples, and
follow the step-by-step illustrations of their usage. The understanding of the
more advanced disk programming techniques will depend to a large degree upon
how well the fundamentals have been mastered.
To facilitate your understanding and mastery of Commodore BASIC, two com-
puter terms are stressed in this Chapter: Block Availability Map (BAM) and
Disk Operating System (DOS). Although these are conventional terms, they will
be briefly discussed as they relate to the Commodore Floppy Disk Drive.
THE BLOCK AVAILABILITY MAP (BAM)
The BAM is a disk memory representation of available and allocated space on a
disk. When the system stores information on a disk, the BAM will be automati-
cally referenced by the DOS to determine what space is available and how many
blocks can be allocated. If sufficient space is available to store a given file, it
will be stored on the disk and the BAM updated to account for the space allocated.
However, if the DOS detects that a file will occupy more space than available, an
error message will be generated.
Formatting a disk creates the BAM which is then loaded into DOS memory
upon initialization. The BAM which is then loaded into DOS memory
upon initialization. The BAM is stored on diskette on track 18, sector 0, and 128
bytes in length.
16