Initialization commands: Difference between revisions

From Color 64 BBS Wiki
Created page with "Programming Features - <strong>Drive Initialization Commands</strong> This section is a summary of different drive init commands that seem to work best for a variety of disk drive devices. A drive init command is simply a command that tells the disk drive to prepare for access, and a method by which you can specify which partition (LU and USER for Lt. Kernal users) or subdirectory to use on 1581, RamLink, or Hard Drive systems. Since some dev..."
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[programming features|Programming Features]] - <strong>Drive Initialization Commands</strong>
[[programming features|Programming Features]] - <strong>Drive Initialization Commands</strong>


This section is a summary of different drive init commands that seem to work best for a variety of disk drive devices.  A drive init command is simply a command that tells the disk drive to prepare for access, and a method by which you can specify which partition (LU and USER for Lt. Kernal users) or subdirectory to use on 1581, RamLink, or Hard Drive systems.
== Drive Initialization Commands Overview ==


Since some devices may require multiple commands, you can separate individual commands with the exclamation point "!" character.  Also, since (as far as I know) the initialize command is universal to all Commodore drives, you can also change the drive number used by Color 64 by following an "i" command with the drive number of your choice.  Thus, to select drive number 13 (perhaps on a CMD HD), you would include an "i13" command somewhere in the init command.  This will change the variable DR$ (drive number) to reflect the current drive number in use.  Note that if you DO use the "i" command in a drive init string, this WILL override the drive number (0 or 1) you used in SETUP.  Note that the "i" command does NOT change the drive number for init commands entered in the bootmaker programs (bootmaker, bm ram, and bm small).  
This section summarizes drive initialization commands that work well with a variety of Commodore-compatible storage devices.


Here are the different init commands: 
A <strong>drive initialization command</strong> is a command string sent to the disk device that prepares it for access. These commands are also commonly used to select partitions, logical units (LU), users, or subdirectories depending on the device being used.
* 1541 or compatible disk drive: a simple "i0" command should suffice.  
* SFD 1001, CBM 2031, CBM 9060, CBM 9090, or other single drive devices: use the "i0" command.
* MSD-SD2, CBM 4040, CBM 8050, CBM 8250, or other dual drive devices: you can use "i0" to select drive 0, or "i1" to select drive 1.  


Some devices require more than one command. Multiple commands can be chained together using the exclamation point (<code>!</code>) character.


<strong>1571 or Compatible Disk Drives  </strong>
Since the <strong>initialize</strong> command is supported by virtually all Commodore-compatible drives, it is commonly included in initialization strings. The <code>i</code> command may also be used to change the drive number used internally by Color 64.


This disk drive can behave in 3 different ways: 1541 single drive mode, 1571 double capacity mode, or 1571 dual side mode.  If you want to use the 1571 in 1541 mode, single sided, 664 blocks per disk, then you can just use "i0" just like a 1541.  But since the 1571 is a double-sided drive, it can store 1328 blocks in one directory in 1571 mode, or 664 blocks in separate directories on each side of the disk.  I recommend the latter arrangement, since you will have twice the space in the directory (144 files on each side) and it has been found that 1571s run more reliably in this mode.  Anyway, if you want to have one directory of 144 files/1328 blocks free, use "u0>m1!i0".  If you want to have two directories of 144 files/664 blocks each, use "u0>h0!i0" for the normal side, or "u0>h1!i0" for the second side.  Also, when using a 1571 in one of these modes, make sure you have a properly formatted diskette.  If you don't already have a diskette formatted, you can use the DOS wedge in the JiffyDos, MSG EDITOR, or the BBS and enter in the same drive command followed by the command to format the disk.  Example:
For example, to select drive number 13 (such as on a CMD HD), the following command could be used:
: 1571 mode - <strong>u0>m1</strong> then <strong>n0:diskname,id </strong>
: 1541 mode side 0 - <strong>u0>h0</strong> then <strong>n0:diskname,id</strong>
: 1541 mode side 1 - <strong>u0>h1</strong> then <strong>n0:diskname,id</strong>


