VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

I know that the CPU needs at least something there in order to no crash when starting the boot of a floppy disk.

Is it legal to actually copy the MS-DOS 5.0 boot sector code there when generating the disk image? Or is this boot sector program also copyrighted (so essentially any formatted disk sharing with another person who hasn't bought MS-DOS 5.0 is illegal)?

I currently have the boot sector code from http://thestarman.pcministry.com/asm/mbr/DOS50FDB.htm copied in my emulator, but still disabled (using a simple int 18h jmp $-2 instruction instead(it is in the wrong place in the last release, crashing the emulator using it, executing data/0 values)).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 13, by Zup

User metadata
Rank Oldbie
Rank
Oldbie

I guess it is copyrighted, but loosely enforced.

Although sharing physical diskettes with that code was not pursued, I guess that if Novell (or whoever owned Dr. DOS at that time) put that code into their diskettes or format program, Microsoft would have sent some lawyers against them.

So, to be sure, you should use free code... maybe a boot sector from linux or FreeDOS?

I have traveled across the universe and through the years to find Her.
Sometimes going all the way is just a start...

I'm selling some stuff!

Reply 2 of 13, by superfury

User metadata
Rank l33t++
Rank
l33t++

I'm currently making a little boot sector program to display a message, wait for a key, then reboot using interrupt 19h, finally (if int 19h returns, just to be sure) jump to the BIOS entry point at FFFF:0000.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 3 of 13, by Stiletto

User metadata
Rank l33t++
Rank
l33t++

What are you doing BTW? It sounds like you're making unit tests for your emulator. 😀

"I see a little silhouette-o of a man, Scaramouche, Scaramouche, will you
do the Fandango!" - Queen

Stiletto

Reply 4 of 13, by superfury

User metadata
Rank l33t++
Rank
l33t++

I just finished changing the boot loader that's generated with the FAT12 on floppies generated using the BIOS menu option.

It simply initialises segments(DS and ES) to zero, displays the string hardcoded in the sector using interrupt 10h function Eh (loading 7CXX into SI, then LOSDB, check if not zero(zero=terminate loop) and interrupt 10h to display and jump back to the LOSDB). After the loop is terminated, it clears AX and calls interrupt 16h to wait for a key, next it calls interrupt 19h to (re)boot. Finally IF interrupt 19h returns (just to prevent any crashes) it jumps to FFFF:0000 to manually execute a cold reboot.

			//Now the bootstrap required!
word bootprogram;
word bootmessagelocation; //The location of our boot message indicator!
bootprogram = 0x3E; //Start of the boot program!
buffer[bootprogram++] = 0xFA; //CLI: We don't want to be interrupted!
buffer[bootprogram++] = 0x31;
buffer[bootprogram++] = 0xC0; //XOR AX,AX
buffer[bootprogram++] = 0x8C; //MOV Sreg,reg
buffer[bootprogram++] = 0xC0|(MODRM_SEG_DS<<3); //MOV DS,AX
buffer[bootprogram++] = 0x8C; //MOV Sreg,reg
buffer[bootprogram++] = 0xC0|(MODRM_SEG_ES<<3); //MOV ES,AX
buffer[bootprogram++] = 0xBE; //MOV SI,imm16 ; Load the location of our message to display!
bootmessagelocation = bootprogram; //This is where our boot message location is stored!
buffer[bootprogram++] = 0x00; //Address to!
buffer[bootprogram++] = 0x00; //Our text to display is inserted here!
buffer[bootprogram++] = 0xFB; //STI: We can be interrupted again!

//Start of output of our little text display!
buffer[bootprogram++] = 0xAC; //LODSB: Load the current character!
buffer[bootprogram++] = 0x3C; //CMP AL,imm8
buffer[bootprogram++] = 0x00; //Are we zero?
buffer[bootprogram++] = 0x74; //Jump if zero=End of String...
buffer[bootprogram++] = 0x8; //Perform the next step, so skip over the output!

//We still have input, so process it!
buffer[bootprogram++] = 0xB4; //MOV AH,imm8
buffer[bootprogram++] = 0xE; //We're teletyping output!
buffer[bootprogram++] = 0xB3; //MOV BL,imm8
buffer[bootprogram++] = 0; //Page #0!
buffer[bootprogram++] = 0xCD; //INT
buffer[bootprogram++] = 0x10; //Teletype a character for input!
buffer[bootprogram++] = 0xEB; //JMP back to...
buffer[bootprogram++] = 0xF3; //the start of our little procedure to check again!

//Wait for a key!
buffer[bootprogram++] = 0xB8; //MOV AX,imm16
buffer[bootprogram++] = 0x00;
buffer[bootprogram++] = 0x00; //Clear AX to call the interrupt!
buffer[bootprogram++] = 0xCD; //INT
buffer[bootprogram++] = 0x16; //Wait for input!

//Reboot now!
buffer[bootprogram++] = 0xCD; //INT
buffer[bootprogram++] = 0x19; //Try next drive, else reboot normally!
buffer[bootprogram++] = 0xEA; //We're an
buffer[bootprogram++] = 0x00; //Non-bootable disk until overwritten by an OS!
buffer[bootprogram++] = 0x00; //This is a ...
buffer[bootprogram++] = 0xFF; //...
buffer[bootprogram++] = 0xFF; //JMP to reboot instead, for safety only (when interrupt 19h returns we don't want to crash)!

//Finally, our little boot message with patching it into the createn code!
word location;
location = bootprogram; //Load the final position of the boot program!
location += 0x7C00; //Add the start of our segment to give the actual segment!
buffer[bootmessagelocation] = (location&0xFF); //Low!
buffer[bootmessagelocation+1] = (location>>8)&0xFF; //High!
memcpy(&buffer[bootprogram],bootmessage,sizeof(bootmessage)); //Set our boot message!

This is the disk image generator generating the boot loader itself(after generating the data before it, like the initial JMP&NOP and disk information used by MS-DOS), before writing the signature and first FAT entries. The rest of the disk is zeroed (only 1 FAT is used).

'Linking' is done while generating.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 5 of 13, by Malvineous

User metadata
Rank Oldbie
Rank
Oldbie

I believe you don't need a boot sector on a floppy. There's a signature at the end of the boot sector (0x55 0xAA) and if that's missing then the BIOS won't load/run the sector. I think you can also flag more than one sector bootable, as the BIOS will keep loading sectors until the 55 AA signature is no longer present. I've seen a few boot sectors that are 2-3 sectors long before. I think at least one of them was from a DOS TSR that could format floppies in the background while you kept using the machine.

Perhaps MS-DOS only puts a boot sector on there in case the user ever wants to make the disk bootable? I must admit I've never tried to remove the signature on a floppy to see what happens, only on a hard disk, and then the BIOS just skips over the device and tries the next one.

Reply 6 of 13, by superfury

User metadata
Rank l33t++
Rank
l33t++

I know that if I try to set the signature to 00 00 instead of 55 aa and without the boot code above(also set to 0s), when I try to boot the floppy using the Turbo XT BIOS v2.5, It will crash, executing 00s until junk data (high memory area or any BIOS data written in the low memory area) will execute.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 7 of 13, by Malvineous

User metadata
Rank Oldbie
Rank
Oldbie

Interesting. Does the same happen with another BIOS? I wonder if it's a bug in the Turbo XT BIOS or actually no systems bother to check the signature on floppies?

Reply 8 of 13, by Living

User metadata
Rank Member
Rank
Member

Really? Why people believe that big corporations are going to be behind someone who uses really old software that doesnt report any more money? Why they are gonna waste time and money in that? I Just dont understand this type of questions...

Reply 9 of 13, by superfury

User metadata
Rank l33t++
Rank
l33t++

Just tried Virtualbox. It still boots the floppy. So does Dosbox. Still need to get PCEM running...

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 10 of 13, by Jepael

User metadata
Rank Oldbie
Rank
Oldbie

Floppy just needs the boot sector for FAT information, and it is best to have the 55h AAh marker at the end although not all systems require it. It does not need to have boot code, like many USB sticks and SD cards don't have any boot code.

If you want to make copyright free boot code that can't boot an OS, it's just enough to jump into an endless loop, or write a message that this floppy is not bootable, wait for a keypress and invoke INT 19H again.

If user wants to have a floppy that boots a certain operating system, it needs the specific boot code for that operating system, and then the user will use a specific format program to make such a floppy. Otherwise you don't need the boot code at all.

MSDOS, PCDOS and FreeDOS all have differently named files the boot loader should try to find, read and execute. Hmm, it could be made compatible with all of them though..

So basically, if you want a bootable image, just make an empty image, then format it with OS tool. Smart users will store an empty formatted image and duplicate that so they don't need to do it all over again (of course all the images would then have same serial number, and DOS may not find out the disk has been changed, which can lead into problems).

Last edited by Jepael on 2016-02-13, 20:46. Edited 1 time in total.

Reply 11 of 13, by superfury

User metadata
Rank l33t++
Rank
l33t++

I've just tested it using PCE's xt-dos-plus and ibmpc machines. Both boot the floppy (when setting the image to boot to 0, no auto option?) in all their .bat configurations.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 13 of 13, by Stiletto

User metadata
Rank l33t++
Rank
l33t++
Azarien wrote:

Whatever you are doing, just use the code from FreeDOS, which is on GPL.

But maybe superfury is reinventing the wheel for the fun of it. (though he never ceases with questions! 🤣 )

"I see a little silhouette-o of a man, Scaramouche, Scaramouche, will you
do the Fandango!" - Queen

Stiletto