The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: Gunther on September 06, 2010, 11:49:15 PM

Title: Starting DOS from USB drive
Post by: Gunther on September 06, 2010, 11:49:15 PM
I've searched inside the forum and found no answer. So here is my - probably a bit silly - question. Has anyone experiences with starting a native DOS (MSDOS, PCDOS, DRDOS or whatever) at a machine without floppy disk drive. I suppose it should be possible from an USB stick - but how?

What's the background of my question? Several years ago, I've fired up a 16 bit PowerBASIC application into 32 bit Protected Mode. All the authorities, including Bob Zale and Dave Navarro, did say: that's not possible. In fact. it was a bit tricky, but it did work without crash under several operating systems.

My plan is now, to screw up a DOS application into 64 bit long mode. Therefore, I need a plain DOS; emulations will not help, because one hasn't direct access to the hardware.

Gunther
Title: Re: Starting DOS from USB drive
Post by: japheth on September 07, 2010, 06:53:37 AM
There's a free tool from HP, called DriveKey. It is meant to be used with HP hardware, but works with most (all?) other PCs as well. It will format the USB stick as a Hard Drive, so it contains a MBR.

I have no link available, but should be no problem to find it.

Btw, here's a sample how to switch to long-mode from DOS and back: http://www.japheth.de/JWasm/Dos64.html

Title: Re: Starting DOS from USB drive
Post by: redskull on September 07, 2010, 11:46:59 AM
If you can find/make a floppy image of a DOS boot disk, you can use a standard hex editor to copy it right to the USB stick, starting at sector 0.  Of course, your BIOS must support legacy USB emulation and booting for it to work.

-r
Title: Re: Starting DOS from USB drive
Post by: Gunther on September 07, 2010, 12:44:36 PM
Quote from: redskull September 07, 2010, at 12:46:59 PMOf course, your BIOS must support legacy USB emulation and booting for it to work.

Yes, my BIOS allows booting from USB drive.

Quote from: japheth September 07, 2010, at 07:53:37 AMBtw, here's a sample how to switch to long-mode from DOS and back:

:8) Well done. It seems, that JWasm is a cool tool. Thank you for the hint.

Gunther
Title: Re: Starting DOS from USB drive
Post by: daydreamer on September 07, 2010, 02:24:21 PM
I dont remember exactly what tool I used to make myself a win98(dos) startdisk copy on usb working, but first it was required to partition the drive to a small startpartition with the right tool it makes it also writes bootsector and you only need to copy some old dos files on it and it starts as A: drive
I did it with my old 128mb flash drive, think I had to make a 2mb partition for it
good luck
Title: Re: Starting DOS from USB drive
Post by: anunitu on September 07, 2010, 03:29:24 PM
I know that FreeDos has a bootable cd image you can get, and I think they "Might" have something for booting from USB stick,not sure.

There is this.

http://download.cnet.com/DOS-on-USB/3000-2094_4-10795476.html

Also this.

http://genetikayos.livejournal.com/43998.html

Haven't tried this,as my older system won't boot from USB
Title: Re: Starting DOS from USB drive
Post by: TASMUser on September 08, 2010, 10:29:25 PM
What you need:
- Any bootable DOS media
- A motherboard with a BIOS which supports "legacy USB" properly (newest BIOSes should do)
- A drive where you can insert the DOS bootable media
- A compatible card reader
- Partitioning software like "Partition Magic" for DOS

How to install the DOS on USB (it is a way I do for almost 20 years):

- Allow "legacy USB support" for all drives in the BIOS
- Put the DOS bootable media in the boot drive
- Switch off the computer
- Insert the card into the cardreader
- plug the cardreader into any USB connector
- Switch on the computer
- Let the computer boot from the DOS bootable media, the computer should recognize all cards
- Partition the card as you wish
- Reboot with same conditions
- Invoke the "sys" command to the USB card
Title: Re: Starting DOS from USB drive
Post by: Gunther on September 08, 2010, 11:26:19 PM
Okay, thank you guys for your hints. I'll check that out and let you know, if I had success.

