Boot Record File Loader

Thought I would like to share this boot-record code with you. Wrote it last year for a project requiring running a program without an OS. If you are interested please give your email address and I will send it as an attachment.

The BR is written for 1.44MB diskettes only.
The BR code is designed to load/execute a DOS EXE or COM program written of course without using DOS function calls or PSP data. Using only ROM BIOS calls or direct hardware control.
The floppy can be used as normal and is fully compatible with DOS/Windows for holding files/directories, ie the parameter header is preserved for the 1.44MB floppy.

It's run sequence is:-

Displays a Logo on screen.
Creates a 'dummy' PSP just after the BIOS RAM area, normally empty (but see later).
Searches the root directory of the floppy for a (the first) file of any name with a RUN extension. This is the EXE or COM file renamed.
Scans the FAT and compiles a (de)fragmentation table since the diskette may have been well used.
Loads in the file according to the table (it can be 100% fragmented).
If it is an EXE file (starts with MZ)...
Fixes all addresses from the header.
Moves the image to the PSP.
Sets CS,DS,ES,SS,SP,IP from the header and transfers control.
It ignores loading sizes and loads the whole file into memory.
If it is a COM file (Binary image)...
Sets CS,DS,ES,SS to start of PSP.
Sets SP to 100H (This allows the file to be larger than 64kB, using the
'dummy' PSP for the stack).
Sets the IP to 100H and transfers control.

In addition:-

If any problem reading the diskette (5 re-tries) it returns an error code and message.
If no RUN file can be found it returns an error code and message.
If insufficient memory to load the complete file (including the header of the EXE) it returns an error code and message. (Note the memory available will be 640kB less 1.5kB less any BIOS RAM extension).
If an EXE header is greater than 64kB (highly unlikely) again a different error code is displayed with message.

Not bad for 512 bytes, but that is what it's all about here!
I may give the source code if I find enough interest. This will enable changes to (my) Logo but credit where credit due I would expect this NOT to be changed. However such things as the extension (RUN) can be changed etc if need be.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!