|
The Commodore PET
(Model : CBM 8096) |
Disk Commands
Introduction
The majority of personal computers equipped with floppy disk
drives had disk interfaces based on the
Shugart
"standard", developed specifically for floppy disks. However,
disk drives for Commodore PET/CBM computers are connected via
the IEEE-488 interface, the notes on this page give a brief
introduction to using disk drives with a PET/CBM computer, for
more comprehensive instructions, refer to the Commodore DOS
documentation.
The IEEE-488 interface was developed by
Hewlett-Packard (HP) as the Hewlett-Packard Interface Bus
(HP-IB), it was designed for the interconnection of test
equipment, controllers and computers, allowing for the
connection of up to 15 devices on a single bus segment. HP
developed peripherals, including disk drives, for their own
computers using HP-IB and Commodore chose the same bus design
for use with PET/CBM computers.
CBM/PET Disk Concepts
IEEE-488 Device numbers allocated in PET/CBM computers are :-
Device No. |
Peripheral |
Control / Interface |
0 |
Keyboard |
Kernel ROM (on system board) |
1 |
Cassette Tape |
Kernel ROM (on system board) |
2 |
RS232 Interface |
Kernel ROM (on system board) |
3 |
Video Display |
Kernel ROM (on system board) |
4 to 15 |
Various I/O |
Peripheral Bus |
PET disk drive units are connected via the
Peripheral bus and are equipped with either one or two
floppy disk drives, the first disk drive unit is normally
assigned device address 8, the device address is that of the
controller inside the unit, it does not refer to a
physical disk drive number.
The
Commodore Disk Operating System (DOS) is somewhat
unusual in that the DOS is not part of the computer
operating system, rather, it is installed in the drive unit
and executes from there in response to commands from the
host system. The syntax used to communicate with the device
is very much like file I/O operations used in other systems,
e.g., "opening" a device, doing some operation and "closing"
the device.
In order to execute commands in the drive
unit, various parameters, including those below, must be set
:
Parameter |
Function |
Range |
File number |
A logical number used by
the computer only, not by the drive unit |
1 - 254* |
Device number |
Address number on the bus,
the first drive unit is usually #8 |
4 - 15 |
Secondary address |
Communications channel to
use for data transfer |
"Command Channel" for
computer to controller commands |
|
|
Command string |
Specifies disk device
within a unit, filename, file type, access mode
|
String |
* The file number and communications channel are assigned
by the user/programmer
CBM DOS supports the following file types :
File Type |
Description |
SEQ |
Sequential file, must be read from
start to finish |
PRG |
Similar to SEQ, used for all program
files |
REL |
Relative file, supports indexing,
individual 254 bytes records can be located
individually |
USR |
User specified, identical to SEQ
(limited use) |
DEL |
(Internal use) |
Disk Commands - Examples
Using the information above, commands to the
disk system can be sent from direct mode or
programmatically, some examples are shown below :
File Access |
Format |
OPEN <file number> , <device number> ,
<secondary address>, <command string> |
|
|
Example |
OPEN 1, 8, 2, "0: FILENAME, S, W" |
Result |
|
open |
(action) |
|
|
a sequential (S)
file |
|
(command string) |
|
called
FILENAME |
|
(command string) |
|
in Write (W) mode |
|
(command string) |
|
from the first drive (0:) |
|
(command string) |
|
in the device with address 8 |
(device
number) |
|
|
as stream 1 |
(file
number) |
|
|
referencing its data as
channel 2 |
(secondary address) |
|
|
|
Disk Status |
Format |
OPEN <file number> , <device number> ,
<secondary address>, <command string> |
|
As noted above, when accessing the command
channel, the secondary address is 15 |
|
|
Example |
OPEN 1, 8, 15 : INPUT#1, E, E$, T, S : PRINT
E, E$, T, S : CLOSE 1 |
Result |
The command will open the command channel,
read back the device status into the variables
specified in the command string and close the
command channel |
|
|
open |
(action) |
|
|
the device with
address 8 |
(device
number) |
|
|
using the
command channel 15 |
(secondary address) |
|
|
as stream 1 |
|
(command string) |
|
read the error number (E) |
|
(command string) |
|
get its text description (E$) |
|
(command string) |
|
report error track location (T)
|
|
(command string) |
|
and the sector on the
track (S) |
|
(command string) |
|
|
|
Program loading |
Format |
LOAD "<file name>" [,<device number>] |
|
|
Example |
LOAD "[x:] FILENAME", 8 |
Result |
|
load |
(action) |
|
|
a program (PRG)
file |
|
(command string) |
|
from disk
number x (optional, 0 or 1) |
|
(command string) |
|
called FILENAME |
|
(command string) |
|
from the the device with address 8 |
(device
number) |
|
|
|
|
These examples show how convoluted Commodore
DOS commands can be, particularly when used with the
earliest versions of Commodore BASIC. Some improvements were
made by the time that BASIC 4.0 was available for the PET/CBM
4000/8000 series.
Program
loading |
Format |
DLOAD "<file name>" |
Example |
DLOAD "FILENAME" |
Result |
|
load |
(action) |
|
|
|
a program (PRG) file |
|
(command string) |
|
|
called FILENAME |
|
(command string) |
|
|
from
default disk (Unit=8, D=0) |
|
|
|
|
Disk
Status |
|
System variables DS and
DS$ were added for the disk error channel variables |
Format |
PRINT DS |
PRINT DS$ |
Result |
Returns the error code
from the last disk operation |
Outputs the status of
last disk operation as a string, consisting of error
code, text message, track and sector |
Example |
0 if there were no
errors |
00, OK, 00, 00 if
there were no errors |
|
|
|
DOS Wedges
Even with the improvements made in later versions of
Commodore BASIC, PET DOS commands were not the most user
friendly, "DOS wedges" were written for a range of Commodore
systems to simplify disk commands and typically provided three
main functions :
- A simple command to read the device error channel to
check the disk's error status
- The ability to read the disk directory without
overwriting the currently loaded program
- Sending commands to the disk in a more user friendly
form than using the normal BASIC syntax
A number of DOS wedges are available for the PET/CBM, but the
one that I shall be using is Nils
Eilers' version, available from his website,
http://petsd.net/wedge.php.
The easiest way to use Nils' DOS wedge is to download the
install program from his webpage and place a copy on your disks.
When the program is run, it installs itself as a Terminate and
Stay Resident (TSR)
program and makes the wedge commands available from the command
line.
Although requiring more initial effort, the wedge commands
can be made available for immediate use when the system is
started, they can be integrated with the PET Editor ROM. The
Editor ROM is responsible for all video initialization, screen
output, keyboard input, full-screen editor, and IRQ handling.
Steve Gray
has created a
replacement Editor ROM which includes Nils'DOS wedge
By putting all this in one ROM Commodore was able to
customize the machines for various markets, with different
options.
.
|