Gunther
Title: Re: Starting DOS from USB drive
Post by: Farabi on September 09, 2010, 01:01:00 PM
Is all kernel loaded at 0x7C0000? I want to load a linux kernel.
Title: Re: Starting DOS from USB drive
Post by: Tedd on September 09, 2010, 04:10:41 PM
BIOS loads the boot program (from the first sector) to 0x7C00 and jumps to it.
Beyond that, depends what the boot program does.

Usually, it's several more stages before the kernel gets loaded properely.
Title: Re: Starting DOS from USB drive
Post by: redskull on September 09, 2010, 05:01:52 PM
Does set CS to 7C00 and load it at CS:0000, or keep CS at 0000 and load it to CS:7C00?  I can never remember...

-r
Title: Re: Starting DOS from USB drive
Post by: FORTRANS on September 09, 2010, 05:29:48 PM
Quote from: redskull on September 09, 2010, 05:01:52 PM
Does set CS to 7C00 and load it at CS:0000, or keep CS at 0000 and load it to CS:7C00?  I can never remember...

Hi,

   It can be either 07C0:0000 or 0000:7C00 depending on
the BIOS in use.  0000:7C00 is more common.

Regards,

Steve N.
Title: Re: Starting DOS from USB drive
Post by: Tedd on September 10, 2010, 01:56:33 PM
It could technically be any of the many combinations that result in the linear address of 0x7C00, but 07C0:0000 and 0000:7C00 are most common.
The only safe thing to do is start with an immediate far jump to whichever you prefer (plus destination offset) -- 07C0:0000 is nicer because it gives you origin 0.
Title: Re: Starting DOS from USB drive
Post by: Gunther on September 20, 2010, 12:30:57 PM
Problem solved. DOS starts now from USB drive. If anyone is interested, how to do that, please check out the following link: http://bootdisk.com/pendrive.htm It works.

The only problem is: My mouse isn't supported, because it's an USB mouse. I've to search for a solution.

Gunther
Title: Re: Starting DOS from USB drive
Post by: sinsi on September 20, 2010, 12:36:32 PM
There is a settting in the BIOS for legacy USB for the mouse and keyboard, enable it and they should both show up as PS/2 devices.
Title: Re: Starting DOS from USB drive
Post by: Gunther on September 20, 2010, 06:36:50 PM
Quote from: sinsi, September 20, 2010, at 01:36:32 PMThere is a settting in the BIOS for legacy USB for the mouse and keyboard, enable it and they should both show up as PS/2 devices.

Yes, I know. It's enabled and the mouse pointer doesn't react.

Gunther
Title: Re: Starting DOS from USB drive
Post by: Gunther on September 20, 2010, 11:28:22 PM
Hallo japheth,

QuoteBtw, here's a sample how to switch to long-mode from DOS and back: http://www.japheth.de/JWasm/Dos64.html

Btw, the program prints out on my DOS: Hello 64bit and hangs. There's something wrong.

Gunther
Title: Re: Starting DOS from USB drive
Post by: japheth on September 21, 2010, 05:57:21 AM
Quote from: Gunther on September 20, 2010, 11:28:22 PM
Btw, the program prints out on my DOS: Hello 64bit and hangs. There's something wrong.

Are you sure it "hangs"? Because, it is supposed to wait in long mode for a key press. ESC will/should return to DOS, 'r' displays some register contents. Keyboard polling is done at the port level, so you'll have to have a standard keyboard - or a USB one in legacy mode - attached.
Title: Re: Starting DOS from USB drive
Post by: Gunther on September 22, 2010, 01:11:01 AM
Quote from: japheth, September 21, 2010, 06:57:21 amAre you sure it "hangs"? Because, it is supposed to wait in long mode for a key press. ESC will/should return to DOS, 'r' displays some register contents. Keyboard polling is done at the port level, so you'll have to have a standard keyboard - or a USB one in legacy mode - attached.

It seems that this is the problem with my old Siemens notebook (BIOS to old). With the newer Toshiba notebook, the application does the job properly.

Gunther