Diskemu - CD-Rom Disk Emulator
Diskem1x.bin - CD-Rom multiboot loader and disk emulator
Eltorito.sys - Hardware independent Dos CD-Rom driver...
Current version: Diskem1x.bin v1.1 BETA (11/07/01) * / Eltorito.sys v1.x
Last updated on Jul 10, 2002
| Notice! |
* Development on diskem1x.bin has stopped!
I'm leaving the diskemu page as it is, for reference...
|
Some history
Diskemu.bin, eltorito.sys and demumgr.com where originally developed by Gary Tong.
From May 5, 2001 the development is done by
Bart Lagerweij.
In fact, Gary first wrote eltorito.sys (a special Dos CD-Rom driver),
to overcome "reset" troubles that appeared on a lot of systems
using hardware based CD-Rom drivers on bootable CD-Roms.
They tend to some how "reset"
the CD-Rom drive while initalizing, and would cause I/O errors in Dos.
To use eltorito.sys, the CD was booted in el-torito floppy emulation mode and
a floppy image was used that loaded eltorito.sys in config.sys
(as any CD-Rom driver).
Eltorito.sys uses INT13/42 extended BIOS calls to read blocks from the CD.
So eltorito.sys was used without diskemu.bin at first.
...But there was a problem...
Unfortunately, on some CD-Rom drives the extended BIOS calls used by
eltorito.sys to read a CD-Rom, which had been booted in El-Torito floppy
emulation mode, could not read any portion of the CD outside the boot floppy
image.
Gary found the following solution:
-
Boot the CD-Rom in El-Torito no-emulation mode. This allows us to read the
entire CD using extended BIOS calls, on all systems.
-
Load and run a program, called diskemu.bin, that has a floppy disk emulator
build-in. The disk emulator uses a small piece of conventional memory just
below 640KB and lowers the amount of conventional memory.
-
Have this program locate the boot image on CD, emulate it as drive A: and boot it. Later
versions had a multiboot menu (max. 20 choices) build in to select the boot
image of your choice.
-
This Dos boot image loads the eltorito.sys CD-Rom driver and Dos CD-Rom
extensions (mscdex.exe) to access the CD.
-
When no more files from the emulated floppy are needed, I strongly advice
you to "unload" the emulator from memory. This is to remove the
danger of some program overwriting the emulator code sitting just below
640KB, or hooking the int13h vector.
The first diskemu.bin version from Gary used the boot catalog to store the image
locations that should be loaded by the multiboot loader.
To fill the boot catalog,
mkbootcd.exe was used.
This worked OK, but the behaviour was different on some systems.
Also the boot catalog was limiting Gary to store additional information such
as: color values, timeout, default action and other things.
...Diskem1x.bin...
When
Bart took over the development a new diskemu version known
as diskem1x.bin, was created. The changes that have been made are below.
- No image locations are stored in the boot catalog. So mkbootcd.exe is
not needed anymore, this makes building and burning a CD more easier.
- ISO9660 filesystem support, you can navigate through the cd using
"cd" and "dir" commands.
- It uses a simple batch/style language to perform actions like, clear the
screen, print something, wait for keypress, run a image from CD, and many
more...
- You can build your own custom bootmenu for quick access of bootimages
(see diskemu.cmd file).
- A command prompt to enter commands or to load something not in the menu.
- Autodetection of floppy image type.
Supported: 160KB, 180KB, 320KB, 360KB, 1.2MB, 720KB, 820KB,
1.44MB, 1.68MB, 1.72MB, 2.88MB
- Using a bootable Diskemu 1.x CD-Rom, you can even boot images from
"non-bootable" CD-Roms, just swap the CD, type "cd \"
and you can use that CD. (Cool!)
- It uses a separate loader (loader.bin), which will load diskem1x.bin
correctly even if you have very bad El-Torito support in your
BIOS.
How diskem1x.bin works (technical)
The loader (loader.bin) is the Default Boot Entry in a bootable CD-Rom Boot
Catalog. This will load loader.bin into the default load address (0:7c00h).
The first thing loader.bin does is move itself out of the way to address
5000:0h.
Loader.bin searches the root of the CD to locate diskem1x.bin. When found
diskem1x.bin is loaded into the default load address (0:7c00h). The first
thing diskem1x.bin does (also) is move itself out of the way to address
5000:0h.
Diskem1x.bin searches the root of the CD to locate a command file called
diskemu.cmd. When found it is run as if it was run using the "batch" command.
When diskemu.cmd is not found, or the shift key is pressed while
diskem1x.bin was loading, diskem1x.bin presents a command prompt.
To see a list of commands type "help". To see more help on a
specific command type "help <command>".
You can start floppy emulation or chain-load some other loader or image
using the "run" command.
Diskem1x commands
All supported diskem1x command are listed below, click on it for more information.
/* todo: check commands and add more examples */
batch
Syntax: batch <filename> [<label>]
Run commands in batchfile <filename> starting at <label>
Labels are defined as ":Label"
Comment lines start with a ";"
Example:
Lets assume you have this file called "DE.CMD":
; de.cmd example file
print 123
:four
print 456
; eof de.cmd
|
The command "batch de.cmd" would return:
The command "batch de.cmd four" would return:
boot
Syntax: boot <#drvnum>
Boot from drive number <#drvnum> (in hex)
Example:
| Command | Description |
| boot 0 | Boot from drive 0 (A:) |
| boot 80 | Boot from harddisk (C:) |
bootinfotable
Syntax: bootinfotable
Modify the boot file by inserting a 56-byte "boot information table" at
offset 8 in the file. The same ways as mkisofs does, see mkisofs manpage for
more info. Only for "no-emulation" images.
Information table:
| Offset | Size | Meaning |
| 8 | 4 bytes | LBA of primary volume descriptor |
| 12 | 4 bytes | LBA of boot file |
| 16 | 4 bytes | Boot file length in bytes |
| 20 | 4 bytes | 32-bit checksum |
| 24 | 40 bytes | Reserved |
cd
Syntax: cd <path>
Changes the current directory to
.
Example:
| Command | Description |
| cd bin | Goes to the "bin" directory |
| cd \ | Goes back to the root directory |
cls
Syntax: cls (or clear)
Clears the screen and homes the cursor.
dir
Syntax: dir (or ls)
Displays a list of files and subdirectories in a directory
echo
Syntax: echo [on/off]
Turn command echoing on/off
emusegm
Syntax: emusegm <xxxx>
Set the location for the emulator to <xxxx> (hex)
Example:
| Command | Description |
| Emusegm 8500 | Emulator goes at 8500h:0000h |
getkey
Syntax: getkey [<timeout> <key>]
Wait until a key is pressed. When <timeout> seconds have passed and no
key was pressed, the key is returned by getkey command.
Possible values for <key> are:
- single character ascii values, like: a, 1 or !
- Key "tags":
| tag | key |
| esc | escape |
| bs | backspace |
| tab | tab |
| entr | Enter |
| spc | spacebar |
| home | home |
| up | cursor up |
| left | cursor left |
| pgup | page up |
| right | cursor right |
| end | end |
| down | cursor down |
| pgdn | page down |
| ins | insert |
| del | delete |
| f1 | f1 |
| f2 | f2 |
| f3 | f3 |
| f4 | f4 |
| f5 | f5 |
| f6 | f6 |
| f7 | f7 |
| f8 | f8 |
| f9 | f9 |
| f10 | f10 |
| f11 | f11 |
| f12 | f12 |
| sf1 | shift f1 |
| sf2 | shift f2 |
| sf3 | shift f3 |
| sf4 | shift f4 |
| sf5 | shift f5 |
| sf6 | shift f6 |
| sf7 | shift f7 |
| sf8 | shift f8 |
| sf9 | shift f9 |
| sf10 | shift f10 |
| sf11 | shift f11 |
| sf12 | shift f12 |
| af1 | alt f1 |
| af2 | alt f2 |
| af3 | alt f3 |
| af4 | alt f4 |
| af5 | alt f5 |
| af6 | alt f6 |
| af7 | alt f7 |
| af8 | alt f8 |
| af9 | alt f9 |
| af10 | alt f10 |
| af11 | alt f11 |
| af12 | alt f12 |
- custom keyvalue (16-bit) in hex (scancode/ascii), like: 0x011b
Example:
| Command | Description |
| getkey 10 esc | 10 sec. timeout with Escape key |
| getkey | wait for keypress |
goto
Syntax: goto <label>
Lets assume you have this file called "DE.CMD":
; de.cmd example file
:start
print 123
goto start
|
This batch file would loop forever (useless example!)
help
Syntax: help <command> (or ?)
Displays help about <command>
keyval
Syntax: keyval
Prints the (hex) value of the last getkey
loadsegm
Syntax: loadsegm <xxxx>
Set the load segment to <xxxx> (hex)
Example:
| Command | Description |
| loadsegm 2000 | Load the image at 2000h:0000h |
onkey
Syntax: onkey <key> <command>
Checks if <key> has been pressed. If so <command> is executed.
print
Syntax: print <message>
Prints the string <message> to the screen at current cursor position.
Example:
| Command | Description |
| print Testing | Prints "Testing" to the screen |
| print | Prints a "blank" line |
quit
Syntax: quit
When in a batchfile, stops batch processing.
readtest
Syntax: readtest
Tests the CD by reading all blocks in the volume
reboot
Syntax: reboot
Reboots the system (warmboot)
run
Syntax: run <file>
Runs (emulates) an image.
Example:
| Command | Description |
| run elboot.img | Emulates a floppy image and boot it |
| run w2ksect.dat | Load "w2ksect.dat" and run it |
test
Syntax: test
This command is for development only
It is used for testing new commands...
Do not use it!
type
Syntax: type (or cat) <file>
Displays the contents of text files.
Example:
| Command | Description |
| type readme.txt | Displays the content of readme.txt file |
ver
Syntax: ver
Displays the diskem1x.bin version
How to create a diskemu v1.x bootable CD
If you have not already setup cdrpack version 1.3 then download cdrpack v1.3 (624KB).
This file contains a workspace where you can build your bootable CD's from.
Unpack the cdrpack13.zip file to a directory on your local harddisk.
Make sure you expand the subdirectories! So when using pkunzip.exe use the -d option!
If you have not already setup diskemu add-on, version 1.1 (11/07/01) then download diskemu add-on (11KB).
Unpack the diskemu_addon.zip file into the same directory as cdrpack 1.3.
Make sure you expand the subdirectories! So when using pkunzip.exe use the -d option!
You can now customize your diskemu.cmd file and add your own files and
floppy images to the "cds\diskemu\disk1" folder.
Little hint: add an elboot floppy image!
Start the batch file "run.bat". It does a file and ASPI32 check
and if OK, shows a list of devices. Select your CDR(W) drive from the
list.
In the next windows enter the device speed.
From the "Main menu" select "Build & Burn". The rest is simple.
Download complete package
To download the complete diskemu package (include text files) click
diskem1x.zip (22KB) HERE!
Known problems and bugs
Todo list
Here's a quick list of things I'm planning to add to diskem1x in time...
- Detect if first harddisk "looks" bootable.
- Let diskem1x write directly to screen memory.
- Add color.
- Keyboard mapping (to support azerty and other keyboards).
- Floppy image hot-swap?
- Load COM files (the COM file must not use Dos functions).