Note that a 1571 emulation mode partition on a CMD HD does not accept any of these commands, because it is simply a simulation of the double sided 144 files/1328 blocks mode.  Use a 1541 emulation mode partition if you need to use something as a single side 1571 disk, because a 1541 mode partition supports 1571 burst commands.
: <code>i13</code>


This updates the variable <strong>DR$</strong> so that Color 64 knows the current drive number in use.


<strong>1581 Disk Drives  </strong>
Note that if an <code>i</code> command is used in a drive initialization string, it will override the drive number (0 or 1) specified in <strong>+SETUP</strong>.


This disk drive has a few special features of its own.  This 3.5" disk drive already uses both sides of the diskette, so you do not need to concern yourself with this element.  However, the 1581 does support partitions, but it is not necessary to use this feature.  If you do not wish to use partitions, a simple "i0" command will suffice.  
Also note that the <code>i</code> command does <em>not</em> change the drive number for initialization commands used in the Bootmaker utilities (<strong>bootmaker</strong>, <strong>bm ram</strong>, and <strong>bm small</strong>).


If you do wish to use partitions on the 1581, you must follow instructions in your disk drive manual to create the partition, or you can use a 1581 utility program to create the partition for you.  The command you should use to select the partition is "i0!/!/0:PARTITION NAME".  The "i0" is to initialize the drive, the "/" is to make sure the root directory is selected, and the "/0:PARTITION NAME" is to select the partition.  You can omit the "/" that is all by itself if you wish, because the "i0" command should automatically select the root directory.  If you notice errors, though, you should put the extra command back in to ensure proper partition use.  If you need to select a partition within another partition, simply tack on another "!/0:PARTITION NAME" to the end of the init command. And finally, if you need to select the root directory, a "i0!/" command or a simple "i0" command should do the trick.
Common initialization commands:


The stock 1581 drive produced by Commodore has a few bugs in it that make it very unreliable for use on a BBS system.  If you must store anything on a 1581 drive, be sure to limit it to public messages or downloads or something that is not vital to BBS operations.  You should avoid running your overlays on a 1581 drive.  However, if you are using JiffyDos on your 1581, the original Commodore bugs should be fixed, and it should be fine to use a JiffyDos drive.  Also, a 1581 emulation mode partition on a CMD HD behaves exactly like a 1581, but without the bugs. See the CMD HD section on how to properly use a 1581 emulation mode partition.
* <strong>1541 or compatible drives</strong>  
  Use: <code>i0</code>


* <strong>SFD-1001, CBM 2031, CBM 9060, CBM 9090, or other single-drive devices</strong> 
  Use: <code>i0</code>


<strong>CMD Hard Drive and CMD RamLink </strong>
* <strong>MSD-SD2, CBM 4040, CBM 8050, CBM 8250, or other dual-drive devices</strong>
  Use <code>i0</code> for drive 0 or <code>i1</code> for drive 1.


The first thing you need to do is select the proper partition.  This is accomplished by using the "cp" and "i" commands.  For example, to select partition 2 you would use the command "cp2!i2".  This applies to ANY partition, regardless of its type.  For 1541 or 1571 emulation mode partitions on the CMD HD, no additional commands are necessary.  For 1581 emulation mode partitions, you may need to add a "/0:PARTITION NAME" command to select a 1581 style partition. 


For native mode partitions on the CMD HD, you can also use subdirectories. This is accomplished through the "cd" command.  For example, to select the subdirectory "games" in native mode partition 5, you would use "cp5!i5!cd//games".  Note you need to include the "i5" command to ensure that the BBS system knows to use drive number 5.
----


=== 1571 or Compatible Disk Drives ===


<strong>CMD FD series drives  </strong>
The Commodore 1571 can operate in three modes:


As of this writing, I have not had a chance to use one of these advanced 3.5" floppy drives.  However, since the FD drives are supposed to be compatible with standard 1581 disks, it should accept the same commands for initialization and partition selection.  See your drive manual for information on other commands.
* 1541 single-sided compatibility mode
* 1571 double-capacity mode
* 1571 dual-side mode


