18 unsigned char buffer
[1024];
20 #define FS_NONE 0 /* Bootsector is complete */
21 #define FS_DOS 1 /* Bootsector needs 'normal' DOS FS */
22 #define FS_ADOS 2 /* Bootsector likes any DOS FS */
23 #define FS_TAR 3 /* Bootsector needs GNU-tar volume label */
24 #define FS_STAT 4 /* Any bootsector is checked */
25 #define FS_ZERO 5 /* Boot sector must be already Zapped */
26 #define FS_MBR 6 /* Boot sector is an MBR */
42 { "tar", "Bootable GNU tar volume lable",
43 tarboot_data
, tarboot_size
, 0, 0, FS_TAR
},
44 { "dos12","Boot file BOOTFILE.SYS from dos floppy",
45 msdos_data
, msdos_size
,
46 1, msdos_boot_name
-msdos_start
, FS_DOS
, 12},
47 { "dos16","Boot file BOOTFILE.SYS from FAT16 hard disk or floppy",
48 msdos16_data
, msdos16_size
,
49 1, msdos16_boot_name
-msdos16_start
, FS_DOS
, 16},
50 { "none", "No OS bootblock, just display message",
51 noboot_data
, noboot_size
,
52 2, noboot_boot_message
-noboot_start
, FS_ADOS
},
53 { "skip", "Bypasses floppy boot with message",
55 2, skip_mesg
-skip_start
, FS_ADOS
},
56 { "minix","Minix floppy FS booter",
57 minix_data
, minix_size
,
58 2, minix_bootfile
-minix_start
, FS_ZERO
},
59 { "hdmin","Minix Hard disk FS booter",
60 minixhd_data
, minixhd_size
,
61 2, minixhd_bootfile
-minixhd_start
, FS_ZERO
},
62 { "killhd", "Deletes MBR from hard disk when booted",
63 killhd_data
, killhd_size
,
64 2, killhd_boot_message
-killhd_start
, FS_ADOS
},
66 { "mbr", "Master boot record for HD"
67 #if defined(mbr_Banner) || mbr_diskman || mbr_linear || mbr_mbrkey || mbr_preboot
91 2, mbr_Banner
-mbr_start
, FS_MBR
},
96 { "mbr", "Master boot record for HD",
97 mbr_data
,mbr_size
, 0, 0, FS_MBR
},
99 { "stat", "Display dosfs superblock",
100 0, 0, 0, 0, FS_STAT
},
101 { "copy", "Copy boot block to makeboot.sav or named file",
102 0, 0, 0, 0, FS_STAT
},
103 { "Zap", "Clear boot block to NULs",
104 0, 1024, 0, 0, FS_NONE
},
108 char * progname
= "";
113 int disk_sect
= 63; /* These are initilised to the maximums */
114 int disk_head
= 256; /* Set to the correct values when an MSDOS disk is */
115 int disk_trck
= 256; /* successfully identified */
118 int write_zero
= 1; /* Write sector 0 */
119 int write_one
= 0; /* Write sector 1 */
120 int bs_offset
= 0; /* Offset of _real_ bootsector for 2m floppies */
134 if( argc
== 4 && strcmp(argv
[1], "-f") == 0 )
136 argv
++; argc
--; force
++;
138 if( argc
!= 3 ) Usage();
140 boot_id
= strchr(argv
[1], '=');
144 if( (i
=strlen(argv
[1])) < 2 ) Usage();
145 for(ptr
= bblocks
; ptr
->name
; ptr
++)
146 if( strncmp(argv
[1], ptr
->name
, i
) == 0 ) break;
147 if( ptr
->name
== 0 ) Usage();
150 if( read_sector(0, buffer
) != 0 )
152 read_sector(1, buffer
+512);
154 write_zero
= (ptr
->size
>= 512);
155 write_one
= (ptr
->size
>= 1024);
159 case FS_NONE
: /* override */
165 if(ptr
->fsmod
) check_simpledos(ptr
->fsmod
);
178 fprintf(stderr
, "Program error, unknown filesystem requirement\n");
185 if( strcmp(ptr
->name
, "copy") == 0 )
193 for(i
=0; i
<sysboot_dosfs_stat
; i
++)
194 buffer
[i
] = ptr
->data
[i
];
195 for(i
=sysboot_codestart
; i
<512; i
++)
196 buffer
[i
] = ptr
->data
[i
];
210 memcpy(buffer
, ptr
->data
, ptr
->size
);
213 memset(buffer
, '\0', 1024);
219 if( boot_id
) switch(ptr
->name_type
)
222 set_dosname(ptr
->boot_name
);
225 set_asciz(ptr
->boot_name
);
228 fprintf(stderr
, "Cannot specify boot name for this block\n");
234 if( write_zero
) do_2m_write();
235 /* Don't write 1 ever! */
239 if( write_zero
) write_sector(0, buffer
);
240 if( write_one
) write_sector(1, buffer
+512);
248 struct bblist
*ptr
= bblocks
;
250 if( progname
== 0 || *progname
== 0 || progname
[1] == 0 )
251 progname
= "makeboot";
254 fprintf(stderr
, "Usage: %s [-f] bootblock[=bootname] a:\n\n", progname
);
255 fprintf(stderr
, "The 'a:' can be any drive or file or @: for the MBR.\n");
257 fprintf(stderr
, "Usage: %s [-f] bootblock[=bootname] /dev/fd0\n\n", progname
);
259 fprintf(stderr
, "The bootname is a filename or message to use with the block,\n");
260 fprintf(stderr
, "the blocks are:\n");
261 for(;ptr
->name
; ptr
++)
262 fprintf(stderr
, "\t%s\t%s\n", ptr
->name
, ptr
->desc
);
266 /**************************************************************************/
274 if( diskname
[2] == '\r' ) diskname
[2] = 0;
276 if( diskname
[2] == 0 && diskname
[1] == ':' )
278 if (isalpha(diskname
[0])) {
279 disktype
= toupper(diskname
[0])-'A'+1;
282 if (diskname
[0] =='@') {
289 diskfd
= fopen(diskname
, "r+b");
290 if( diskfd
== 0 ) diskfd
= fopen(diskname
, "rb");
291 if( diskfd
== 0 && force
) diskfd
= fopen(diskname
, "w+b");
294 fprintf(stderr
, "Cannot open '%s'\n", diskname
);
302 if( diskfd
&& disktype
== 0 ) fclose(diskfd
);
308 write_sector(sectno
, loadaddr
)
313 if( disktype
== 1 || disktype
== 2 || disktype
== 129 )
317 s
= sectno
%disk_sect
+ 1;
318 h
= sectno
/disk_sect
%disk_head
;
319 c
= sectno
/disk_sect
/disk_head
;
321 for(tries
=0; tries
<6; tries
++)
322 if( (rv
= bios_sect_write(disktype
-1, c
, h
, s
, loadaddr
)) == 0 )
327 fprintf(stderr
, "Write protect error writing sector %d\n", sectno
);
329 fprintf(stderr
, "Error writing sector %d, (%d)\n", sectno
, rv
/256);
338 for(tries
=0; tries
<6; tries
++)
339 if( (rv
= dos_sect_write(disktype
-1, sectno
, loadaddr
)) == 0 )
343 fprintf(stderr
, "Error writing sector %d, (0x%04d)\n", sectno
, rv
);
344 memset(loadaddr
, '\0', 512);
352 fprintf(stderr
, "Cannot write sector %d\n", sectno
);
355 fseek(diskfd
, (long)sectno
*512, 0);
356 if( fwrite(loadaddr
, 512, 1, diskfd
) != 1 )
358 fprintf(stderr
, "Cannot write sector %d\n", sectno
);
361 printf("Wrote sector %d\n", sectno
);
366 read_sector(sectno
, loadaddr
)
372 if( disktype
== 1 || disktype
== 2 || disktype
== 129 )
376 s
= sectno
%disk_sect
+ 1;
377 h
= sectno
/disk_sect
%disk_head
;
378 c
= sectno
/disk_sect
/disk_head
;
380 for(tries
=0; tries
<6; tries
++)
381 if( (rv
= bios_sect_read(disktype
-1, c
, h
, s
, loadaddr
)) == 0 )
385 fprintf(stderr
, "Error reading sector %d, (%d)\n", sectno
, rv
/256);
386 memset(loadaddr
, '\0', 512);
395 for(tries
=0; tries
<6; tries
++)
396 if( (rv
= dos_sect_read(disktype
-1, sectno
, loadaddr
)) == 0 )
400 fprintf(stderr
, "Error reading sector %d, (0x%04d)\n", sectno
, rv
);
401 memset(loadaddr
, '\0', 512);
409 fprintf(stderr
, "Cannot read sector %d\n", sectno
);
412 fseek(diskfd
, (long)sectno
*512, 0);
413 if( (cc
=fread(loadaddr
, 1, 512, diskfd
)) != 512 )
415 fprintf(stderr
, "Cannot read sector %d, clearing\n", sectno
);
417 memset(loadaddr
+cc
, '\0', 512-cc
);
422 /**************************************************************************/
425 bios_sect_read(drv
, track
, head
, sector
, loadaddr
)
434 mov dh
,[bp
+2+_bios_sect_read
.head
]
435 mov dl
,[bp
+2+_bios_sect_read
.drv
]
436 mov cl
,[bp
+2+_bios_sect_read
.sector
]
437 mov ch
,[bp
+2+_bios_sect_read
.track
]
439 mov bx
,[bp
+2+_bios_sect_read
.loadaddr
]
451 bios_sect_write(drv
, track
, head
, sector
, loadaddr
)
460 mov dh
,[bp
+2+_bios_sect_write
.head
]
461 mov dl
,[bp
+2+_bios_sect_write
.drv
]
462 mov cl
,[bp
+2+_bios_sect_write
.sector
]
463 mov ch
,[bp
+2+_bios_sect_write
.track
]
465 mov bx
,[bp
+2+_bios_sect_write
.loadaddr
]
478 /**************************************************************************/
482 /* All this mess just to read one sector!! */
490 dos_sect_read(drv
, sector
, loadaddr
)
496 mov al
,[bp
+2+_dos_sect_read
.drv
]
498 mov dx
,[bp
+2+_dos_sect_read
.sector
]
499 mov bx
,[bp
+2+_dos_sect_read
.loadaddr
]
507 ! Fill the disk packet
508 mov ax
,[bp
+2+_dos_sect_read
.sector
]
509 mov
[_disk_packet
],ax
511 mov
[_disk_packet
+2],ax
513 mov
[_disk_packet
+4],ax
514 mov ax
,[bp
+2+_dos_sect_read
.loadaddr
]
515 mov
[_disk_packet
+6],ax
517 mov
[_disk_packet
+8],ax
519 mov dl
,[bp
+2+_dos_sect_read
.drv
]
537 dos_sect_write(drv
, sector
, loadaddr
)
543 mov al
,[bp
+2+_dos_sect_write
.drv
]
545 mov dx
,[bp
+2+_dos_sect_write
.sector
]
546 mov bx
,[bp
+2+_dos_sect_write
.loadaddr
]
554 ! Fill the disk packet
555 mov ax
,[bp
+2+_dos_sect_write
.sector
]
556 mov
[_disk_packet
],ax
558 mov
[_disk_packet
+2],ax
560 mov
[_disk_packet
+4],ax
561 mov ax
,[bp
+2+_dos_sect_write
.loadaddr
]
562 mov
[_disk_packet
+6],ax
564 mov
[_disk_packet
+8],ax
566 mov dl
,[bp
+2+_dos_sect_write
.drv
]
584 /**************************************************************************/
595 fprintf(stderr
, "Boot block isn't empty, zap it first\n");
600 /**************************************************************************/
620 #define buff_tar (*(struct tar_head*) buffer)
621 #define boot_tar (*(struct tar_head*) tarboot_data)
626 unsigned int val
= 0;
628 for(i
=0; i
<8; i
++) if( s
[i
] >= '0' && s
[i
] <= '7' )
629 val
= (val
<<3) + s
[i
] - '0';
637 unsigned int csum
= 0;
640 for(p
=buffer
; p
<buffer
+512; p
++)
641 if( *p
) goto not_zapped
;
642 /* Block zapped, ok */
646 osum
= oct(buff_tar
.chksum
);
647 memset(buff_tar
.chksum
, ' ', sizeof(buff_tar
.chksum
));
649 for(p
=buffer
; p
<buffer
+512; p
++)
654 fprintf(stderr
, "TAR file checksum failed, this isn't a tar file.\n");
658 memset(buffer
, '\0', 1024);
660 if( buff_tar
.linkflag
!= 'V' )
662 fprintf(stderr
, "Tar file doesn't start with a volume label\n");
666 strcpy(vbuf
, boot_tar
.name
); strcat(vbuf
, " Volume 1");
667 if( strcmp(boot_tar
.name
, buff_tar
.name
) != 0
668 && strcmp(vbuf
, buff_tar
.name
) != 0 )
670 fprintf(stderr
, "WARNING: Volume is labeled as '%s' not '%s'\n",
671 buff_tar
.name
, boot_tar
.name
);
680 unsigned int csum
= 0;
683 struct tar_head temp
;
687 /* Copy preserved fields
689 if( buff_tar
.name
[0] )
691 memcpy(temp
.mtime
, buff_tar
.mtime
, sizeof(temp
.mtime
));
693 memset(temp
.name
, 0x90, 16);
694 for(i
=0; buff_tar
.name
[i
] && buff_tar
.name
[i
] != ' ' && i
<14; i
++)
696 int ch
= buff_tar
.name
[i
];
697 if( islower(ch
) ) ch
= toupper(ch
);
698 if( strchr("/?@ABCDEFGHIJKLMNO", ch
) == 0 )
706 sprintf(temp
.mtime
, "%11lo", time((void*)0));
710 /* Re-calculate the checksum */
711 memset(buff_tar
.chksum
, ' ', sizeof(buff_tar
.chksum
));
713 for(p
=buffer
; p
<buffer
+512; p
++)
716 sprintf(buff_tar
.chksum
, "%7o", csum
);
718 printf("Boot block installed");
719 if( ((struct tar_head
*)buffer
)[1].name
[0] )
720 printf(" to boot file '%s'\n",
721 ((struct tar_head
*)buffer
)[1].name
);
723 printf(", use 'tar -r' to add executable\n");
726 /**************************************************************************/
734 #define DOS_MAXSECT 6
739 #define DOS_HIDDEN 11
741 #define DOS4_MAXSECT 12
742 #define DOS4_PHY_DRIVE 13
743 #define DOS4_SERIAL 14
744 #define DOS4_LABEL 15
745 #define DOS4_FATTYPE 16
747 #define DOS7_MAXSECT 17
748 #define DOS7_FAT32LEN 18
749 #define DOS7_FLAGS 19
750 #define DOS7_VERSION 20
751 #define DOS7_ROOT_CLUST 21
752 #define DOS7_INFO_SECT 22
753 #define DOS7_BOOT2 23
776 { 0x20, 4, 0}, /* DOS4+ */
782 { 0x20, 4, 0}, /* DOS7 FAT32 */
801 print_super(bootsect
)
804 static char * fieldnames
[] = {
816 "Hidden sectors (Partition offset)",
818 "Large Filesystem sector count",
821 "Disk Label (DOS 4+)",
824 "Large Filesystem sector count",
828 "FAT32 Root Cluster",
833 "FAT32 Serial number",
837 "FAT32 Free clusters",
838 "FAT32 Next free cluster",
843 long numclust
= 0xFFFF;
847 for(i
=0; dosflds
[i
].offset
>= 0; i
++)
849 if( i
>= DOS4_MAXSECT
&& (fat_len
==0) != (i
>=DOS7_MAXSECT
) )
852 if( dosflds
[i
].length
<= 4 )
855 for(j
=dosflds
[i
].length
-1; j
>=0; j
--)
857 v
= v
*256 + (0xFF&( bootsect
[dosflds
[i
].offset
+j
] ));
864 (i
==DOS_FATLEN
|| i
==DOS_MAXSECT
|| i
==DOS4_MAXSECT
|| i
==DOS_NROOT
))
867 printf("%-35s%ld\n", fieldnames
[i
], v
);
869 if (i
==DOS_SECT
&& v
!=512 && v
!=1024 && v
!=2048)
875 printf("%-35s", fieldnames
[i
]);
876 for(j
=0; j
<dosflds
[i
].length
; j
++)
878 ch
= bootsect
[dosflds
[i
].offset
+j
];
879 if( ch
< ' ' || ch
> '~' ) putchar('.');
887 decode_super(bootsect
)
892 for(i
=0; dosflds
[i
].offset
>= 0; i
++)
894 if( i
>= DOS4_MAXSECT
&&
895 (dosflds
[DOS_FATLEN
].value
==0) != (i
>=DOS7_MAXSECT
) )
897 dosflds
[i
].lvalue
= dosflds
[i
].value
= 0;
901 if( dosflds
[i
].length
<= 4 )
904 for(j
=dosflds
[i
].length
-1; j
>=0; j
--)
906 v
= v
*256 + (0xFF&( bootsect
[dosflds
[i
].offset
+j
] ));
908 dosflds
[i
].value
= v
;
909 dosflds
[i
].lvalue
= v
;
912 dosflds
[i
].lvalue
= dosflds
[i
].value
= 0;
920 char * fname
= "makeboot.sav";
921 if( boot_id
) fname
= boot_id
;
923 printf("Copying boot block to '%s'\n", fname
);
924 fd
= fopen(fname
, "wb");
925 fwrite(bootsect
, 1024, 1, fd
);
929 /**************************************************************************/
933 decode_super(buffer
);
934 if( dosflds
[DOS_CLUST
].value
== 0 ) /* MSDOS v1.0 */
935 dosflds
[DOS_CLUST
].value
= 1;
937 if( dosflds
[DOS_MEDIA
].value
< 0xF0 )
940 fprintf(stderr
, "Dos media descriptor is invalid\n");
942 else if( dosflds
[DOS_MEDIA
].value
!= (0xFF&buffer
[512])
943 && dosflds
[DOS_RESV
].value
== 1 )
944 fprintf(stderr
, "Dos media descriptor check failed\n");
947 disk_sect
= dosflds
[DOS_SPT
].value
;
948 disk_head
= dosflds
[DOS_HEADS
].value
;
949 if( disk_sect
> 0 && disk_head
> 0 )
950 disk_trck
= dosflds
[DOS_MAXSECT
].value
/disk_head
/disk_sect
;
953 if( bs_offset
== 0 &&
954 memcmp(buffer
+dosflds
[DOS_SYSID
].offset
, "2M-STV0", 7) == 0)
956 printf("Floppy is in 2M format - reading 2nd boot block\n");
957 bs_offset
= dosflds
[DOS_RESV
].value
+ dosflds
[DOS_FATLEN
].value
;
958 if( read_sector(bs_offset
, buffer
) != 0 )
961 decode_super(buffer
);
962 if( dosflds
[DOS_MEDIA
].value
< 0xF0 ||
963 ( dosflds
[DOS_MEDIA
].value
!= (0xFF&buffer
[512])
964 && dosflds
[DOS_RESV
].value
== 1 ) )
968 printf("Bad 2nd boot block - reloading first\n");
969 if( read_sector(0, buffer
) != 0 )
974 printf("Bad 2nd boot block\n");
986 check_simpledos(bb_fatbits
)
989 long numclust
= 0xFFFF;
993 /* Work out how many real clusters there are */
994 if( dosflds
[DOS_MAXSECT
].value
+ 2 > 2 )
995 numclust
= ( dosflds
[DOS_MAXSECT
].value
996 - dosflds
[DOS_RESV
].value
997 - dosflds
[DOS_NFAT
].value
* dosflds
[DOS_FATLEN
].value
998 - ((dosflds
[DOS_NROOT
].value
+15)/16)
999 ) / dosflds
[DOS_CLUST
].value
+ 2;
1000 else if( dosflds
[DOS4_MAXSECT
].value
> 0 )
1001 numclust
= ( dosflds
[DOS4_MAXSECT
].lvalue
1002 - dosflds
[DOS_RESV
].value
1003 - dosflds
[DOS_NFAT
].value
* dosflds
[DOS_FATLEN
].value
1004 - ((dosflds
[DOS_NROOT
].value
+15)/16)
1005 ) / dosflds
[DOS_CLUST
].value
+ 2;
1007 numclust
= ( dosflds
[DOS7_MAXSECT
].lvalue
1008 - dosflds
[DOS_RESV
].value
1009 - dosflds
[DOS_NFAT
].value
* dosflds
[DOS7_FAT32LEN
].value
1010 ) / dosflds
[DOS_CLUST
].value
;
1012 if( memcmp(buffer
+dosflds
[DOS4_FATTYPE
].offset
, "FAT12", 5) == 0 )
1014 else if( memcmp(buffer
+dosflds
[DOS4_FATTYPE
].offset
, "FAT16", 5) == 0 )
1017 fatbits
=12+4*(numclust
> 0xFF0) + 16*(numclust
> 0xFFF0L
);
1019 if( dosflds
[DOS_NFAT
].value
> 2 )
1020 err
= "Too many fat copies on disk";
1021 else if( dosflds
[DOS_NROOT
].value
< 15 )
1022 err
= "Root directory has unreasonable size.";
1023 else if( dosflds
[DOS_SECT
].value
!= 512 )
1024 err
= "Drive sector size isn't 512 bytes sorry no-go.";
1025 else if( fatbits
== 16 && numclust
< 0xFF0 )
1026 err
= "Weirdness, FAT16 but less than $FF0 clusters";
1027 else if( fatbits
!= bb_fatbits
)
1028 err
= "Filesystem has the wrong fat type for this bootblock.";
1029 else if( numclust
* dosflds
[DOS_CLUST
].lvalue
/
1030 dosflds
[DOS_SPT
].value
> 65535 )
1031 err
= "Boot sector untested with more than 65535 tracks";
1033 if( !err
&& bb_fatbits
== 12 )
1035 if( dosflds
[DOS4_PHY_DRIVE
].value
!= 0 )
1036 err
= "This boot sector is only for floppies";
1037 else if( (0x7C00-msdos_start
-512)/512 < dosflds
[DOS_FATLEN
].value
)
1038 err
= "The FAT is too large to load in the available space.";
1039 else if( dosflds
[DOS_RESV
].value
+ dosflds
[DOS_FATLEN
].value
>
1040 dosflds
[DOS_SPT
].value
)
1041 err
= "The bootblock needs all of fat1 on the first track.";
1042 else if( msdos_heads
== 2 && dosflds
[DOS_HEADS
].value
!= 2 )
1043 err
= "Drive doesn't have two heads, this is required.";
1044 else if( dosflds
[DOS_HIDDEN
].lvalue
!= 0 )
1045 err
= "MSDOS floppies shouldn't have hidden sectors.";
1050 fprintf(stderr
, "ERROR: %s\n\n", err
);
1051 print_super(buffer
);
1056 set_dosname(boot_name
)
1062 strcpy(dos_name
, " ");
1064 for(i
=0; boot_id
[i
] && boot_id
[i
] != '.' && i
<16; i
++)
1065 dos_name
[i
] = toupper(boot_id
[i
]);
1067 if( boot_id
[i
] == '.' )
1069 for(j
=8,i
++; boot_id
[i
] && boot_id
[i
] != '.' && j
<16; i
++,j
++)
1070 dos_name
[j
] = toupper(boot_id
[i
]);
1073 printf("Bootfile set to '%11.11s'\n", dos_name
);
1075 memcpy(buffer
+boot_name
, dos_name
, 11);
1078 set_asciz(boot_name
)
1083 for(i
=boot_name
; buffer
[i
]; i
++) ;
1084 for( ; !buffer
[i
]; i
++) ;
1085 i
= i
- boot_name
-1;
1087 if( strlen(boot_id
) > i
)
1089 fprintf(stderr
, "Name '%s' is too long for bootblock\n");
1094 for(i
=0,j
=boot_name
; boot_id
[i
]; i
++)
1096 if( boot_id
[i
] == '\\' && boot_id
[i
+1] )
1101 case 'n': buffer
[j
++] = '\n'; break;
1102 case 'r': buffer
[j
++] = '\r'; break;
1103 case 'b': buffer
[j
++] = '\b'; break;
1104 case 't': buffer
[j
++] = '\t'; break;
1105 case 'a': buffer
[j
++] = '\007'; break;
1106 case 'e': buffer
[j
++] = '\033'; break;
1107 default: buffer
[j
++] = boot_id
[i
]; break;
1111 else if(boot_id
[i
] == '_') buffer
[j
++] = ' ';
1112 else if(boot_id
[i
] == '^') { buffer
[j
++] = '\r'; buffer
[j
++] = '\n'; }
1114 else buffer
[j
++] = boot_id
[i
];
1124 if( buffer
[510] == 0x55 && buffer
[511] == 0xAA )
1131 /* Check for Disk Manager partition tables */
1132 if( buffer
[252] == 0x55 && buffer
[253] == 0xAA )
1134 if( (unsigned char)mbr_data
[252] != 0x55 ||
1135 (unsigned char)mbr_data
[253] != 0xAA )
1142 fprintf(stderr
, "That doesn't look like a compatible MBR but ...\n");
1145 fprintf(stderr
, "That doesn't look like a compatible MBR\n");
1154 if( buffer
[252] != 0xAA || buffer
[253] != 0x55 ||
1155 (unsigned char)mbr_data
[252] != 0xAA || mbr_data
[253] != 0x55 )
1156 memcpy(buffer
, mbr_data
, 446);
1158 memcpy(buffer
, mbr_data
, 254);
1165 /**************************************************************************/
1169 char boot_sector_2m_23_82
[] = {
1170 0xe9,0x7d,0x00,0x32,0x4d,0x2d,0x53,0x54,0x56,0x30,0x34,0x00,0x02,0x01,0x01,0x00,
1171 0x02,0xe0,0x00,0xbc,0x0e,0xfa,0x0b,0x00,0x17,0x00,0x02,0x00,0x00,0x00,0x00,0x00,
1172 0x00,0x00,0x00,0x00,0x00,0x00,0x29,0x45,0xb8,0x25,0x51,0x4e,0x4f,0x20,0x4e,0x41,
1173 0x4d,0x45,0x20,0x20,0x20,0x20,0x46,0x41,0x54,0x31,0x32,0x20,0x20,0x20,0x00,0x3f,
1174 0x07,0x01,0x00,0x00,0x80,0x00,0x4c,0x00,0x61,0x00,0x79,0x00,0x13,0x46,0x01,0x02,
1175 0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,
1176 0x13,0x40,0x03,0x07,0x81,0x04,0x04,0x8c,0x01,0x04,0x97,0x05,0x04,0xa2,0x02,0x04,
1177 0xad,0x06,0x03,0xb3,0x03,0x04,0xbe,0x07,0x02,0x04,0x04,0x04,0x04,0x04,0x03,0x02,
1178 0xfa,0x33,0xc0,0x8e,0xd0,0xbc,0x00,0x7c,0xb8,0xc0,0x07,0x50,0x05,0x20,0x00,0x50,
1179 0x07,0x1f,0x33,0xf6,0x33,0xff,0xb9,0x00,0x01,0xfc,0xf3,0xa5,0x8b,0x1e,0x44,0x00,
1180 0x8d,0x47,0x26,0x06,0x50,0xcb,0xfb,0xbe,0x1a,0x01,0xe8,0xd9,0x00,0xbb,0x78,0x00,
1181 0x36,0xc5,0x37,0x1e,0x56,0x33,0xff,0x36,0x89,0x3f,0x36,0x8c,0x47,0x02,0xb9,0x0b,
1182 0x00,0xf3,0xa4,0x06,0x1f,0xa0,0x18,0x00,0x88,0x45,0xf9,0x33,0xc0,0x8e,0xc0,0xbb,
1183 0x00,0x7c,0x26,0x89,0x87,0xfe,0x01,0xb8,0x01,0x02,0x8b,0x0e,0x16,0x00,0x83,0xc1,
1184 0x02,0x33,0xd2,0x83,0xf9,0x0a,0x72,0x1f,0x51,0xcd,0x13,0x59,0x36,0x8b,0x1e,0x13,
1185 0x04,0x83,0xeb,0x05,0xb8,0x40,0x00,0xf7,0xe3,0x8e,0xc0,0x53,0x33,0xdb,0xb8,0x05,
1186 0x02,0x41,0x33,0xd2,0xcd,0x13,0x5b,0x36,0x8f,0x06,0x78,0x00,0x36,0x8f,0x06,0x7a,
1187 0x00,0x26,0x81,0x3e,0xfe,0x09,0x55,0xaa,0x75,0x60,0x36,0x89,0x1e,0x13,0x04,0x06,
1188 0xb4,0x08,0xb3,0x00,0xb2,0x00,0xcd,0x13,0x8a,0xc3,0xb4,0x00,0x80,0xfa,0x02,0x72,
1189 0x0c,0x50,0xb4,0x08,0xb3,0x00,0xb2,0x01,0xcd,0x13,0x58,0x8a,0xe3,0x07,0x26,0x8c,
1190 0x06,0xfe,0x09,0x26,0xff,0x1e,0xfc,0x09,0xb8,0x01,0x02,0x33,0xd2,0x8e,0xc2,0xb9,
1191 0x01,0x00,0xbb,0x00,0x80,0x50,0xcd,0x13,0x58,0xbb,0x00,0x7c,0x06,0x53,0x26,0x81,
1192 0x7f,0x03,0x32,0x4d,0x75,0x04,0xb2,0x80,0xcd,0x13,0x26,0x81,0x3e,0xfe,0x7d,0x55,
1193 0xaa,0x75,0x03,0x33,0xd2,0xcb,0x22,0xd2,0x74,0xec,0xbe,0x2f,0x01,0xe8,0x06,0x00,
1194 0xb4,0x00,0xcd,0x16,0xcd,0x19,0x03,0x36,0x44,0x00,0xfc,0xac,0x22,0xc0,0x74,0x09,
1195 0xb4,0x0e,0xbb,0x07,0x00,0xcd,0x10,0xeb,0xf1,0xc3,0x0d,0x0a,0x32,0x4d,0x20,0x53,
1196 0x75,0x70,0x65,0x72,0x42,0x4f,0x4f,0x54,0x20,0x32,0x2e,0x30,0x0d,0x0a,0x00,0x0d,
1197 0x0a,0xad,0x4e,0x6f,0x20,0x62,0x6f,0x74,0x61,0x62,0x6c,0x65,0x21,0x0d,0x0a,0x00,
1198 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1199 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1200 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1201 0x4d,0x61,0x64,0x65,0x20,0x69,0x6e,0x20,0x53,0x70,0x61,0x69,0x6e,0x00,0x55,0xaa
1204 char boot_sector_2m_22_82
[] = {
1205 0xe9,0x6e,0x00,0x32,0x4d,0x2d,0x53,0x54,0x56,0x30,0x38,0x00,0x02,0x01,0x01,0x00,
1206 0x02,0xe0,0x00,0x18,0x0e,0xfa,0x0b,0x00,0x16,0x00,0x02,0x00,0x00,0x00,0x00,0x00,
1207 0x00,0x00,0x00,0x00,0x00,0x00,0x29,0xcc,0x9b,0xe1,0xd4,0x4e,0x4f,0x20,0x4e,0x41,
1208 0x4d,0x45,0x20,0x20,0x20,0x20,0x46,0x41,0x54,0x31,0x32,0x20,0x20,0x20,0x00,0x04,
1209 0x07,0x00,0x00,0x00,0x71,0x00,0x4c,0x00,0x61,0x00,0x66,0x00,0x13,0x46,0x01,0x02,
1210 0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,
1211 0x13,0x0b,0x28,0x03,0x01,0x02,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
1212 0x03,0xfa,0x33,0xc0,0x8e,0xd0,0xbc,0x00,0x7c,0xb8,0xc0,0x07,0x50,0x05,0x20,0x00,
1213 0x50,0x07,0x1f,0x33,0xf6,0x33,0xff,0xb9,0x00,0x01,0xfc,0xf3,0xa5,0x8b,0x1e,0x44,
1214 0x00,0x8d,0x47,0x26,0x06,0x50,0xcb,0xfb,0xbe,0x1a,0x01,0xe8,0xd9,0x00,0xbb,0x78,
1215 0x00,0x36,0xc5,0x37,0x1e,0x56,0x33,0xff,0x36,0x89,0x3f,0x36,0x8c,0x47,0x02,0xb9,
1216 0x0b,0x00,0xf3,0xa4,0x06,0x1f,0xa0,0x18,0x00,0x88,0x45,0xf9,0x33,0xc0,0x8e,0xc0,
1217 0xbb,0x00,0x7c,0x26,0x89,0x87,0xfe,0x01,0xb8,0x01,0x02,0x8b,0x0e,0x16,0x00,0x83,
1218 0xc1,0x02,0x33,0xd2,0x83,0xf9,0x0a,0x72,0x1f,0x51,0xcd,0x13,0x59,0x36,0x8b,0x1e,
1219 0x13,0x04,0x83,0xeb,0x05,0xb8,0x40,0x00,0xf7,0xe3,0x8e,0xc0,0x53,0x33,0xdb,0xb8,
1220 0x05,0x02,0x41,0x33,0xd2,0xcd,0x13,0x5b,0x36,0x8f,0x06,0x78,0x00,0x36,0x8f,0x06,
1221 0x7a,0x00,0x26,0x81,0x3e,0xfe,0x09,0x55,0xaa,0x75,0x60,0x36,0x89,0x1e,0x13,0x04,
1222 0x06,0xb4,0x08,0xb3,0x00,0xb2,0x00,0xcd,0x13,0x8a,0xc3,0xb4,0x00,0x80,0xfa,0x02,
1223 0x72,0x0c,0x50,0xb4,0x08,0xb3,0x00,0xb2,0x01,0xcd,0x13,0x58,0x8a,0xe3,0x07,0x26,
1224 0x8c,0x06,0xfe,0x09,0x26,0xff,0x1e,0xfc,0x09,0xb8,0x01,0x02,0x33,0xd2,0x8e,0xc2,
1225 0xb9,0x01,0x00,0xbb,0x00,0x80,0x50,0xcd,0x13,0x58,0xbb,0x00,0x7c,0x06,0x53,0x26,
1226 0x81,0x7f,0x03,0x32,0x4d,0x75,0x04,0xb2,0x80,0xcd,0x13,0x26,0x81,0x3e,0xfe,0x7d,
1227 0x55,0xaa,0x75,0x03,0x33,0xd2,0xcb,0x22,0xd2,0x74,0xec,0xbe,0x2f,0x01,0xe8,0x06,
1228 0x00,0xb4,0x00,0xcd,0x16,0xcd,0x19,0x03,0x36,0x44,0x00,0xfc,0xac,0x22,0xc0,0x74,
1229 0x09,0xb4,0x0e,0xbb,0x07,0x00,0xcd,0x10,0xeb,0xf1,0xc3,0x0d,0x0a,0x32,0x4d,0x20,
1230 0x53,0x75,0x70,0x65,0x72,0x42,0x4f,0x4f,0x54,0x20,0x32,0x2e,0x30,0x0d,0x0a,0x00,
1231 0x0d,0x0a,0xad,0x4e,0x6f,0x20,0x62,0x6f,0x74,0x61,0x62,0x6c,0x65,0x21,0x0d,0x0a,
1232 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1233 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1234 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1235 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1236 0x4d,0x61,0x64,0x65,0x20,0x69,0x6e,0x20,0x53,0x70,0x61,0x69,0x6e,0x00,0x55,0xaa
1240 char program_2m_vsn_20
[] = {
1241 0x2b,0x00,0x43,0x00,0x32,0x30,0x32,0x4d,0x2d,0x53,0x54,0x56,0x00,0x00,0x00,0x00,
1242 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,
1243 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x4a,0x42,0x00,0x00,0x01,0x00,0x00,
1244 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1245 0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1246 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfb,0xfc,0x9c,0x56,0x80,
1247 0xfa,0x02,0x73,0x3d,0xe8,0x41,0x00,0x2e,0x80,0x3c,0x02,0x74,0x04,0x2e,0x80,0x3c,
1248 0x04,0x72,0x2e,0x80,0xfc,0x02,0x72,0x29,0x80,0xfc,0x05,0x77,0x24,0x75,0x05,0xe8,
1249 0x36,0x00,0xeb,0x1d,0xe8,0x85,0x00,0x73,0x09,0x5e,0x9d,0xf9,0xb8,0x00,0x06,0xca,
1250 0x02,0x00,0x2e,0x80,0x7c,0x01,0x00,0x74,0x08,0x5e,0x9d,0xe8,0x3c,0x02,0xca,0x02,
1251 0x00,0x5e,0x9d,0x2e,0xff,0x2e,0xfc,0x09,0x9c,0x53,0x8a,0xda,0xb7,0x00,0xd1,0xe3,
1252 0x2e,0x8b,0xb7,0x00,0x00,0x5b,0x9d,0xc3,0x60,0xe8,0xec,0xff,0xb0,0x01,0x72,0x02,
1253 0xb0,0x00,0x2e,0x88,0x44,0x01,0x61,0xc3,0x50,0xa0,0x12,0x00,0x0a,0x06,0x11,0x00,
1254 0x58,0xc3,0x60,0x1e,0x6a,0x40,0x1f,0xb0,0x01,0x8a,0xca,0xd2,0xe0,0x84,0x06,0x3f,
1255 0x00,0x75,0x04,0xf8,0xe8,0xef,0x05,0x8a,0xe2,0xc0,0xe4,0x04,0x0a,0xe0,0xc0,0xe0,
1256 0x04,0x0c,0x0c,0x0a,0xc2,0xba,0xf2,0x03,0xfa,0x88,0x26,0x3f,0x00,0xee,0x83,0xc2,
1257 0x05,0xeb,0x00,0xeb,0x00,0xec,0xfb,0xa8,0x80,0x1f,0x61,0xc3,0x60,0xe8,0x98,0xff,
1258 0x2e,0x80,0x7c,0x02,0x01,0x2e,0xc6,0x44,0x02,0x00,0x74,0x08,0xe8,0xb3,0xff,0x75,
1259 0x03,0x61,0xf8,0xc3,0xf8,0xe8,0x90,0xff,0x1e,0x06,0xbb,0x90,0x00,0x02,0xda,0x6a,
1260 0x40,0x1f,0x80,0x27,0xef,0x0e,0x0e,0x1f,0x07,0x88,0x16,0x0c,0x00,0xf9,0xe8,0x29,
1261 0x05,0xc6,0x06,0x11,0x00,0x01,0xc6,0x06,0x12,0x00,0x00,0xe8,0xa1,0x05,0xfe,0x0e,
1262 0x11,0x00,0xe8,0x9a,0x05,0xf8,0xe8,0x7d,0x05,0xe8,0x76,0xff,0x74,0x07,0xc6,0x44,
1263 0x02,0x01,0xf8,0xeb,0x68,0x1e,0x6a,0x40,0x1f,0xc6,0x06,0x41,0x00,0x06,0x1f,0xc6,
1264 0x06,0x1b,0x00,0xff,0xc6,0x44,0x08,0x14,0xb9,0x03,0x00,0x51,0x83,0xf9,0x02,0xe8,
1265 0xe8,0x04,0xc6,0x44,0x06,0x00,0xc6,0x06,0x11,0x00,0x00,0xc6,0x06,0x12,0x00,0x00,
1266 0xc6,0x06,0x13,0x00,0x01,0xc6,0x06,0x16,0x00,0x00,0xc6,0x06,0x17,0x00,0x01,0xc6,
1267 0x06,0x27,0x00,0x46,0x8b,0x3e,0x19,0x00,0xe8,0x7f,0x02,0x75,0x0b,0x59,0x8b,0x1e,
1268 0x19,0x00,0xe8,0x1c,0x00,0xf8,0xeb,0x14,0x8a,0x44,0x06,0x40,0x3c,0x03,0x77,0x05,
1269 0x88,0x44,0x06,0xeb,0xc1,0xc6,0x44,0x06,0x00,0x59,0xe2,0xaf,0xf9,0x07,0x1f,0x61,
1270 0xc3,0x60,0xe8,0x88,0x00,0x72,0x5c,0x88,0x44,0x05,0x88,0x4c,0x03,0x8a,0x16,0x0c,
1271 0x00,0xf9,0xe8,0xd3,0xfe,0x26,0x8a,0x47,0x16,0x88,0x44,0x17,0x26,0x8a,0x4f,0x41,
1272 0x88,0x4c,0x04,0x26,0x8b,0x47,0x42,0x89,0x44,0x06,0x26,0x8a,0x47,0x18,0x88,0x44,
1273 0x09,0x26,0x8b,0x7f,0x48,0x26,0x8a,0x41,0x01,0x8a,0xe0,0x22,0xc9,0x74,0x0a,0x80,
1274 0xc4,0xbe,0xb0,0x0b,0xf6,0xe4,0x2d,0x3e,0x08,0xd0,0xe8,0x88,0x44,0x08,0xb9,0x0d,
1275 0x00,0x26,0x8b,0x7f,0x4a,0x03,0xfb,0x8d,0x5c,0x0a,0x26,0x8a,0x05,0x88,0x07,0x43,
1276 0x47,0xe2,0xf7,0x8a,0x44,0x06,0xc0,0xe0,0x06,0x0c,0x17,0x80,0x3c,0x02,0x77,0x0a,
1277 0x24,0xf8,0x0c,0x05,0xa8,0x40,0x74,0x02,0x34,0x21,0x1e,0xbb,0x90,0x00,0x02,0x1e,
1278 0x0c,0x00,0x6a,0x40,0x1f,0x80,0x27,0x08,0x08,0x07,0x1f,0x61,0xc3,0x56,0x57,0x8d,
1279 0x7f,0x03,0xbe,0x06,0x00,0xb9,0x06,0x00,0xf3,0xa6,0xf9,0x75,0x19,0x33,0xc0,0x26,
1280 0x8a,0x4f,0x40,0x80,0xf9,0x06,0x72,0x0d,0x26,0x8b,0x7f,0x44,0x4f,0x26,0x02,0x01,
1281 0x83,0xff,0x3f,0x77,0xf7,0xf8,0x5f,0x5e,0xc3,0x50,0x73,0x37,0x80,0x3e,0x1f,0x00,
1282 0x00,0x75,0x2f,0xa0,0x21,0x00,0xd0,0xe0,0xb4,0x04,0x72,0x22,0xc0,0xe0,0x02,0xb4,
1283 0x10,0x72,0x1b,0xd0,0xe0,0xb4,0x08,0x72,0x15,0xc0,0xe0,0x02,0xb4,0x04,0x72,0x0e,
1284 0xd0,0xe0,0xb4,0x03,0x72,0x08,0xd0,0xe0,0xb4,0x02,0x72,0x02,0xb4,0x20,0x08,0x26,
1285 0x1f,0x00,0xf9,0x58,0xc3,0x9c,0x60,0x06,0x6a,0x40,0x07,0xbf,0x41,0x00,0xbe,0x1f,
1286 0x00,0xb9,0x04,0x00,0xf3,0xa5,0x07,0x61,0x9d,0xc3,0x1e,0x60,0x0e,0x1f,0x88,0x16,
1287 0x0c,0x00,0xe8,0xc3,0xfd,0x80,0x7c,0x05,0x00,0x74,0x08,0xc6,0x06,0x1f,0x00,0x40,
1288 0xe9,0xbb,0x00,0x50,0xb4,0x00,0xa3,0x0d,0x00,0x8a,0xc5,0xd0,0xe0,0x8a,0xd6,0x80,
1289 0xe6,0x7f,0x02,0xc6,0xf6,0x64,0x09,0x02,0xc1,0x80,0xd4,0x00,0x48,0xa3,0x0f,0x00,
1290 0x8b,0xfb,0x5b,0x8a,0xdf,0xb7,0x00,0x8a,0x8f,0x26,0x00,0x88,0x0e,0x27,0x00,0xd0,
1291 0xe2,0x72,0x73,0x23,0xc0,0x75,0x2c,0x80,0x7c,0x03,0x07,0x72,0x19,0x8a,0x44,0x17,
1292 0x40,0xb9,0x01,0x00,0xe8,0x9b,0x00,0x75,0x6e,0xff,0x0e,0x0d,0x00,0xff,0x06,0x0f,
1293 0x00,0xa1,0x0f,0x00,0xeb,0x0d,0x80,0x3e,0x27,0x00,0x4a,0x75,0x06,0x81,0xc7,0x00,
1294 0x02,0xeb,0xe6,0x8a,0x4c,0x17,0xb5,0x00,0x3b,0xc1,0x77,0x0f,0xe8,0x5d,0x00,0xe8,
1295 0x70,0x00,0x75,0x43,0x83,0x3e,0x0d,0x00,0x00,0x74,0x3c,0xa1,0x0f,0x00,0x8a,0x4c,
1296 0x17,0xb5,0x00,0xd1,0xe1,0x3b,0xc1,0x77,0x1d,0xe8,0x40,0x00,0x80,0x3e,0x27,0x00,
1297 0x4a,0x75,0x07,0xc1,0xe1,0x09,0x03,0xf9,0xeb,0x0c,0x8a,0x54,0x17,0xb6,0x00,0x2b,
1298 0xc2,0xe8,0x3e,0x00,0x75,0x11,0x83,0x3e,0x0d,0x00,0x00,0x74,0x0a,0xa1,0x0f,0x00,
1299 0x8b,0x0e,0x0d,0x00,0xe8,0x2b,0x00,0xf8,0xe8,0x2b,0x03,0xe8,0x17,0xff,0x61,0x8a,
1300 0x26,0x1f,0x00,0x1f,0x22,0xe4,0x74,0x03,0xf9,0xb0,0x00,0xc3,0x2b,0xc8,0x41,0x3b,
1301 0x0e,0x0d,0x00,0x76,0x04,0x8b,0x0e,0x0d,0x00,0x29,0x0e,0x0d,0x00,0x01,0x0e,0x0f,
1302 0x00,0xc3,0x8b,0xd8,0x88,0x0e,0x17,0x00,0xf6,0x74,0x09,0xfe,0xc4,0x88,0x26,0x13,
1303 0x00,0xd0,0xe8,0xa2,0x11,0x00,0xd0,0xd0,0x24,0x01,0xa2,0x12,0x00,0xa0,0x13,0x00,
1304 0x02,0x06,0x17,0x00,0x72,0x06,0x48,0x3a,0x44,0x09,0x76,0x07,0xc6,0x06,0x1f,0x00,
1305 0x04,0xeb,0x77,0x8a,0xc4,0x98,0xe8,0xbf,0xfc,0x74,0x18,0x8d,0x5c,0x09,0x48,0x43,
1306 0xfe,0xc4,0x8a,0x0f,0x80,0xe9,0x02,0xb5,0x01,0xd2,0xe5,0x2a,0xc5,0x73,0xf0,0x02,
1307 0xc5,0x86,0xe0,0xa2,0x13,0x00,0x88,0x26,0x16,0x00,0xe8,0xe8,0x01,0xb4,0x00,0x88,
1308 0x26,0x15,0x00,0xe8,0x92,0xfc,0x75,0x09,0xa0,0x17,0x00,0x88,0x26,0x17,0x00,0xeb,
1309 0x28,0x38,0x64,0x04,0x75,0x28,0x38,0x26,0x16,0x00,0x74,0x05,0xe8,0x31,0x00,0x72,
1310 0x29,0x38,0x26,0x17,0x00,0x74,0x23,0xe8,0x9b,0x01,0x8a,0xc8,0xa0,0x17,0x00,0xf6,
1311 0xf1,0x22,0xc0,0x74,0x09,0x88,0x26,0x17,0x00,0xe8,0x82,0x00,0x72,0x0c,0x80,0x3e,
1312 0x17,0x00,0x00,0x74,0x05,0xe8,0x08,0x00,0x73,0xf4,0x80,0x3e,0x1f,0x00,0x00,0xc3,
1313 0x50,0x80,0x3e,0x27,0x00,0x4a,0x74,0x16,0x80,0x3e,0x27,0x00,0x42,0x74,0x3b,0xe8,
1314 0xbb,0x00,0x73,0x05,0xe8,0xdb,0x00,0x72,0x48,0xe8,0x6f,0x00,0xeb,0x43,0x80,0x3e,
1315 0x16,0x00,0x00,0x75,0x09,0xe8,0x4d,0x01,0x38,0x06,0x17,0x00,0x73,0x14,0xe8,0x9c,
1316 0x00,0x73,0x0f,0xc6,0x06,0x27,0x00,0x46,0xe8,0xb7,0x00,0xc6,0x06,0x27,0x00,0x4a,
1317 0x72,0x1f,0xe8,0x46,0x00,0xe8,0xaa,0x00,0xeb,0x17,0x53,0x8a,0x1e,0x16,0x00,0xe8,
1318 0x23,0x01,0xfe,0x0e,0x17,0x00,0x74,0x05,0x43,0x3a,0xd8,0x72,0xf5,0x5b,0xe8,0x91,
1319 0x00,0x9c,0xfe,0x06,0x13,0x00,0xc6,0x06,0x16,0x00,0x00,0x9d,0x58,0xc3,0x50,0x22,
1320 0xc0,0x74,0x16,0x8a,0x26,0x13,0x00,0x88,0x26,0x14,0x00,0x02,0xc4,0x48,0xa2,0x15,
1321 0x00,0xfe,0xc0,0xe8,0x6c,0x00,0xa2,0x13,0x00,0x58,0xc3,0x50,0x53,0x51,0x56,0x8a,
1322 0x1e,0x16,0x00,0xe8,0xdf,0x00,0x53,0xc1,0xe3,0x09,0x03,0x1e,0x19,0x00,0x8b,0xf3,
1323 0xb9,0x00,0x01,0xe8,0x16,0x00,0xf3,0xa5,0xe8,0x11,0x00,0x5b,0xfe,0x0e,0x17,0x00,
1324 0x74,0x05,0x43,0x3a,0xd8,0x72,0xdf,0x5e,0x59,0x5b,0x58,0xc3,0x2e,0x80,0x3e,0x27,
1325 0x00,0x4a,0x74,0x02,0xf8,0xc3,0x87,0xf7,0x06,0x1e,0x07,0x1f,0xc3,0x50,0xa0,0x1b,
1326 0x00,0x3a,0x06,0x0c,0x00,0x75,0x18,0xa0,0x11,0x00,0x8a,0x26,0x12,0x00,0x3b,0x06,
1327 0x1c,0x00,0x75,0x0b,0xa0,0x1e,0x00,0x3a,0x06,0x13,0x00,0x75,0x02,0x58,0xc3,0xf9,
1328 0x58,0xc3,0x50,0x53,0xe8,0x78,0x01,0x73,0x0f,0x80,0x3e,0x1f,0x00,0x00,0x75,0x05,
1329 0x80,0x0e,0x1f,0x00,0x40,0xf9,0xeb,0x6a,0xe8,0x3d,0xfb,0xb0,0x02,0x74,0x0d,0x8d,
1330 0x5c,0x0a,0x02,0x1e,0x13,0x00,0x80,0xd7,0x00,0x8a,0x47,0xff,0xa2,0x18,0x00,0x80,
1331 0x3e,0x15,0x00,0x00,0x74,0x0b,0xe8,0x5c,0x02,0xc6,0x06,0x15,0x00,0x00,0x9c,0xeb,
1332 0x3d,0x06,0x57,0x0e,0x07,0x8b,0x3e,0x19,0x00,0xa0,0x13,0x00,0xa2,0x14,0x00,0xa2,
1333 0x15,0x00,0xe8,0x40,0x02,0xc6,0x06,0x15,0x00,0x00,0x5f,0x07,0x9c,0xb0,0xff,0x72,
1334 0x0a,0x80,0x3e,0x27,0x00,0x42,0x74,0x16,0xa0,0x0c,0x00,0xa2,0x1b,0x00,0xa0,0x11,
1335 0x00,0x8a,0x26,0x12,0x00,0xa3,0x1c,0x00,0xa0,0x13,0x00,0xa2,0x1e,0x00,0x9d,0xe8,
1336 0x97,0xfc,0x5b,0x58,0xc3,0xe8,0xd0,0xfa,0xb0,0x01,0x74,0x18,0x53,0x51,0x8d,0x5c,
1337 0x0a,0x02,0x1e,0x13,0x00,0x80,0xd7,0x00,0x8a,0x4f,0xff,0x80,0xe9,0x02,0xb0,0x01,
1338 0xd2,0xe0,0x59,0x5b,0xc3,0x60,0x1e,0xbb,0x40,0x00,0x53,0x1f,0xb5,0xed,0xfa,0x2e,
1339 0x8a,0x0e,0x0c,0x00,0xb0,0x01,0xd2,0xe0,0x84,0x47,0xff,0x74,0x04,0x38,0x2f,0x76,
1340 0x33,0x08,0x47,0xff,0x80,0x67,0xff,0xcf,0x8a,0xc1,0xc0,0xe0,0x04,0x08,0x47,0xff,
1341 0xc6,0x07,0xff,0xfb,0xba,0xf2,0x03,0x80,0xc1,0x04,0xb0,0x01,0xd2,0xe0,0x2e,0x0a,
1342 0x06,0x0c,0x00,0x0c,0x0c,0xee,0xb8,0xfd,0x90,0xf8,0xcd,0x15,0x72,0x06,0xb8,0xe8,
1343 0x03,0xe8,0x48,0x03,0x88,0x2f,0xfb,0x1f,0x61,0xc3,0x60,0xe8,0x68,0x00,0x8a,0x0e,
1344 0x0c,0x00,0x8a,0xc1,0xc0,0xe0,0x02,0x0c,0x01,0xd2,0xe0,0x1e,0x6a,0x40,0x1f,0xfa,
1345 0xa2,0x3f,0x00,0x80,0x26,0x3e,0x00,0x70,0x1f,0xc0,0xe0,0x04,0x0a,0xc1,0x0c,0x08,
1346 0xba,0xf2,0x03,0xee,0xe8,0x08,0x03,0x0c,0x04,0xee,0xe8,0x1a,0x02,0xb0,0x08,0xe8,
1347 0xc3,0x02,0xe8,0x82,0x02,0xe8,0x7f,0x02,0xe8,0x02,0x00,0x61,0xc3,0x50,0x1e,0x6a,
1348 0x40,0x1f,0x8a,0x26,0x8b,0x00,0x1f,0xb0,0x03,0xe8,0xa9,0x02,0xb0,0xbf,0x80,0xe4,
1349 0xc0,0x74,0x09,0xb0,0xaf,0x80,0xfc,0xc0,0x74,0x02,0xb0,0xdf,0xe8,0x96,0x02,0xb0,
1350 0x02,0xe8,0x91,0x02,0x58,0xc3,0x60,0x1e,0xb0,0xff,0x72,0x0a,0x6a,0x00,0x1f,0xc5,
1351 0x1e,0x78,0x00,0x8a,0x47,0x02,0x6a,0x40,0x1f,0xa2,0x40,0x00,0x1f,0x61,0xc3,0x60,
1352 0xe8,0x87,0x00,0xe8,0xb7,0xff,0xb4,0x01,0x8a,0x0e,0x0c,0x00,0xd2,0xe4,0x1e,0x6a,
1353 0x40,0x1f,0x84,0x26,0x3e,0x00,0x1f,0x75,0x05,0xe8,0xa6,0x00,0x72,0x69,0xbb,0x94,
1354 0x00,0x02,0x1e,0x0c,0x00,0xa0,0x11,0x00,0x1e,0x6a,0x40,0x1f,0x08,0x26,0x3e,0x00,
1355 0x8a,0x26,0x41,0x00,0x3a,0x07,0x88,0x07,0x1f,0x75,0x05,0x80,0xfc,0x40,0x75,0x44,
1356 0xb0,0x0f,0xe8,0x30,0x02,0x72,0x40,0xa0,0x12,0x00,0xc0,0xe0,0x02,0x0a,0x06,0x0c,
1357 0x00,0xe8,0x21,0x02,0xa0,0x11,0x00,0xe8,0x1b,0x02,0xe8,0x6a,0x01,0x72,0x28,0xb0,
1358 0x08,0xe8,0x11,0x02,0x72,0x21,0xe8,0xce,0x01,0x72,0x1c,0x8a,0xe0,0xe8,0xc7,0x01,
1359 0xf6,0xc4,0xc0,0x75,0x12,0xb0,0x0f,0x80,0x3e,0x27,0x00,0x4a,0x74,0x02,0xb0,0x01,
1360 0x98,0xe8,0x38,0x02,0x61,0xf8,0xc3,0x61,0xf9,0xc3,0x60,0xe8,0x4a,0xf9,0x8b,0x44,
1361 0x06,0x74,0x02,0x8a,0xc4,0x1e,0x6a,0x40,0x1f,0x8a,0x26,0x8b,0x00,0xc0,0xec,0x06,
1362 0x3a,0xc4,0x74,0x10,0xba,0xf7,0x03,0xee,0xc0,0xe0,0x06,0x80,0x26,0x8b,0x00,0x3f,
1363 0x08,0x06,0x8b,0x00,0x1f,0xbf,0x1f,0x00,0xb9,0x08,0x00,0x88,0x2d,0x47,0xe2,0xfb,
1364 0x61,0xc3,0x60,0xbb,0x94,0x00,0x02,0x1e,0x0c,0x00,0x1e,0x6a,0x40,0x1f,0x88,0x3f,
1365 0x1f,0xb9,0x02,0x00,0xb0,0x07,0xe8,0x9c,0x01,0x72,0x35,0xa0,0x12,0x00,0xc0,0xe0,
1366 0x02,0x0a,0x06,0x0c,0x00,0xe8,0x8d,0x01,0x72,0x26,0xe8,0xda,0x00,0x72,0x21,0xb0,
1367 0x08,0xe8,0x81,0x01,0x72,0x1a,0xe8,0x3e,0x01,0x72,0x15,0x8a,0xe0,0xe8,0x37,0x01,
1368 0x80,0xf4,0x20,0xf6,0xc4,0xf0,0x75,0x08,0xb8,0x01,0x00,0xe8,0xae,0x01,0xeb,0x03,
1369 0xe2,0xc2,0xf9,0x61,0xc3,0x50,0x53,0x51,0x52,0x8a,0x0e,0x18,0x00,0xb5,0x00,0xf9,
1370 0xd2,0xd5,0xb1,0x00,0xa0,0x15,0x00,0x2a,0x06,0x14,0x00,0x40,0x98,0xf7,0xe1,0x8b,
1371 0xd0,0x8b,0xc8,0x49,0x8c,0xc0,0xe8,0x72,0x00,0x72,0x6a,0xa0,0x27,0x00,0xe8,0xb7,
1372 0x00,0x3c,0x4a,0xb0,0xc5,0x74,0x02,0xb0,0xe6,0xe8,0x29,0x01,0x72,0x57,0xa0,0x12,
1373 0x00,0xc0,0xe0,0x02,0x0a,0x06,0x0c,0x00,0xe8,0x1a,0x01,0xa0,0x11,0x00,0xe8,0x14,
1374 0x01,0xa0,0x12,0x00,0xe8,0x0e,0x01,0xa0,0x14,0x00,0xe8,0x08,0x01,0xa0,0x18,0x00,
1375 0xe8,0x02,0x01,0xa0,0x15,0x00,0xe8,0xfc,0x00,0x8a,0x44,0x08,0xe8,0xf6,0x00,0xb0,
1376 0x80,0xe8,0xf1,0x00,0xe8,0x40,0x00,0x9c,0xbb,0x20,0x00,0xb9,0x07,0x00,0xe8,0xa6,
1377 0x00,0x88,0x07,0x43,0xe2,0xf8,0x9d,0x72,0x0c,0xf6,0x06,0x20,0x00,0xc0,0x75,0x05,
1378 0x03,0xfa,0xf8,0xeb,0x01,0xf9,0x5a,0x59,0x5b,0x58,0xc3,0x52,0xbb,0x10,0x00,0xf7,
1379 0xe3,0x03,0xc7,0x83,0xd2,0x00,0x8b,0xd8,0x8a,0xe2,0x8b,0xd1,0x03,0xd3,0x73,0x05,
1380 0xc6,0x06,0x1f,0x00,0x09,0x5a,0xc3,0xfb,0x60,0x1e,0x6a,0x40,0x1f,0xb8,0x01,0x90,
1381 0xf8,0xcd,0x15,0xba,0x80,0x02,0xbb,0x3e,0x00,0x72,0x0f,0x33,0xc9,0x84,0x17,0x75,
1382 0x0f,0xe8,0xf6,0x00,0xe2,0xf7,0xfe,0xce,0x75,0xf1,0x2e,0x08,0x16,0x1f,0x00,0xf9,
1383 0x9c,0x80,0x27,0x7f,0x9d,0x1f,0x61,0xc3,0x50,0xfa,0xe6,0x0b,0xb0,0x00,0xeb,0x00,
1384 0xeb,0x00,0xe6,0x0c,0x8a,0xc3,0xeb,0x00,0xeb,0x00,0xe6,0x04,0x8a,0xc7,0xeb,0x00,
1385 0xeb,0x00,0xe6,0x04,0xeb,0x00,0xeb,0x00,0x8a,0xc4,0xe6,0x81,0x8a,0xc1,0xeb,0x00,
1386 0xeb,0x00,0xe6,0x05,0x8a,0xc5,0xeb,0x00,0xeb,0x00,0xe6,0x05,0xfb,0xb0,0x02,0xeb,
1387 0x00,0xeb,0x00,0xe6,0x0a,0x58,0xc3,0x51,0x52,0x50,0xe8,0x72,0x00,0xba,0xf4,0x03,
1388 0xb9,0x85,0x00,0xeb,0x00,0xeb,0x00,0xec,0x24,0xc0,0x3c,0xc0,0x74,0x1c,0xeb,0x00,
1389 0xeb,0x00,0xe4,0x61,0x24,0x10,0x3a,0xc4,0x74,0xe9,0x8a,0xe0,0xe2,0xe5,0x58,0x5a,
1390 0x59,0x80,0x0e,0x1f,0x00,0x80,0xb0,0x00,0xf9,0xc3,0x58,0x42,0xeb,0x00,0xeb,0x00,
1391 0xec,0x5a,0x59,0xf8,0xc3,0x51,0x52,0x50,0xe8,0x34,0x00,0xba,0xf4,0x03,0xb9,0x85,
1392 0x00,0xeb,0x00,0xeb,0x00,0xec,0xa8,0x80,0x75,0x1a,0xeb,0x00,0xeb,0x00,0xe4,0x61,
1393 0x24,0x10,0x3a,0xc4,0x74,0xeb,0x8a,0xe0,0xe2,0xe7,0x58,0x5a,0x59,0x80,0x0e,0x1f,
1394 0x00,0x80,0xf9,0xc3,0x42,0x58,0xeb,0x00,0xeb,0x00,0xee,0x5a,0x59,0xf8,0xc3,0x50,
1395 0x51,0xb9,0x04,0x00,0xe8,0x23,0x00,0xe2,0xfb,0x59,0x58,0xc3,0x9c,0x60,0xba,0x4a,
1396 0x42,0xf7,0xe2,0x8a,0xcc,0x8a,0xea,0x8a,0xd6,0xb6,0x00,0xe8,0x0c,0x00,0xe2,0xfb,
1397 0x23,0xd2,0x74,0x03,0x4a,0xeb,0xf4,0x61,0x9d,0xc3,0xeb,0x00,0xeb,0x00,0xe4,0x61,
1398 0x24,0x10,0x3a,0xc4,0x74,0xf4,0x8a,0xe0,0xc3,0x1e,0x16,0x1f,0x26,0xa2,0x2b,0x00,
1399 0x26,0x88,0x26,0x43,0x00,0xbf,0xfc,0x09,0xbe,0x4c,0x00,0xfc,0xfa,0xa5,0xa5,0xc7,
1400 0x44,0xfc,0x5b,0x00,0x8c,0x44,0xfe,0xfb,0x1f,0xcb,0x00,0x00,0xd9,0x09,0x55,0xaa
1404 char program_2m_magic
[] = {
1405 0x2b,0x00,0x43,0x00,0x32,0x30,0x32,0x4d,0x2d,0x53,0x54,0x56,0x00,0x00,0x00,0x00
1413 if( read_sector(bs_offset
+1, buffer
+512) != 0 )
1416 if( memcmp(buffer
+512, program_2m_magic
, 16) == 0 )
1418 /* Seems to be properly formatted already */
1420 write_sector(bs_offset
, buffer
);
1424 else if( disk_trck
!= 82 || disk_sect
!= 22 )
1426 fprintf(stderr
, "To be bootable a 2M disk must be 22 sectors 82 tracks or formatted with DOS 2m.\n");
1427 if( !force
) exit(1);
1428 fprintf(stderr
, "But I'll try it\n");
1430 write_sector(bs_offset
, buffer
);
1432 /* This needs to be altered to allow for the disk format description to
1433 be copied from the old boot sector */
1435 if( disk_sect
== 23 ) mbr
= boot_sector_2m_23_82
;
1436 else mbr
= boot_sector_2m_22_82
;
1438 for(i
=0; i
<sysboot_dosfs_stat
; i
++)
1440 for(i
=sysboot_codestart
; i
<512; i
++)
1443 write_sector(0, buffer
);
1445 for(i
=0; i
<sizeof(program_2m_vsn_20
); i
+=512)
1447 write_sector(bs_offset
+i
/512+1, program_2m_vsn_20
+i
);
1450 fprintf(stderr
, "To be bootable a 2M disk must be formatted with the DOS 2m driver.\n");