Home
Data Recovery Software
Easy to use - Free Demo & Support
After format, fdisk, system crash
Sponsored link: from ALWIL Software: avast! BART CD 2.0
HOME dot BOOTCD dot SCSI dot UTILITIES dot BOOT DISK dot MULTIMEDIA dot LINKS dot HOWTO'S dot OTHER dot ABOUT dot FORUM

Print Sponsor Nu2 Search Nu2 About Bart Help or thank Bart Contact Bart



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!

You can go two ways:
  1. http://www.bootscriptor.org/. Boot Scriptor is created by Michael K. Ter Louw.
  2. Multiple boot images (isolinux/memdisk).
The (new) eltorito.sys cdrom driver is compatible with isolinux and boot scriptor.


I'm leaving the diskemu page as it is, for reference...




» Some history
» How diskem1x.bin works (technical)
» Diskem1x commands
» How to create a diskemu v1.x bootable CD
» Download complete package
» Known problems and bugs
» Todo list

 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:
  1. 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.

  2. 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.

  3. 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.

  4. This Dos boot image loads the eltorito.sys CD-Rom driver and Dos CD-Rom extensions (mscdex.exe) to access the CD.

  5. 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.

 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
boot
bootinfotable
cd
cls
dir
echo
emusegm
getkey
goto
help
keyval
loadsegm
onkey
print
quit
readtest
reboot
run
test
type
ver

 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:
  123
  456

The command "batch de.cmd four" would return:
  456

 boot


Syntax: boot <#drvnum>

Boot from drive number <#drvnum> (in hex)
Example:
CommandDescription
boot 0Boot from drive 0 (A:)
boot 80Boot 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:
OffsetSizeMeaning
84 bytesLBA of primary volume descriptor
124 bytesLBA of boot file
164 bytesBoot file length in bytes
204 bytes32-bit checksum
2440 bytesReserved

 cd


Syntax: cd <path>

Changes the current directory to .

Example:
CommandDescription
cd binGoes 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:
CommandDescription
Emusegm 8500Emulator 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:
  1. single character ascii values, like: a, 1 or !
  2. Key "tags":
    tagkey
    escescape
    bsbackspace
    tabtab
    entrEnter
    spcspacebar
    homehome
    upcursor up
    leftcursor left
    pguppage up
    rightcursor right
    endend
    downcursor down
    pgdnpage down
    insinsert
    deldelete
    f1f1
    f2f2
    f3f3
    f4f4
    f5f5
    f6f6
    f7f7
    f8f8
    f9f9
    f10f10
    f11f11
    f12f12
    sf1shift f1
    sf2shift f2
    sf3shift f3
    sf4shift f4
    sf5shift f5
    sf6shift f6
    sf7shift f7
    sf8shift f8
    sf9shift f9
    sf10shift f10
    sf11shift f11
    sf12shift f12
    af1alt f1
    af2alt f2
    af3alt f3
    af4alt f4
    af5alt f5
    af6alt f6
    af7alt f7
    af8alt f8
    af9alt f9
    af10alt f10
    af11alt f11
    af12alt f12
  3. custom keyvalue (16-bit) in hex (scancode/ascii), like: 0x011b

Example:
CommandDescription
getkey 10 esc10 sec. timeout with Escape key
getkeywait 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:
CommandDescription
loadsegm 2000Load 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:
CommandDescription
print TestingPrints "Testing" to the screen
printPrints 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:
CommandDescription
run elboot.imgEmulates a floppy image and boot it
run w2ksect.datLoad "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:
CommandDescription
type readme.txtDisplays 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


  • On an adaptec aha2940 firmware version 1.23 the following message appears:
    CD-ROM Loader v1.0 Beta xx/xx/xx ....
    
    INT13/42h Read Error (AX=100, DL=00) Block=00000010
    Error loading image: DISKEM1X.BIN
    

    This is a bug in the adaptec firmware, also NT4 and W2K installation/setup CD does not boot on this host adapter.
    Version 1.25 and higher should support "no emulation" mode as normal.

    (thanks to Chris Geyer - Computer & SERVICE for finding out for me)

  • Floppy emulation "hangs" or gives disk I/O errors when floppy image is locatied > 400MB on the CD.
    Has been fixed on Jul 6, 2001
    Got any version before this date, please download it again.
  • In a Windows 98 bootimage fdisk does not work on some systems ?!? (Use aefdisk)
  • "cd \" in a batchfile, quits the batch execution.
  • Floppy drive shifting does not work on all systems.

 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).


Use information from this site elsewhere? Check our legal information page!
Legal information - [2015-09-08]

Copyright (c) 2000-2015 by Bart Lagerweij. All rights reserved.