If operating the 1571 in standard 1541 compatibility mode (single-sided, ~664 blocks), the initialization command:


<strong>Lt. Kernal Hard Drive  </strong>
: <code>i0</code>


The Lt. Kernal HD divides its storage up into LU's (logical units) and USERs.  A logical unit can be compared to a separate partition of storage space, independent of the other LU's.  A USER can be compared to a subdirectory, sharing the common space of the LU with all the other USERs.  LU's can have a number from 0 to 9, while USERs are numbered from 0 to 15.
works the same as with a 1541 drive.


On the Lt. Kernal HD, the "l" command is used to select the LU and USER, and is in the form l<device><LU><USER>, where device is the device number of the Lt. Kernal HD (usually 8), LU is the logical unit number (0 to 9), and USER is a hexadecimal number from 0 to F (the letters A through F correspond to the numbers 10 through 15, respectively). 
However, because the 1571 is a double-sided drive, it can store:


You also need to include an "i" command to set the drive number (LU number) on the Lt. Kernal.  For example, to select LU 2, USER 11, you would use the command "l82b!i2".  To select LU 0, user 5, you would use "l805!i0".  Just remember that for the USER number, the letters A, B, C, D, E, and F are used to mean 10, 11, 12, 13, 14, and 15, respectively.  
* <strong>1328 blocks</strong> in a single directory in full 1571 mode, or
* <strong>664 blocks per side</strong> using two separate directories.


In testing with 8.1/8.1a and LT Kernal, the above is a crucial point for disk access. However, it still can get confusing.  
The second configuration is generally recommended because it provides two directories of 144 files each and has historically proven to be more reliable.


When in +SETUP, select device as “8” as specified, then on Drive Init command prompt, enter in this format (example shown: LU 2 User 2). 
Initialization commands:


{| class="wikitable
* Single directory (1328 blocks):
 
: <code>u0>m1!i0</code>
 
* Side 0 (664 blocks):
 
: <code>u0>h0!i0</code>
 
* Side 1 (664 blocks):
 
: <code>u0>h1!i0</code>
 
When using these modes, ensure the diskette is formatted properly.
 
You can format disks using the DOS wedge in JiffyDOS, the Message Editor, or from within the BBS.
 
Examples:
 
: 1571 mode 
: <code>u0>m1</code> then <code>n0:diskname,id</code>
 
: 1541 mode side 0 
: <code>u0>h0</code> then <code>n0:diskname,id</code>
 
: 1541 mode side 1 
: <code>u0>h1</code> then <code>n0:diskname,id</code>
 
Note that a <strong>1571 emulation partition</strong> on a CMD HD automatically behaves as the double-sided 1328-block format and will not accept these mode commands.
 
If you need a single-side layout, use a <strong>1541 emulation partition</strong> instead.
 
 
----
 
=== 1581 Disk Drives ===
 
The Commodore 1581 is a double-sided 3.5″ disk drive, so both disk sides are always used automatically.
 
The drive also supports <strong>partitions</strong>, although they are optional.
 
If you are not using partitions, a simple initialization command is sufficient:
 
: <code>i0</code>
 
If partitions are used, they must first be created using either:
 
* the 1581 drive utilities, or
* a partition management utility program.
 
To select a partition:
 
: <code>i0!/!/0:PARTITION NAME</code>
 
Where:
 
* <code>i0</code> initializes the drive
* <code>/</code> ensures the root directory is selected
* <code>/0:PARTITION NAME</code> selects the partition
 
The standalone <code>/</code> command can often be omitted because <code>i0</code> usually returns to the root directory automatically. If directory errors occur, restoring the extra <code>/</code> command may resolve them.
 
Nested partitions can be selected by adding additional commands:
 
: <code>!/0:PARTITION NAME</code>
 
Selecting the root directory again can be done with either:
 
: <code>i0!/</code> 
or 
: <code>i0</code>
 
The stock Commodore 1581 firmware contains several bugs that can cause reliability problems in BBS environments. For this reason, it is recommended that critical system files (such as overlays) not be stored on a stock 1581 drive.
 
If JiffyDOS is installed in the 1581, these firmware issues are corrected and the drive can be used more safely.
 
A <strong>1581 emulation partition</strong> on a CMD HD behaves exactly like a 1581 drive but without the firmware bugs.
 
 
----
 
=== CMD Hard Drive and CMD RamLink ===
 
When using CMD storage devices, the first step is selecting the appropriate partition.
 
This is done using the <code>cp</code> and <code>i</code> commands.
 
Example:
 
: <code>cp2!i2</code>
 
This selects <strong>partition 2</strong> and updates the active drive number accordingly.
 
This procedure works for all partition types.
 
For <strong>1541 or 1571 emulation partitions</strong>, no additional commands are normally required.
 
For <strong>1581 emulation partitions</strong>, you may also need to select the directory using:
 
: <code>/0:PARTITION NAME</code>
 
For <strong>native mode partitions</strong>, subdirectories can be used. These are selected with the <code>cd</code> command.
 
Example:
 
: <code>cp5!i5!cd//games</code>
 
This selects:
 
* partition 5
* drive number 5
* the <code>games</code> subdirectory
 
The <code>i5</code> portion ensures that Color 64 correctly updates its internal drive number.
 
 
----
 
=== CMD FD Series Drives ===
 
At the time of writing, the CMD FD series drives had not been fully tested with Color 64. However, because these drives are designed to be compatible with standard 1581 disks, they should accept the same initialization and partition commands used for the 1581.
 
Consult your drive manual for additional device-specific commands.
 
 
----
 
=== Lt. Kernal Hard Drive ===
 
The Lt. Kernal hard drive organizes storage into:
 
* <strong>LU (Logical Units)</strong> — comparable to partitions
* <strong>USER areas</strong> — comparable to subdirectories within an LU
 
LU numbers range from <strong>0–9</strong>. 
USER numbers range from <strong>0–15</strong> and are expressed in <strong>hexadecimal</strong>:
 
* A = 10
* B = 11
* C = 12
* D = 13
* E = 14
* F = 15
 
The Lt. Kernal command used to select LU and USER is:
 
: <code>l&lt;device&gt;&lt;LU&gt;&lt;USER&gt;</code>
 
Example:
 
To select LU 2, USER 11:
 
: <code>l82b!i2</code>
 
To select LU 0, USER 5:
 
: <code>l805!i0</code>
 
The additional <code>i</code> command is required so Color 64 updates the drive number internally.
 
Testing with Color 64 v8.1 / v8.1a confirmed that proper LU selection is essential for reliable disk access.
 
When configuring the drive in <strong>+SETUP</strong>, choose device <strong>8</strong> and enter the initialization string for the desired LU and USER.
 
Example configurations:
 
{| class="wikitable"
|-
|-
|+LT Kernal Setup Examples
|+ LT Kernal Setup Examples
|-
|-
| LU 0 / User 0
| LU 0 / USER 0
| LU 1 / User 0
| LU 1 / USER 0
|-
|-
| [[File:lu0u0.png|center|250px]]
| [[File:lu0u0.png|center|250px]]
Line 67: Line 236:
|
|
|-
|-
| LU 2 / User 3
| LU 2 / USER 3
| LU 2 / User 10
| LU 2 / USER 10
|-
|-
| [[File:lu2u3.png|center|250px]]
| [[File:lu2u3.png|center|250px]]
Line 75: Line 244:




<strong>ICT Hard Drive  </strong>
----
 
=== ICT Hard Drive ===
 
The ICT hard drive system contains both:
 
* a built-in floppy disk drive
* a hard drive partition system
 
Do <strong>not</strong> use the <code>i</code> command in ICT initialization strings, as this can confuse the device.
 
Instead, configure the drive number as <strong>0</strong> in <strong>+SETUP</strong>.
 
Common commands:
 
* <code>h0</code> — Select built-in floppy drive
* <code>hN</code> — Select hard drive partition N
 
Example:
 
: <code>h2</code> selects partition 2.
 
The command:
 
: <code>hm4</code>
 
enables partition chaining.
 
Example:
 
: <code>hm4 5 7</code>
 
chains partitions 5 through 7 together.
 
If partition chaining is used, special ICT merges must be installed in the BBS. See the section covering ICT HD integration with Color 64 for additional details.
 


The ICT HD has two parts, the built-in floppy disk drive, and a hard drive. You should not use the "i" command in the init commands for an ICT HD, because this could confuse the HD.  Rather, set the drive number to 0 in allcases in SETUP.  Here is a summary of commands: "h0" selects the built-in floppy drive.  "h" followed by a number greater than 0 will select the appropriate HD partition.  For example, "h2" will select partition 2.  The "hm4" command is the partition chain command.  For example, to chain partitions 5 to 7, you would use "hm4 5 7".  If you are going to use partition chains, you must have the special ICT merges installed in your BBS.  See the section on the using the ICT HD with Color 64 for more information.
----


=== Ram Expansion Unit (REU) ===


<strong>Ram Expansion Unit  </strong>
Although the Commodore 17xx series REU is not technically a disk device, it can emulate disk-like behavior for storage purposes.


Although the 17XX series REU is not a true disk device, it nevertheless simulates the operation of a disk device.  A simple "i0" command should be fine.
A simple initialization command is usually sufficient:


: <code>i0</code>
Next Section: [[programming how to|Programming How-to]]  
Next Section: [[programming how to|Programming How-to]]  


[[programming features|Programming Features]]
[[programming features|Programming Features]]

Latest revision as of 16:36, 7 March 2026

Programming Features - Drive Initialization Commands

Drive Initialization Commands Overview

This section summarizes drive initialization commands that work well with a variety of Commodore-compatible storage devices.

A drive initialization command is a command string sent to the disk device that prepares it for access. These commands are also commonly used to select partitions, logical units (LU), users, or subdirectories depending on the device being used.

Some devices require more than one command. Multiple commands can be chained together using the exclamation point (!) character.

Since the initialize command is supported by virtually all Commodore-compatible drives, it is commonly included in initialization strings. The i command may also be used to change the drive number used internally by Color 64.

For example, to select drive number 13 (such as on a CMD HD), the following command could be used:

i13

This updates the variable DR$ so that Color 64 knows the current drive number in use.

Note that if an i command is used in a drive initialization string, it will override the drive number (0 or 1) specified in +SETUP.

Also note that the i command does not change the drive number for initialization commands used in the Bootmaker utilities (bootmaker, bm ram, and bm small).

Common initialization commands:

  • 1541 or compatible drives
 Use: i0
  • SFD-1001, CBM 2031, CBM 9060, CBM 9090, or other single-drive devices
 Use: i0
  • MSD-SD2, CBM 4040, CBM 8050, CBM 8250, or other dual-drive devices
 Use i0 for drive 0 or i1 for drive 1.



1571 or Compatible Disk Drives

The Commodore 1571 can operate in three modes:

  • 1541 single-sided compatibility mode
  • 1571 double-capacity mode
  • 1571 dual-side mode

If operating the 1571 in standard 1541 compatibility mode (single-sided, ~664 blocks), the initialization command:

i0

works the same as with a 1541 drive.

However, because the 1571 is a double-sided drive, it can store:

  • 1328 blocks in a single directory in full 1571 mode, or
  • 664 blocks per side using two separate directories.

The second configuration is generally recommended because it provides two directories of 144 files each and has historically proven to be more reliable.

Initialization commands:

  • Single directory (1328 blocks):
u0>m1!i0
  • Side 0 (664 blocks):
u0>h0!i0
  • Side 1 (664 blocks):
u0>h1!i0

When using these modes, ensure the diskette is formatted properly.

You can format disks using the DOS wedge in JiffyDOS, the Message Editor, or from within the BBS.

Examples:

1571 mode
u0>m1 then n0:diskname,id
1541 mode side 0
u0>h0 then n0:diskname,id
1541 mode side 1
u0>h1 then n0:diskname,id

Note that a 1571 emulation partition on a CMD HD automatically behaves as the double-sided 1328-block format and will not accept these mode commands.

If you need a single-side layout, use a 1541 emulation partition instead.



1581 Disk Drives

The Commodore 1581 is a double-sided 3.5″ disk drive, so both disk sides are always used automatically.

The drive also supports partitions, although they are optional.

If you are not using partitions, a simple initialization command is sufficient:

i0

If partitions are used, they must first be created using either:

  • the 1581 drive utilities, or
  • a partition management utility program.

To select a partition:

i0!/!/0:PARTITION NAME

Where:

  • i0 initializes the drive
  • / ensures the root directory is selected
  • /0:PARTITION NAME selects the partition

The standalone / command can often be omitted because i0 usually returns to the root directory automatically. If directory errors occur, restoring the extra / command may resolve them.

Nested partitions can be selected by adding additional commands:

!/0:PARTITION NAME

Selecting the root directory again can be done with either:

i0!/

or

i0

The stock Commodore 1581 firmware contains several bugs that can cause reliability problems in BBS environments. For this reason, it is recommended that critical system files (such as overlays) not be stored on a stock 1581 drive.

If JiffyDOS is installed in the 1581, these firmware issues are corrected and the drive can be used more safely.

A 1581 emulation partition on a CMD HD behaves exactly like a 1581 drive but without the firmware bugs.



CMD Hard Drive and CMD RamLink

When using CMD storage devices, the first step is selecting the appropriate partition.

This is done using the cp and i commands.

Example:

cp2!i2

This selects partition 2 and updates the active drive number accordingly.

This procedure works for all partition types.

For 1541 or 1571 emulation partitions, no additional commands are normally required.

For 1581 emulation partitions, you may also need to select the directory using:

/0:PARTITION NAME

For native mode partitions, subdirectories can be used. These are selected with the cd command.

Example:

cp5!i5!cd//games

This selects:

  • partition 5
  • drive number 5
  • the games subdirectory

The i5 portion ensures that Color 64 correctly updates its internal drive number.



CMD FD Series Drives

At the time of writing, the CMD FD series drives had not been fully tested with Color 64. However, because these drives are designed to be compatible with standard 1581 disks, they should accept the same initialization and partition commands used for the 1581.

Consult your drive manual for additional device-specific commands.



Lt. Kernal Hard Drive

The Lt. Kernal hard drive organizes storage into:

  • LU (Logical Units) — comparable to partitions
  • USER areas — comparable to subdirectories within an LU

LU numbers range from 0–9. USER numbers range from 0–15 and are expressed in hexadecimal:

  • A = 10
  • B = 11
  • C = 12
  • D = 13
  • E = 14
  • F = 15

The Lt. Kernal command used to select LU and USER is:

l<device><LU><USER>

Example:

To select LU 2, USER 11:

l82b!i2

To select LU 0, USER 5:

l805!i0

The additional i command is required so Color 64 updates the drive number internally.

Testing with Color 64 v8.1 / v8.1a confirmed that proper LU selection is essential for reliable disk access.

When configuring the drive in +SETUP, choose device 8 and enter the initialization string for the desired LU and USER.

Example configurations:

LT Kernal Setup Examples
LU 0 / USER 0 LU 1 / USER 0
LU 2 / USER 3 LU 2 / USER 10



ICT Hard Drive

The ICT hard drive system contains both:

  • a built-in floppy disk drive
  • a hard drive partition system

Do not use the i command in ICT initialization strings, as this can confuse the device.

Instead, configure the drive number as 0 in +SETUP.

Common commands:

  • h0 — Select built-in floppy drive
  • hN — Select hard drive partition N

Example:

h2 selects partition 2.

The command:

hm4

enables partition chaining.

Example:

hm4 5 7

chains partitions 5 through 7 together.

If partition chaining is used, special ICT merges must be installed in the BBS. See the section covering ICT HD integration with Color 64 for additional details.



Ram Expansion Unit (REU)

Although the Commodore 17xx series REU is not technically a disk device, it can emulate disk-like behavior for storage purposes.

A simple initialization command is usually sufficient:

i0

Next Section: Programming How-to

Programming Features