Thread: bootable floppy

  1. #1
    Registered User Robert_Ingleby's Avatar
    Join Date
    Oct 2001
    Posts
    57

    bootable floppy

    I have a bootable floppy (io.sys, msdos.sys & command.com) that also contains an exe file.

    How can I make the EXE file run straight away without the need to type in its filename?

  2. #2
    Unregistered
    Guest
    Name it Command.com

  3. #3
    Unregistered
    Guest
    or Put it in the Autoexec.bat
    You know Batch?

  4. #4
    Registered User Robert_Ingleby's Avatar
    Join Date
    Oct 2001
    Posts
    57

    Dont be stupid

    How the hell will command.com work if I rename my EXE file command.com?

    Wally.

  5. #5
    Unregistered
    Guest
    It wont. I thoughjt you ment getting an EXE to work , without using autoexec.bat. Just add a line in the autoexec.bat. It ya dont know what that is , I suggest you learn DOS first.

  6. #6
    Unregistered
    Guest
    By adding up your posts for today it sems to me that you are trying to make a boot floppy that formats the hdd without any user interaction, but your not that kinda guy..right?

  7. #7
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    To do that you would have to do several things. First you would have to patch the boot sector to both load and then jump to the EXE. Or you could patch the bootsector code and add code to the end of it (if there is space) that would jump to another sector of the disk, load your code, and then have that code load the EXE.

    To run the EXE, you first have to know how to read FAT12. You need to look in the FAT first to find out the starting cluster of the EXE. Then you read in clusters via int 13h until you reach the last cluster in file mark or EOF. EXEs are relocatable code. This means you have to read in the data header for an EXE, look at the relocation table entry and relocate the code. Relocations make sure that the variable offsets within the code actualy point to the correct area of memory. You can look up more information on the EXE file header. It would be easier to load a COM since they are straight binaries and always start at 0100h into the load segment. You would only have to switch the stack, push some values to change the DS, CS registers and then execute a FAR return which would jump to the code and thus execute your COM.
    EXEs are a bit different since they can have multiple segments - as many as memory will allow. So you cannot just jump to the byte immediately following the header. As you load the code, you must relocate it. I do have code that does this, but you are talking about pure assembly language here. So, if you do not know assembly language, you are pretty much out of luck.

    The bootsector is 512 bytes long and resides at sector 1 on every disk. The actual bootstrap code start immediately after the BPB and DOS header stuff. The bootstrap code is 449 bytes long and the sector ends with 55 AA or 0AA55h. This tells the BIOS that this disk is bootable - called the boot signature.

    I have code that will boot the machine, although it does little else, as well as code in C that will patch the boot sector with a new bootstrap and new header info. The code will also save the bootsector to disk as a bin file for backup purposes.

    Let me know if you still wish to pursue this and I'll be much more straightforward with the information.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. floppy eraser error catching!
    By mabufo in forum C++ Programming
    Replies: 7
    Last Post: 01-23-2005, 02:06 PM
  2. Bootable floppy
    By Guti14 in forum Tech Board
    Replies: 1
    Last Post: 09-02-2004, 06:30 AM
  3. making a proper image for floppy
    By EvBladeRunnervE in forum Tech Board
    Replies: 4
    Last Post: 07-31-2004, 11:27 PM
  4. selecting input from a floppy
    By neilman88 in forum C++ Programming
    Replies: 1
    Last Post: 04-17-2003, 02:26 PM
  5. floppy drives...
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 39
    Last Post: 11-16-2001, 06:49 PM