diff options
author | Robert de Bath <rdebath@poboxes.com> | 2010-10-23 17:32:23 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:48:50 +0200 |
commit | dddc44a59e3e393d5440a06e2b0535aeb1304f77 (patch) | |
tree | cfc2b774571f7cd6513a7e2f01a04518016e4995 /bootblocks | |
parent | 62c27c1c5cb6257b13dfc9be0394e0d2e86f2735 (diff) | |
download | dev86-dddc44a59e3e393d5440a06e2b0535aeb1304f77.tar.gz |
Import Dev86src-0.16.18.tar.gzv0.16.18
Diffstat (limited to 'bootblocks')
-rw-r--r-- | bootblocks/Makefile | 76 | ||||
-rw-r--r-- | bootblocks/README | 13 | ||||
-rw-r--r-- | bootblocks/bb_init1.s | 2 | ||||
-rw-r--r-- | bootblocks/freedos.h | 72 | ||||
-rw-r--r-- | bootblocks/freedosboot.zip | bin | 0 -> 14135 bytes | |||
-rw-r--r-- | bootblocks/makeboot.c | 713 | ||||
-rw-r--r-- | bootblocks/mbr.s | 891 | ||||
-rw-r--r-- | bootblocks/mbr_dm.s | 313 | ||||
-rw-r--r-- | bootblocks/minix.c | 2 | ||||
-rw-r--r-- | bootblocks/msdos.s | 2 | ||||
-rw-r--r-- | bootblocks/nombr.s | 23 | ||||
-rw-r--r-- | bootblocks/sysboot.s | 3 | ||||
-rw-r--r-- | bootblocks/sysboot16.s | 82 | ||||
-rw-r--r-- | bootblocks/sysmbr.s | 76 | ||||
-rw-r--r-- | bootblocks/sysmbrtail.s | 13 |
15 files changed, 1431 insertions, 850 deletions
diff --git a/bootblocks/Makefile b/bootblocks/Makefile index 60d8b8f..d954ea1 100644 --- a/bootblocks/Makefile +++ b/bootblocks/Makefile @@ -11,7 +11,7 @@ LDFLAGS=-s -i -H0x10000 ASFLAGS=-0 -w MINIXDEFS=-DDOTS # CFLAGS=-ansi -Ms $(DEFS) -# LST=-l $*.lst +LST=-l $*.lst default: makeboot makeboot.com monitor.sys minix_elks.bin lsys.com @@ -20,11 +20,12 @@ all: bootbin bootsys default tgz bootsys: bootfile.sys boottar.sys bootminix.sys monitor.sys boot_win.sys CSRC=minix.c -SSRC=sysboot.s tarboot.s skip.s mbr.s msdos.s noboot.s \ +SSRC=tarboot.s skip.s mbr.s mbr_dm.s msdos.s noboot.s nombr.s \ boot_fpy.s killhd.s bb_linux.s bb_init1.s bb_init2.s +SINC=sysboot16.s sysboot.s sysmbr.s sysmbrtail.s -encap: $(SSRC:s=v) $(CSRC:c=v) minixhd.v msdos16.v -bootbin: $(SSRC:s=bin) $(CSRC:c=bin) minixhd.bin msdos16.bin minix_elks.bin +encap: $(SSRC:s=v) $(CSRC:c=v) minixhd.v mbr_chs.v mbr_lin.v mbr_lba.v pbr.v msdos16.v +bootbin: $(SSRC:s=bin) $(CSRC:c=bin) minixhd.bin mbr_chs.bin mbr_lin.bin mbr_lba.bin pbr.bin msdos16.bin minix_elks.bin MOBJ=monitor.o commands.o i86_funcs.o relocate.o help.o bzimage.o \ buffer.o unix.o fs.o fs_tar.o fs_min.o fs_dos.o @@ -33,9 +34,12 @@ MSRC=monitor.c commands.c i86_funcs.c relocate.c help.c bzimage.c \ MINC=i86_funcs.h readfs.h monitor.h BOOTBLOCKS=sysboot.v noboot.v skip.v msdos.v msdos16.v \ - tarboot.v minix.v minixhd.v mbr.v killhd.v + tarboot.v minix.v minixhd.v mbr.v killhd.v \ + sysboot16.v nombr.v mbr_dm.v mbr_chs.v mbr_lin.v mbr_lba.v \ + pbr.v -EXTRAS=minix.h zimage.s minix_elks.c lsys.c boot_win.c +EXTRAS=minix.h zimage.s minix_elks.c lsys.c boot_win.c \ + freedosboot.zip freedos.h install: makeboot install -m 755 -s makeboot $(DIST)$(PREFIX)/bin/makeboot @@ -90,23 +94,63 @@ minix_elks.s: minix_elks.c Makefile minix.v minixhd.s: minix.c Makefile $(CC) -Mf -O -DHARDDISK $(MINIXDEFS) -S minix.c -o minixhd.s -msdos16.s: msdos.s +msdos16.s: msdos.s Makefile sed 's/^fatbits=12/fatbits=16/' < msdos.s > msdos16.s -mbr_dm.s: mbr.s - sed -e 's/^diskman=0/diskman=1/' \ +mbr_chs.s: mbr.s Makefile + sed -e 's/^linear=1/linear=0/' \ + -e 's/^useCHS=0/useCHS=1/' \ + -e 's/^linCHS=1/linCHS=0/' \ + -e 's/^mbrkey=1/mbrkey=0/' \ + -e 's/^preboot=1/preboot=0/' \ + -e 's/^pbr=1/pbr=0/' \ + -e 's/^direct=1/direct=0/' \ -e 's/^message=1/message=0/' \ + < mbr.s > mbr_chs.s + +mbr_lin.s: mbr.s Makefile + sed -e 's/^linear=1/linear=0/' \ + -e 's/^useCHS=0/useCHS=1/' \ + -e 's/^linCHS=0/linCHS=1/' \ -e 's/^mbrkey=1/mbrkey=0/' \ -e 's/^preboot=1/preboot=0/' \ - < mbr.s > mbr_dm.s + -e 's/^pbr=1/pbr=0/' \ + -e 's/^direct=1/direct=0/' \ + -e 's/^message=1/message=0/' \ + < mbr.s > mbr_lin.s + +pbr.s: mbr.s Makefile + sed -e 's/^linear=0/linear=1/' \ + -e 's/^useCHS=1/useCHS=0/' \ + -e 's/^linCHS=1/linCHS=0/' \ + -e 's/^mbrkey=1/mbrkey=0/' \ + -e 's/^preboot=1/preboot=0/' \ + -e 's/^pbr=0/pbr=1/' \ + -e 's/^direct=1/direct=0/' \ + -e 's/^message=1/message=0/' \ + < mbr.s > pbr.s + +mbr_lba.s: mbr.s Makefile + sed -e 's/^linear=0/linear=1/' \ + -e 's/^useCHS=1/useCHS=0/' \ + -e 's/^linCHS=1/linCHS=0/' \ + -e 's/^mbrkey=1/mbrkey=0/' \ + -e 's/^preboot=1/preboot=0/' \ + -e 's/^pbr=1/pbr=0/' \ + -e 's/^direct=1/direct=0/' \ + -e 's/^message=1/message=0/' \ + < mbr.s > mbr_lba.s boot_win.sys: boot_win.c $(CC) -Ms -H0x6000 -s boot_win.c -o boot_win.sys -makeboot: makeboot.c $(BOOTBLOCKS) +makeboot: makeboot.c $(BOOTBLOCKS) freedos.h $(HOSTCC) $(HOSTCCFLAGS) -o makeboot makeboot.c -makeboot.com: makeboot.c $(BOOTBLOCKS) +ldboot: ldboot.c + $(HOSTCC) $(HOSTCCFLAGS) -o ldboot ldboot.c + +makeboot.com: makeboot.c $(BOOTBLOCKS) freedos.h $(CC) -Md -O -o makeboot.com makeboot.c lsys.com: lsys.c msdos.v msdos16.v @@ -115,7 +159,7 @@ lsys.com: lsys.c msdos.v msdos16.v clean realclean: rm -f bootfile.sys boottar.sys bootminix.sys monitor.sys boot_win.sys rm -f monitor makeboot bootblocks.tar.gz - rm -f minix.s minixhd.s minix_elks.s msdos16.s mbr_dm.s + rm -f minix.s minixhd.s minix_elks.s msdos16.s mbr_chs.s mbr_lin.s mbr_lba.s pbr.s rm -f *.com *.o *.bin *.out *.lst *.sym *.v *.tmp tgz: minix.bin monitor.sys makeboot.com makeboot @@ -123,8 +167,8 @@ tgz: minix.bin monitor.sys makeboot.com makeboot README Makefile \ $(MSRC) \ $(MINC) \ - makeboot.c $(CSRC) \ - $(SSRC) \ + makeboot.c $(CSRC) freedos.h \ + $(SSRC) $(SINC) \ makeboot.com minix.bin \ $(EXTRAS) makeboot tar bootblocks.tar @@ -132,7 +176,7 @@ tgz: minix.bin monitor.sys makeboot.com makeboot distribution: tar czf /tmp/bootblocks.tar.gz \ - README Makefile $(MSRC) $(MINC) makeboot.c $(CSRC) $(SSRC) $(EXTRAS) + README Makefile $(MSRC) $(MINC) makeboot.c $(CSRC) $(SSRC) $(SINC) $(EXTRAS) .SUFFIXES: .bin .v diff --git a/bootblocks/README b/bootblocks/README index 21b60b2..f8211b9 100644 --- a/bootblocks/README +++ b/bootblocks/README @@ -34,8 +34,8 @@ Contents This MBR is a very simple one with no frills by default. The actual code is less that 254 bytes long so it can be used as - an MBR for a disk with old style 'Disk manager' partitions. All 16 - partitions are bootable. + an MBR for a disk with old style 'Disk manager' partitions. + The code now only boots one of the last four partitions. Option 2 is a boot message that displayed as soon as the MBR loads. @@ -52,11 +52,6 @@ Contents can be configured to load another boot sector, for example LILO can be succesfully used in this way. - In fact LILO can be succesfully used in this way on a 2M disk, but - you must create the floppy with the real dos 2M package as superformat - does not create correct bootable 2M disks. Also beware that mounting - a 2M floppy can ... be interesting ... - Note this boot sector loads the executable 1 sector at a time, as far as my testing has gone this is only significant on 8086 machines, all others (286 8Mhz +) are fast enough to keep up at a 1-1 interleve. @@ -81,7 +76,7 @@ Contents There is also support for a helper boot which mean this is the only boot sector able to load an ELKS image (almost) directly. -1.4 ) Tar boot sector -- Cool Man!! +1.4 ) Tar boot sector This boot sector converts a tar file with a GNU Volume label into a bootable floppy image. The boot sector loads and executes the first @@ -165,4 +160,4 @@ Contents -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -Robert de Bath <robert@mayday.cix.co.uk> +Robert de Bath <robert$@debath.co.uk> diff --git a/bootblocks/bb_init1.s b/bootblocks/bb_init1.s index 41c39cb..8b85e54 100644 --- a/bootblocks/bb_init1.s +++ b/bootblocks/bb_init1.s @@ -1,4 +1,4 @@ -ORGADDR=0x0600 +ORGADDR=0x0600 ! $0500..0600 stack or move ORGADDR down. .org ORGADDR entry start diff --git a/bootblocks/freedos.h b/bootblocks/freedos.h new file mode 100644 index 0000000..5d6e1b9 --- /dev/null +++ b/bootblocks/freedos.h @@ -0,0 +1,72 @@ +/* Binaries taken from freedos */ + +char freedos_fat32lba[512] = { +0xeb,0x58,0x90,0x46,0x72,0x65,0x65,0x44,0x4f,0x53,0x20,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xfa,0x29,0xc0,0x8e,0xd8, +0xbd,0x00,0x7c,0xb8,0xe0,0x1f,0x8e,0xc0,0x89,0xee,0x89,0xef,0xb9,0x00,0x01,0xf3, +0xa5,0xea,0x7a,0x7c,0xe0,0x1f,0x00,0x00,0x60,0x00,0x8e,0xd8,0x8e,0xd0,0x8d,0x66, +0xe0,0xfb,0x88,0x56,0x40,0xbe,0xc1,0x7d,0xe8,0xf4,0x00,0x66,0x31,0xc0,0x66,0x89, +0x46,0x44,0x8b,0x46,0x0e,0x66,0x03,0x46,0x1c,0x66,0x89,0x46,0x48,0x66,0x89,0x46, +0x4c,0x66,0x8b,0x46,0x10,0x66,0xf7,0x6e,0x24,0x66,0x01,0x46,0x4c,0xb8,0x00,0x02, +0x3b,0x46,0x0b,0x74,0x08,0x01,0xc0,0xff,0x06,0x34,0x7d,0xeb,0xf3,0x66,0x8b,0x46, +0x2c,0x66,0x50,0xe8,0x94,0x00,0x72,0x4d,0xc4,0x5e,0x76,0xe8,0xb7,0x00,0x31,0xff, +0xb9,0x0b,0x00,0xbe,0xf1,0x7d,0xf3,0xa6,0x74,0x15,0x83,0xc7,0x20,0x83,0xe7,0xe0, +0x3b,0x7e,0x0b,0x75,0xeb,0x4a,0x75,0xe0,0x66,0x58,0xe8,0x34,0x00,0xeb,0xd2,0x26, +0xff,0x75,0x09,0x26,0xff,0x75,0x0f,0x66,0x58,0x29,0xdb,0x66,0x50,0xe8,0x5a,0x00, +0x72,0x0d,0xe8,0x80,0x00,0x4a,0x75,0xfa,0x66,0x58,0xe8,0x14,0x00,0xeb,0xec,0x8a, +0x5e,0x40,0xff,0x6e,0x76,0xbe,0xee,0x7d,0xe8,0x64,0x00,0x30,0xe4,0xcd,0x16,0xcd, +0x19,0x06,0x57,0x53,0x89,0xc7,0xc1,0xe7,0x02,0x50,0x8b,0x46,0x0b,0x48,0x21,0xc7, +0x58,0x66,0xc1,0xe8,0x07,0x66,0x03,0x46,0x48,0xbb,0x00,0x20,0x8e,0xc3,0x29,0xdb, +0x66,0x3b,0x46,0x44,0x74,0x07,0x66,0x89,0x46,0x44,0xe8,0x38,0x00,0x26,0x80,0x65, +0x03,0x0f,0x26,0x66,0x8b,0x05,0x5b,0x5f,0x07,0xc3,0x66,0x3d,0xf8,0xff,0xff,0x0f, +0x73,0x15,0x66,0x48,0x66,0x48,0x66,0x0f,0xb6,0x56,0x0d,0x66,0x52,0x66,0xf7,0xe2, +0x66,0x5a,0x66,0x03,0x46,0x4c,0xc3,0xf9,0xc3,0x31,0xdb,0xb4,0x0e,0xcd,0x10,0xac, +0x3c,0x00,0x75,0xf5,0xc3,0x52,0x56,0x57,0x66,0x50,0x89,0xe7,0x6a,0x00,0x6a,0x00, +0x66,0x50,0x06,0x53,0x6a,0x01,0x6a,0x10,0x89,0xe6,0x8a,0x56,0x40,0xb4,0x42,0xcd, +0x13,0x89,0xfc,0x66,0x58,0x73,0x08,0x50,0x30,0xe4,0xcd,0x13,0x58,0xeb,0xd9,0x66, +0x40,0x03,0x5e,0x0b,0x73,0x07,0x8c,0xc2,0x80,0xc6,0x10,0x8e,0xc2,0x5f,0x5e,0x5a, +0xc3,0x4c,0x6f,0x61,0x64,0x69,0x6e,0x67,0x20,0x46,0x72,0x65,0x65,0x44,0x4f,0x53, +0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4e,0x6f, +0x20,0x4b,0x45,0x52,0x4e,0x45,0x4c,0x20,0x20,0x53,0x59,0x53,0x00,0x00,0x55,0xaa +}; + + +char freedos_fat32chs[512] = { +0xeb,0x58,0x90,0x46,0x72,0x65,0x65,0x44,0x4f,0x53,0x20,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xfa,0x29,0xc0,0x8e,0xd8, +0xbd,0x00,0x7c,0xb8,0xe0,0x1f,0x8e,0xc0,0x89,0xee,0x89,0xef,0xb9,0x00,0x01,0xf3, +0xa5,0xea,0x7a,0x7c,0xe0,0x1f,0x00,0x00,0x60,0x00,0x8e,0xd8,0x8e,0xd0,0x8d,0x66, +0xe0,0xfb,0x88,0x56,0x40,0x8b,0x76,0x1c,0x8b,0x7e,0x1e,0x03,0x76,0x0e,0x83,0xd7, +0x00,0x89,0x76,0x5e,0x89,0x7e,0x60,0x8a,0x46,0x10,0x98,0x50,0xf7,0x66,0x26,0x01, +0xc7,0x58,0xf7,0x66,0x24,0x01,0xf0,0x11,0xfa,0x89,0x46,0x62,0x89,0x56,0x64,0x8b, +0x46,0x0b,0xd1,0xe8,0xd1,0xe8,0x48,0x89,0x46,0x66,0x91,0x41,0x40,0xd1,0xe9,0x81, +0xf9,0x01,0x00,0x75,0xf7,0x88,0x46,0x68,0x49,0x89,0x4e,0x48,0x89,0x4e,0x4a,0x8b, +0x46,0x2c,0x8b,0x56,0x2e,0x52,0x50,0xe8,0x9d,0x00,0x72,0x50,0x53,0xc4,0x5e,0x76, +0xe8,0xcb,0x00,0x52,0x50,0x8b,0x46,0x0b,0xb9,0x0b,0x00,0xbe,0xf1,0x7d,0x89,0xc7, +0x81,0xef,0x20,0x00,0xf3,0xa6,0x74,0x12,0x2d,0x20,0x00,0x75,0xeb,0x58,0x5a,0x5b, +0x4b,0x75,0xd9,0x58,0x5a,0xe8,0x2a,0x00,0xeb,0xcb,0x26,0x8b,0x45,0x0f,0x26,0x8b, +0x55,0x09,0x29,0xdb,0x52,0x50,0x53,0xe8,0x5d,0x00,0x72,0x55,0x89,0xdf,0x5b,0xe8, +0x8c,0x00,0x4f,0x75,0xfa,0x58,0x5a,0xe8,0x08,0x00,0xeb,0xe8,0x30,0xe4,0xcd,0x16, +0xcd,0x19,0x06,0x89,0xc7,0x23,0x7e,0x66,0x8b,0x4e,0x68,0xd1,0xea,0xd1,0xd8,0x49, +0x75,0xf9,0xd1,0xe7,0xd1,0xe7,0x03,0x46,0x5e,0x13,0x56,0x60,0x53,0xbb,0x00,0x20, +0x8e,0xc3,0x29,0xdb,0x3b,0x46,0x48,0x75,0x05,0x3b,0x56,0x4a,0x74,0x09,0x89,0x46, +0x48,0x89,0x56,0x4a,0xe8,0x47,0x00,0x5b,0x26,0x8b,0x05,0x26,0x8b,0x55,0x02,0x07, +0xc3,0x8a,0x5e,0x40,0xff,0x6e,0x76,0x81,0xfa,0xff,0x0f,0x75,0x07,0x3d,0xf8,0xff, +0x72,0x02,0xf9,0xc3,0x89,0xd1,0x2d,0x02,0x00,0x83,0xd9,0x00,0x8a,0x5e,0x0d,0x28, +0xff,0x91,0xf7,0xe3,0x91,0xf7,0xe3,0x01,0xca,0x03,0x46,0x62,0x13,0x56,0x64,0xc3, +0x31,0xdb,0xb4,0x0e,0xcd,0x10,0x5e,0xac,0x56,0x3c,0x00,0x75,0xf3,0xc3,0x52,0x50, +0x91,0x8a,0x46,0x18,0xf6,0x66,0x1a,0x91,0xf7,0xf1,0x92,0xf6,0x76,0x18,0x89,0xd1, +0x88,0xc6,0x86,0xe9,0xd0,0xc9,0xd0,0xc9,0xfe,0xc4,0x08,0xe1,0xb8,0x01,0x02,0x8a, +0x56,0x40,0xcd,0x13,0x58,0x5a,0x73,0x06,0x30,0xe4,0xcd,0x13,0xeb,0xd0,0x03,0x5e, +0x0b,0x73,0x07,0x8c,0xc1,0x80,0xc5,0x10,0x8e,0xc1,0x83,0xc0,0x01,0x83,0xd2,0x00, +0xc3,0x4b,0x45,0x52,0x4e,0x45,0x4c,0x20,0x20,0x53,0x59,0x53,0x00,0x00,0x55,0xaa +}; diff --git a/bootblocks/freedosboot.zip b/bootblocks/freedosboot.zip Binary files differnew file mode 100644 index 0000000..1fbb636 --- /dev/null +++ b/bootblocks/freedosboot.zip diff --git a/bootblocks/makeboot.c b/bootblocks/makeboot.c index fa3773f..9ee0c44 100644 --- a/bootblocks/makeboot.c +++ b/bootblocks/makeboot.c @@ -3,8 +3,12 @@ #include <ctype.h> #include <time.h> #include <string.h> +#ifndef __MSDOS__ +#include <stdlib.h> +#endif #include "sysboot.v" +#include "sysboot16.v" #include "noboot.v" #include "msdos.v" #include "msdos16.v" @@ -14,6 +18,17 @@ #include "minix.v" #include "minixhd.v" #include "mbr.v" +#include "mbr_chs.v" +#include "mbr_lin.v" +#include "mbr_lba.v" +#include "pbr.v" +#include "nombr.v" + +/* Binary bootblocks */ +#include "freedos.h" +#ifdef USE_WIN95BB +#include "win95.h" +#endif unsigned char buffer[1024]; @@ -39,32 +54,23 @@ struct bblist { int fstype; int fsmod; } bblocks[] = { -{ "tar", "Bootable GNU tar volume lable", - tarboot_data, tarboot_size, 0, 0, FS_TAR}, -{ "dos12","Boot file BOOTFILE.SYS from dos floppy", - msdos_data, msdos_size, - 1, msdos_boot_name-msdos_start, FS_DOS, 12}, -{ "dos16","Boot file BOOTFILE.SYS from FAT16 hard disk or floppy", - msdos16_data, msdos16_size, - 1, msdos16_boot_name-msdos16_start, FS_DOS, 16}, +/* Default */ +{ "stat", "Display dosfs superblock", + 0, 0, 0, 0, FS_STAT}, +{ "copy", "Copy boot block to makeboot.sav or named file", + 0, 0, 0, 0, FS_STAT}, +{ "Zap", "Clear boot block to NULs", + 0, 1024, 0, 0, FS_NONE}, + { "none", "No OS bootblock, just display message", noboot_data, noboot_size, 2, noboot_boot_message-noboot_start, FS_ADOS}, { "skip", "Bypasses floppy boot with message", skip_data, skip_size, 2, skip_mesg-skip_start, FS_ADOS}, -{ "minix","Minix floppy FS booter", - minix_data, minix_size, - 2, minix_bootfile-minix_start, FS_ZERO}, -{ "hdmin","Minix Hard disk FS booter", - minixhd_data, minixhd_size, - 2, minixhd_bootfile-minixhd_start, FS_ZERO}, -{ "killhd", "Deletes MBR from hard disk when booted", - killhd_data, killhd_size, - 2, killhd_boot_message-killhd_start, FS_ADOS}, #if __STDC__ { "mbr", "Master boot record for HD" -#if defined(mbr_Banner) || mbr_diskman || mbr_linear || mbr_mbrkey || mbr_preboot +#if defined(mbr_Banner) || mbr_diskman || mbr_linear || mbr_mbrkey || mbr_preboot || mbr_direct || mbr_pbr ", Options:" #ifdef mbr_Banner " Banner" @@ -78,12 +84,21 @@ struct bblist { "-Only" #endif #endif +#if mbr_useCHS && mbr_linCHS + " linCHS" +#endif #if mbr_mbrkey " BootKeys" #endif #if mbr_preboot " PreBoot" #endif +#if mbr_direct + " Direct" +#endif +#if mbr_pbr + " PBR" +#endif #endif , mbr_data,mbr_size, @@ -92,16 +107,53 @@ struct bblist { #else 0, 0, FS_MBR}, #endif + #else { "mbr", "Master boot record for HD", mbr_data,mbr_size, 0, 0, FS_MBR}, #endif -{ "stat", "Display dosfs superblock", - 0, 0, 0, 0, FS_STAT}, -{ "copy", "Copy boot block to makeboot.sav or named file", - 0, 0, 0, 0, FS_STAT}, -{ "Zap", "Clear boot block to NULs", - 0, 1024, 0, 0, FS_NONE}, + +{ "pbr", "LBA-Only Partition boot record", + pbr_data,pbr_size, 0, 0, FS_MBR}, +{ "mbrchs","MBR using CHS addressing and BIOS", + mbr_chs_data,mbr_chs_size, 0, 0, FS_MBR}, +{ "mbrlin","MBR using Linear addressing and CHS BIOS", + mbr_lin_data,mbr_lin_size, 0, 0, FS_MBR}, +{ "mbrlba","MBR using Linear addressing and LBA BIOS", + mbr_lba_data,mbr_lba_size, 0, 0, FS_MBR}, +{ "nombr", "Boot failure message for MBR", + nombr_data,nombr_size, + 2, nombr_message-nombr_start, FS_MBR}, + + +{ "minix","Minix floppy FS booter", + minix_data, minix_size, + 2, minix_bootfile-minix_start, FS_ZERO}, +{ "hdmin","Minix Hard disk FS booter", + minixhd_data, minixhd_size, + 2, minixhd_bootfile-minixhd_start, FS_ZERO}, +{ "tar", "Bootable GNU tar volume label", + tarboot_data, tarboot_size, 0, 0, FS_TAR}, +{ "dos12","Boot file BOOTFILE.SYS from dos floppy", + msdos_data, msdos_size, + 1, msdos_boot_name-msdos_start, FS_DOS, 12}, +{ "dos16","Boot file BOOTFILE.SYS from FAT16 hard disk or floppy", + msdos16_data, msdos16_size, + 1, msdos16_boot_name-msdos16_start, FS_DOS, 16}, +{ "fd32l","Freedos FAT32 LBA Bootblock", + freedos_fat32lba, 512, + 0, 0, FS_DOS, 32}, +{ "fd32c","Freedos FAT32 CHS Bootblock", + freedos_fat32chs, 512, + 0, 0, FS_DOS, 32}, +#ifdef USE_WIN95BB +{ "win95","The Windows 95 bootblock, (C) Microsoft.", + win95_bootblock, 512, + 0, 0, FS_DOS, 12}, +#endif +{ "killhd", "Deletes MBR from hard disk when booted", + killhd_data, killhd_size, + 2, killhd_boot_message-killhd_start, FS_ADOS}, 0 }; @@ -110,43 +162,85 @@ char * progname = ""; int disktype = 0; FILE * diskfd; -int disk_sect = 63; /* These are initilised to the maximums */ +int disk_sect = 63; /* These are initialised to the maximums */ int disk_head = 256; /* Set to the correct values when an MSDOS disk is */ int disk_trck = 256; /* successfully identified */ int force = 0; int write_zero = 1; /* Write sector 0 */ int write_one = 0; /* Write sector 1 */ -int bs_offset = 0; /* Offset of _real_ bootsector for 2m floppies */ +int copy_zero = 0; /* Copy of sector zero */ char * boot_id = 0; +/* Overrides for bpb in dos bootblocks. */ +unsigned char bpb_buffer[100]; +unsigned char bpb_flags[100]; +int has_bpb_overrides = 0; + main(argc, argv) int argc; char ** argv; { FILE * fd; - struct bblist *ptr; + struct bblist *ptr = bblocks; int i; + int ar, opton=1; + char *p; + char * bbname = 0; + char * devname = 0; progname = argv[0]; - if( argc == 4 && strcmp(argv[1], "-f") == 0 ) - { - argv++; argc--; force++; - } - if( argc != 3 ) Usage(); + /* Traditional option processing. */ + for(ar=1; ar<argc; ar++) + if(opton && argv[ar][0] == '-' && argv[ar][1] != 0) + for(p=argv[ar]+1;*p;p++) + switch(*p) { + char ch, * ap; + case '-': opton = 0; break; + case 'f': force++; break; + case 'H': set_superfield("drive=0x80"); + case 'g': set_superfield("spt=63"); + set_superfield("heads=255"); + break; + default: + ch = *p; + if (p[1]) { ap = p+1; p=" "; } + else { + if (ar+1>=argc) Usage(); + ap = argv[++ar]; + } + switch(ch) { + case 'S': set_superfield(ap); break; + default: Usage(); + } + break; + } + else { + if (bbname) Usage(); + bbname = devname; + devname = argv[ar]; + } + + if( devname == 0 ) Usage(); + /* First bootblock is default */ + if( bbname == 0 ) bbname = bblocks->name; - boot_id = strchr(argv[1], '='); + boot_id = strchr(bbname, '='); if( boot_id ) *boot_id++ = '\0'; - if( (i=strlen(argv[1])) < 2 ) Usage(); + if( (i=strlen(bbname)) < 2 ) Usage(); for(ptr = bblocks; ptr->name; ptr++) - if( strncmp(argv[1], ptr->name, i) == 0 ) break; + if( strncmp(bbname, ptr->name, i) == 0 ) break; if( ptr->name == 0 ) Usage(); - open_disk(argv[2]); + if (has_bpb_overrides && ptr != bblocks && + ptr->fstype != FS_DOS && ptr->fstype != FS_ADOS) + Usage(); + + open_disk(devname); if( read_sector(0, buffer) != 0 ) exit(1); read_sector(1, buffer+512); @@ -159,6 +253,8 @@ char ** argv; case FS_NONE: /* override */ case FS_STAT: case FS_ADOS: + if ( has_bpb_overrides ) + check_msdos(); break; case FS_DOS: check_msdos(); @@ -181,19 +277,22 @@ char ** argv; switch(ptr->fstype) { - case FS_STAT: - if( strcmp(ptr->name, "copy") == 0 ) - save_super(buffer); - else - print_super(buffer); - close_disk(); - exit(0); case FS_DOS: case FS_ADOS: - for(i=0; i<sysboot_dosfs_stat; i++) - buffer[i] = ptr->data[i]; - for(i=sysboot_codestart; i<512; i++) - buffer[i] = ptr->data[i]; + if (ptr->fsmod == 12 || ptr->fsmod == 16) + { + for(i=0; i<sysboot16_dosfs_stat; i++) + buffer[i] = ptr->data[i]; + for(i=sysboot16_codestart; i<512; i++) + buffer[i] = ptr->data[i]; + } + else + { + for(i=0; i<sysboot_dosfs_stat; i++) + buffer[i] = ptr->data[i]; + for(i=sysboot_codestart; i<512; i++) + buffer[i] = ptr->data[i]; + } break; case FS_TAR: @@ -216,6 +315,28 @@ char ** argv; break; } + if ( has_bpb_overrides ) + { + copy_superfields(buffer); + write_zero = 1; + } + + switch(ptr->fstype) + { + case FS_STAT: + if( strcmp(ptr->name, "copy") == 0 ) + save_super(buffer); + else + print_super(buffer); + + if ( !has_bpb_overrides ) + { + close_disk(); + exit(0); + } + break; + } + if( boot_id ) switch(ptr->name_type) { case 1: @@ -229,16 +350,13 @@ char ** argv; exit(1); } - if( bs_offset ) - { - if( write_zero ) do_2m_write(); - /* Don't write 1 ever! */ - } - else - { - if( write_zero ) write_sector(0, buffer); - if( write_one ) write_sector(1, buffer+512); + if( write_zero ) { + write_sector(0, buffer); + if (copy_zero) + write_sector(copy_zero, buffer); /* FAT32 backup */ } + if( write_one ) write_sector(1, buffer+512); + close_disk(); exit(0); } @@ -251,11 +369,12 @@ Usage() progname = "makeboot"; #ifdef __MSDOS__ - fprintf(stderr, "Usage: %s [-f] bootblock[=bootname] a:\n\n", progname); + fprintf(stderr, "Usage: %s [-f] [-S var=val] bootblock[=bootname] a:\n\n", progname); fprintf(stderr, "The 'a:' can be any drive or file or @: for the MBR.\n"); #else - fprintf(stderr, "Usage: %s [-f] bootblock[=bootname] /dev/fd0\n\n", progname); + fprintf(stderr, "Usage: %s [-f] [-S var=val] bootblock[=bootname] /dev/fd0\n\n", progname); #endif + fprintf(stderr, "-S sets BPB fields in the msdos filesystem superblock.\n"); fprintf(stderr, "The bootname is a filename or message to use with the block,\n"); fprintf(stderr, "the blocks are:\n"); for(;ptr->name; ptr++) @@ -753,49 +872,51 @@ copy_tarblock() #define DOS7_BOOT2 23 struct bootfields { + char * label; int offset; int length; unsigned value; long lvalue; + char * new_value; } dosflds[] = { - { 0x03, 8, 0}, - { 0x0B, 2, 0}, - { 0x0D, 1, 0}, - { 0x0E, 2, 0}, - { 0x10, 1, 0}, - { 0x11, 2, 0}, - { 0x13, 2, 0}, - { 0x15, 1, 0}, - { 0x16, 2, 0}, - { 0x18, 2, 0}, - { 0x1A, 2, 0}, - { 0x1C, 4, 0}, - - { 0x20, 4, 0}, /* DOS4+ */ - { 0x24, 1, 0}, - { 0x27, 4, 0}, - { 0x2B, 11, 0}, - { 0x36, 8, 0}, - - { 0x20, 4, 0}, /* DOS7 FAT32 */ - { 0x24, 4, 0}, - { 0x28, 2, 0}, - { 0x2A, 2, 0}, - { 0x2C, 4, 0}, - { 0x30, 2, 0}, - { 0x32, 2, 0}, - - { 0x40, 1, 0}, - { 0x43, 4, 0}, - { 0x47, 11, 0}, - { 0x52, 8, 0}, - - { 0x3e8, 4, 0}, - { 0x3ec, 4, 0}, - - { -1,0,0} + { "sysid", 0x03, 8, 0}, + { "ssize", 0x0B, 2, 0}, + { "csize", 0x0D, 1, 0}, + { "resvs", 0x0E, 2, 0}, + { "nofats", 0x10, 1, 0}, + { "noroot", 0x11, 2, 0}, + { "sects", 0x13, 2, 0}, + { "media", 0x15, 1, 0}, + { "fatlen", 0x16, 2, 0}, + { "spt", 0x18, 2, 0}, + { "heads", 0x1A, 2, 0}, + { "hidden", 0x1C, 4, 0}, + + { "lsects", 0x20, 4, 0}, /* DOS4+ */ + { "drive", 0x24, 1, 0}, + { "serial", 0x27, 4, 0}, + { "label", 0x2B, 11, 0}, + { "fatid", 0x36, 8, 0}, + + { "lsects", 0x20, 4, 0}, /* DOS7 FAT32 */ + { "fatlen", 0x24, 4, 0}, + { "flags", 0x28, 2, 0}, + { "version",0x2A, 2, 0}, + { "root", 0x2C, 4, 0}, + { "info", 0x30, 2, 0}, + { "boot", 0x32, 2, 0}, + + { "drive", 0x40, 1, 0}, + { "serial", 0x43, 4, 0}, + { "label", 0x47, 11, 0}, + { "fatid", 0x52, 8, 0}, + + { 0, 0x3e8, 4, 0}, + { 0, 0x3ec, 4, 0}, + + { 0, -1,0,0} }; print_super(bootsect) @@ -815,13 +936,13 @@ static char * fieldnames[] = { "Heads", "Hidden sectors (Partition offset)", - "Large Filesystem sector count", - "Phys drive", - "Serial number", - "Disk Label (DOS 4+)", - "FAT type", + "DOS4 Large Filesystem sector count", + "DOS4 Phys drive", + "DOS4 Serial number", + "DOS4 Disk Label (DOS 4+)", + "DOS4 FAT type", - "Large Filesystem sector count", + "FAT32 Filesystem sector count", "FAT32 FAT length", "FAT32 Flags", "FAT32 version", @@ -911,6 +1032,11 @@ char * bootsect; else dosflds[i].lvalue = dosflds[i].value = 0; } + + if (dosflds[DOS_FATLEN].value == 0) + copy_zero = dosflds[DOS7_BOOT2].value; + else + copy_zero = 0; } save_super(bootsect) @@ -926,6 +1052,61 @@ char * bootsect; fclose(fd); } +set_superfield(setstr) +char * setstr; +{ + int i, l; + char * av; + has_bpb_overrides = 1; + + av = strchr(setstr, '='); + if (av == 0) Usage(); + l = av++ - setstr; + + for(i=0; dosflds[i].offset >= 0; i++) + { + if ( dosflds[i].label && + l == strlen(dosflds[i].label) && + strncmp(dosflds[i].label, setstr, l) == 0) + dosflds[i].new_value = av; + } +} + +copy_superfields(bootsect) +char * bootsect; +{ + int i, j; + + for(i=0; dosflds[i].offset >= 0; i++) + { + if (dosflds[i].new_value == 0) continue; + if( i>= DOS4_MAXSECT && + (dosflds[DOS_FATLEN].value==0) != (i>=DOS7_MAXSECT) ) + { + continue; + } + + if( dosflds[i].length <= 4 ) + { + long v = 0; + v = strtol(dosflds[i].new_value, 0, 0); + for(j=0; j<dosflds[i].length; j++) + { + bootsect[dosflds[i].offset+j] = (v & 0xFF); + v >>= 8; + } + } + else + { + char * p = dosflds[i].new_value; + for(j=0; j<dosflds[i].length && *p; j++) + { + bootsect[dosflds[i].offset+j] = *p++; + } + } + } +} + /**************************************************************************/ check_msdos() @@ -949,35 +1130,6 @@ check_msdos() if( disk_sect > 0 && disk_head > 0 ) disk_trck = dosflds[DOS_MAXSECT].value/disk_head/disk_sect; -#ifndef __MSDOS__ - if( bs_offset == 0 && - memcmp(buffer+dosflds[DOS_SYSID].offset, "2M-STV0", 7) == 0) - { - printf("Floppy is in 2M format - reading 2nd boot block\n"); - bs_offset = dosflds[DOS_RESV].value + dosflds[DOS_FATLEN].value; - if( read_sector(bs_offset, buffer) != 0 ) - exit(1); - - decode_super(buffer); - if( dosflds[DOS_MEDIA].value < 0xF0 || - ( dosflds[DOS_MEDIA].value != (0xFF&buffer[512]) - && dosflds[DOS_RESV].value == 1 ) ) - { - if( force ) - { - printf("Bad 2nd boot block - reloading first\n"); - if( read_sector(0, buffer) != 0 ) - exit(1); - } - else - { - printf("Bad 2nd boot block\n"); - exit(1); - } - } - check_msdos(); - } -#endif return; } if(!force) exit(2); @@ -1013,22 +1165,28 @@ int bb_fatbits; fatbits=12; else if( memcmp(buffer+dosflds[DOS4_FATTYPE].offset, "FAT16", 5) == 0 ) fatbits=16; + else if(dosflds[DOS_FATLEN].value == 0) + fatbits=32; else fatbits=12+4*(numclust > 0xFF0) + 16*(numclust > 0xFFF0L); if( dosflds[DOS_NFAT].value > 2 ) err = "Too many fat copies on disk"; - else if( dosflds[DOS_NROOT].value < 15 ) - err = "Root directory has unreasonable size."; else if( dosflds[DOS_SECT].value != 512 ) err = "Drive sector size isn't 512 bytes sorry no-go."; else if( fatbits == 16 && numclust < 0xFF0 ) err = "Weirdness, FAT16 but less than $FF0 clusters"; else if( fatbits != bb_fatbits ) err = "Filesystem has the wrong fat type for this bootblock."; - else if( numclust * dosflds[DOS_CLUST].lvalue / + + if( !err && (bb_fatbits == 12 || bb_fatbits == 16)) + { + if( dosflds[DOS_NROOT].value < 15 ) + err = "Root directory has unreasonable size."; + else if( numclust * dosflds[DOS_CLUST].lvalue / dosflds[DOS_SPT].value > 65535 ) - err = "Boot sector untested with more than 65535 tracks"; + err = "Boot sector untested with more than 65535 tracks"; + } if( !err && bb_fatbits == 12 ) { @@ -1162,292 +1320,3 @@ char * mbr_data; write_zero = 1; } -/**************************************************************************/ - -#ifdef HAS_2M20 - -char boot_sector_2m_23_82[] = { -0xe9,0x7d,0x00,0x32,0x4d,0x2d,0x53,0x54,0x56,0x30,0x34,0x00,0x02,0x01,0x01,0x00, -0x02,0xe0,0x00,0xbc,0x0e,0xfa,0x0b,0x00,0x17,0x00,0x02,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x29,0x45,0xb8,0x25,0x51,0x4e,0x4f,0x20,0x4e,0x41, -0x4d,0x45,0x20,0x20,0x20,0x20,0x46,0x41,0x54,0x31,0x32,0x20,0x20,0x20,0x00,0x3f, -0x07,0x01,0x00,0x00,0x80,0x00,0x4c,0x00,0x61,0x00,0x79,0x00,0x13,0x46,0x01,0x02, -0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12, -0x13,0x40,0x03,0x07,0x81,0x04,0x04,0x8c,0x01,0x04,0x97,0x05,0x04,0xa2,0x02,0x04, -0xad,0x06,0x03,0xb3,0x03,0x04,0xbe,0x07,0x02,0x04,0x04,0x04,0x04,0x04,0x03,0x02, -0xfa,0x33,0xc0,0x8e,0xd0,0xbc,0x00,0x7c,0xb8,0xc0,0x07,0x50,0x05,0x20,0x00,0x50, -0x07,0x1f,0x33,0xf6,0x33,0xff,0xb9,0x00,0x01,0xfc,0xf3,0xa5,0x8b,0x1e,0x44,0x00, -0x8d,0x47,0x26,0x06,0x50,0xcb,0xfb,0xbe,0x1a,0x01,0xe8,0xd9,0x00,0xbb,0x78,0x00, -0x36,0xc5,0x37,0x1e,0x56,0x33,0xff,0x36,0x89,0x3f,0x36,0x8c,0x47,0x02,0xb9,0x0b, -0x00,0xf3,0xa4,0x06,0x1f,0xa0,0x18,0x00,0x88,0x45,0xf9,0x33,0xc0,0x8e,0xc0,0xbb, -0x00,0x7c,0x26,0x89,0x87,0xfe,0x01,0xb8,0x01,0x02,0x8b,0x0e,0x16,0x00,0x83,0xc1, -0x02,0x33,0xd2,0x83,0xf9,0x0a,0x72,0x1f,0x51,0xcd,0x13,0x59,0x36,0x8b,0x1e,0x13, -0x04,0x83,0xeb,0x05,0xb8,0x40,0x00,0xf7,0xe3,0x8e,0xc0,0x53,0x33,0xdb,0xb8,0x05, -0x02,0x41,0x33,0xd2,0xcd,0x13,0x5b,0x36,0x8f,0x06,0x78,0x00,0x36,0x8f,0x06,0x7a, -0x00,0x26,0x81,0x3e,0xfe,0x09,0x55,0xaa,0x75,0x60,0x36,0x89,0x1e,0x13,0x04,0x06, -0xb4,0x08,0xb3,0x00,0xb2,0x00,0xcd,0x13,0x8a,0xc3,0xb4,0x00,0x80,0xfa,0x02,0x72, -0x0c,0x50,0xb4,0x08,0xb3,0x00,0xb2,0x01,0xcd,0x13,0x58,0x8a,0xe3,0x07,0x26,0x8c, -0x06,0xfe,0x09,0x26,0xff,0x1e,0xfc,0x09,0xb8,0x01,0x02,0x33,0xd2,0x8e,0xc2,0xb9, -0x01,0x00,0xbb,0x00,0x80,0x50,0xcd,0x13,0x58,0xbb,0x00,0x7c,0x06,0x53,0x26,0x81, -0x7f,0x03,0x32,0x4d,0x75,0x04,0xb2,0x80,0xcd,0x13,0x26,0x81,0x3e,0xfe,0x7d,0x55, -0xaa,0x75,0x03,0x33,0xd2,0xcb,0x22,0xd2,0x74,0xec,0xbe,0x2f,0x01,0xe8,0x06,0x00, -0xb4,0x00,0xcd,0x16,0xcd,0x19,0x03,0x36,0x44,0x00,0xfc,0xac,0x22,0xc0,0x74,0x09, -0xb4,0x0e,0xbb,0x07,0x00,0xcd,0x10,0xeb,0xf1,0xc3,0x0d,0x0a,0x32,0x4d,0x20,0x53, -0x75,0x70,0x65,0x72,0x42,0x4f,0x4f,0x54,0x20,0x32,0x2e,0x30,0x0d,0x0a,0x00,0x0d, -0x0a,0xad,0x4e,0x6f,0x20,0x62,0x6f,0x74,0x61,0x62,0x6c,0x65,0x21,0x0d,0x0a,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x4d,0x61,0x64,0x65,0x20,0x69,0x6e,0x20,0x53,0x70,0x61,0x69,0x6e,0x00,0x55,0xaa -}; - -char boot_sector_2m_22_82[] = { -0xe9,0x6e,0x00,0x32,0x4d,0x2d,0x53,0x54,0x56,0x30,0x38,0x00,0x02,0x01,0x01,0x00, -0x02,0xe0,0x00,0x18,0x0e,0xfa,0x0b,0x00,0x16,0x00,0x02,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x29,0xcc,0x9b,0xe1,0xd4,0x4e,0x4f,0x20,0x4e,0x41, -0x4d,0x45,0x20,0x20,0x20,0x20,0x46,0x41,0x54,0x31,0x32,0x20,0x20,0x20,0x00,0x04, -0x07,0x00,0x00,0x00,0x71,0x00,0x4c,0x00,0x61,0x00,0x66,0x00,0x13,0x46,0x01,0x02, -0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12, -0x13,0x0b,0x28,0x03,0x01,0x02,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, -0x03,0xfa,0x33,0xc0,0x8e,0xd0,0xbc,0x00,0x7c,0xb8,0xc0,0x07,0x50,0x05,0x20,0x00, -0x50,0x07,0x1f,0x33,0xf6,0x33,0xff,0xb9,0x00,0x01,0xfc,0xf3,0xa5,0x8b,0x1e,0x44, -0x00,0x8d,0x47,0x26,0x06,0x50,0xcb,0xfb,0xbe,0x1a,0x01,0xe8,0xd9,0x00,0xbb,0x78, -0x00,0x36,0xc5,0x37,0x1e,0x56,0x33,0xff,0x36,0x89,0x3f,0x36,0x8c,0x47,0x02,0xb9, -0x0b,0x00,0xf3,0xa4,0x06,0x1f,0xa0,0x18,0x00,0x88,0x45,0xf9,0x33,0xc0,0x8e,0xc0, -0xbb,0x00,0x7c,0x26,0x89,0x87,0xfe,0x01,0xb8,0x01,0x02,0x8b,0x0e,0x16,0x00,0x83, -0xc1,0x02,0x33,0xd2,0x83,0xf9,0x0a,0x72,0x1f,0x51,0xcd,0x13,0x59,0x36,0x8b,0x1e, -0x13,0x04,0x83,0xeb,0x05,0xb8,0x40,0x00,0xf7,0xe3,0x8e,0xc0,0x53,0x33,0xdb,0xb8, -0x05,0x02,0x41,0x33,0xd2,0xcd,0x13,0x5b,0x36,0x8f,0x06,0x78,0x00,0x36,0x8f,0x06, -0x7a,0x00,0x26,0x81,0x3e,0xfe,0x09,0x55,0xaa,0x75,0x60,0x36,0x89,0x1e,0x13,0x04, -0x06,0xb4,0x08,0xb3,0x00,0xb2,0x00,0xcd,0x13,0x8a,0xc3,0xb4,0x00,0x80,0xfa,0x02, -0x72,0x0c,0x50,0xb4,0x08,0xb3,0x00,0xb2,0x01,0xcd,0x13,0x58,0x8a,0xe3,0x07,0x26, -0x8c,0x06,0xfe,0x09,0x26,0xff,0x1e,0xfc,0x09,0xb8,0x01,0x02,0x33,0xd2,0x8e,0xc2, -0xb9,0x01,0x00,0xbb,0x00,0x80,0x50,0xcd,0x13,0x58,0xbb,0x00,0x7c,0x06,0x53,0x26, -0x81,0x7f,0x03,0x32,0x4d,0x75,0x04,0xb2,0x80,0xcd,0x13,0x26,0x81,0x3e,0xfe,0x7d, -0x55,0xaa,0x75,0x03,0x33,0xd2,0xcb,0x22,0xd2,0x74,0xec,0xbe,0x2f,0x01,0xe8,0x06, -0x00,0xb4,0x00,0xcd,0x16,0xcd,0x19,0x03,0x36,0x44,0x00,0xfc,0xac,0x22,0xc0,0x74, -0x09,0xb4,0x0e,0xbb,0x07,0x00,0xcd,0x10,0xeb,0xf1,0xc3,0x0d,0x0a,0x32,0x4d,0x20, -0x53,0x75,0x70,0x65,0x72,0x42,0x4f,0x4f,0x54,0x20,0x32,0x2e,0x30,0x0d,0x0a,0x00, -0x0d,0x0a,0xad,0x4e,0x6f,0x20,0x62,0x6f,0x74,0x61,0x62,0x6c,0x65,0x21,0x0d,0x0a, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x4d,0x61,0x64,0x65,0x20,0x69,0x6e,0x20,0x53,0x70,0x61,0x69,0x6e,0x00,0x55,0xaa -}; - - -char program_2m_vsn_20[] = { -0x2b,0x00,0x43,0x00,0x32,0x30,0x32,0x4d,0x2d,0x53,0x54,0x56,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x4a,0x42,0x00,0x00,0x01,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfb,0xfc,0x9c,0x56,0x80, -0xfa,0x02,0x73,0x3d,0xe8,0x41,0x00,0x2e,0x80,0x3c,0x02,0x74,0x04,0x2e,0x80,0x3c, -0x04,0x72,0x2e,0x80,0xfc,0x02,0x72,0x29,0x80,0xfc,0x05,0x77,0x24,0x75,0x05,0xe8, -0x36,0x00,0xeb,0x1d,0xe8,0x85,0x00,0x73,0x09,0x5e,0x9d,0xf9,0xb8,0x00,0x06,0xca, -0x02,0x00,0x2e,0x80,0x7c,0x01,0x00,0x74,0x08,0x5e,0x9d,0xe8,0x3c,0x02,0xca,0x02, -0x00,0x5e,0x9d,0x2e,0xff,0x2e,0xfc,0x09,0x9c,0x53,0x8a,0xda,0xb7,0x00,0xd1,0xe3, -0x2e,0x8b,0xb7,0x00,0x00,0x5b,0x9d,0xc3,0x60,0xe8,0xec,0xff,0xb0,0x01,0x72,0x02, -0xb0,0x00,0x2e,0x88,0x44,0x01,0x61,0xc3,0x50,0xa0,0x12,0x00,0x0a,0x06,0x11,0x00, -0x58,0xc3,0x60,0x1e,0x6a,0x40,0x1f,0xb0,0x01,0x8a,0xca,0xd2,0xe0,0x84,0x06,0x3f, -0x00,0x75,0x04,0xf8,0xe8,0xef,0x05,0x8a,0xe2,0xc0,0xe4,0x04,0x0a,0xe0,0xc0,0xe0, -0x04,0x0c,0x0c,0x0a,0xc2,0xba,0xf2,0x03,0xfa,0x88,0x26,0x3f,0x00,0xee,0x83,0xc2, -0x05,0xeb,0x00,0xeb,0x00,0xec,0xfb,0xa8,0x80,0x1f,0x61,0xc3,0x60,0xe8,0x98,0xff, -0x2e,0x80,0x7c,0x02,0x01,0x2e,0xc6,0x44,0x02,0x00,0x74,0x08,0xe8,0xb3,0xff,0x75, -0x03,0x61,0xf8,0xc3,0xf8,0xe8,0x90,0xff,0x1e,0x06,0xbb,0x90,0x00,0x02,0xda,0x6a, -0x40,0x1f,0x80,0x27,0xef,0x0e,0x0e,0x1f,0x07,0x88,0x16,0x0c,0x00,0xf9,0xe8,0x29, -0x05,0xc6,0x06,0x11,0x00,0x01,0xc6,0x06,0x12,0x00,0x00,0xe8,0xa1,0x05,0xfe,0x0e, -0x11,0x00,0xe8,0x9a,0x05,0xf8,0xe8,0x7d,0x05,0xe8,0x76,0xff,0x74,0x07,0xc6,0x44, -0x02,0x01,0xf8,0xeb,0x68,0x1e,0x6a,0x40,0x1f,0xc6,0x06,0x41,0x00,0x06,0x1f,0xc6, -0x06,0x1b,0x00,0xff,0xc6,0x44,0x08,0x14,0xb9,0x03,0x00,0x51,0x83,0xf9,0x02,0xe8, -0xe8,0x04,0xc6,0x44,0x06,0x00,0xc6,0x06,0x11,0x00,0x00,0xc6,0x06,0x12,0x00,0x00, -0xc6,0x06,0x13,0x00,0x01,0xc6,0x06,0x16,0x00,0x00,0xc6,0x06,0x17,0x00,0x01,0xc6, -0x06,0x27,0x00,0x46,0x8b,0x3e,0x19,0x00,0xe8,0x7f,0x02,0x75,0x0b,0x59,0x8b,0x1e, -0x19,0x00,0xe8,0x1c,0x00,0xf8,0xeb,0x14,0x8a,0x44,0x06,0x40,0x3c,0x03,0x77,0x05, -0x88,0x44,0x06,0xeb,0xc1,0xc6,0x44,0x06,0x00,0x59,0xe2,0xaf,0xf9,0x07,0x1f,0x61, -0xc3,0x60,0xe8,0x88,0x00,0x72,0x5c,0x88,0x44,0x05,0x88,0x4c,0x03,0x8a,0x16,0x0c, -0x00,0xf9,0xe8,0xd3,0xfe,0x26,0x8a,0x47,0x16,0x88,0x44,0x17,0x26,0x8a,0x4f,0x41, -0x88,0x4c,0x04,0x26,0x8b,0x47,0x42,0x89,0x44,0x06,0x26,0x8a,0x47,0x18,0x88,0x44, -0x09,0x26,0x8b,0x7f,0x48,0x26,0x8a,0x41,0x01,0x8a,0xe0,0x22,0xc9,0x74,0x0a,0x80, -0xc4,0xbe,0xb0,0x0b,0xf6,0xe4,0x2d,0x3e,0x08,0xd0,0xe8,0x88,0x44,0x08,0xb9,0x0d, -0x00,0x26,0x8b,0x7f,0x4a,0x03,0xfb,0x8d,0x5c,0x0a,0x26,0x8a,0x05,0x88,0x07,0x43, -0x47,0xe2,0xf7,0x8a,0x44,0x06,0xc0,0xe0,0x06,0x0c,0x17,0x80,0x3c,0x02,0x77,0x0a, -0x24,0xf8,0x0c,0x05,0xa8,0x40,0x74,0x02,0x34,0x21,0x1e,0xbb,0x90,0x00,0x02,0x1e, -0x0c,0x00,0x6a,0x40,0x1f,0x80,0x27,0x08,0x08,0x07,0x1f,0x61,0xc3,0x56,0x57,0x8d, -0x7f,0x03,0xbe,0x06,0x00,0xb9,0x06,0x00,0xf3,0xa6,0xf9,0x75,0x19,0x33,0xc0,0x26, -0x8a,0x4f,0x40,0x80,0xf9,0x06,0x72,0x0d,0x26,0x8b,0x7f,0x44,0x4f,0x26,0x02,0x01, -0x83,0xff,0x3f,0x77,0xf7,0xf8,0x5f,0x5e,0xc3,0x50,0x73,0x37,0x80,0x3e,0x1f,0x00, -0x00,0x75,0x2f,0xa0,0x21,0x00,0xd0,0xe0,0xb4,0x04,0x72,0x22,0xc0,0xe0,0x02,0xb4, -0x10,0x72,0x1b,0xd0,0xe0,0xb4,0x08,0x72,0x15,0xc0,0xe0,0x02,0xb4,0x04,0x72,0x0e, -0xd0,0xe0,0xb4,0x03,0x72,0x08,0xd0,0xe0,0xb4,0x02,0x72,0x02,0xb4,0x20,0x08,0x26, -0x1f,0x00,0xf9,0x58,0xc3,0x9c,0x60,0x06,0x6a,0x40,0x07,0xbf,0x41,0x00,0xbe,0x1f, -0x00,0xb9,0x04,0x00,0xf3,0xa5,0x07,0x61,0x9d,0xc3,0x1e,0x60,0x0e,0x1f,0x88,0x16, -0x0c,0x00,0xe8,0xc3,0xfd,0x80,0x7c,0x05,0x00,0x74,0x08,0xc6,0x06,0x1f,0x00,0x40, -0xe9,0xbb,0x00,0x50,0xb4,0x00,0xa3,0x0d,0x00,0x8a,0xc5,0xd0,0xe0,0x8a,0xd6,0x80, -0xe6,0x7f,0x02,0xc6,0xf6,0x64,0x09,0x02,0xc1,0x80,0xd4,0x00,0x48,0xa3,0x0f,0x00, -0x8b,0xfb,0x5b,0x8a,0xdf,0xb7,0x00,0x8a,0x8f,0x26,0x00,0x88,0x0e,0x27,0x00,0xd0, -0xe2,0x72,0x73,0x23,0xc0,0x75,0x2c,0x80,0x7c,0x03,0x07,0x72,0x19,0x8a,0x44,0x17, -0x40,0xb9,0x01,0x00,0xe8,0x9b,0x00,0x75,0x6e,0xff,0x0e,0x0d,0x00,0xff,0x06,0x0f, -0x00,0xa1,0x0f,0x00,0xeb,0x0d,0x80,0x3e,0x27,0x00,0x4a,0x75,0x06,0x81,0xc7,0x00, -0x02,0xeb,0xe6,0x8a,0x4c,0x17,0xb5,0x00,0x3b,0xc1,0x77,0x0f,0xe8,0x5d,0x00,0xe8, -0x70,0x00,0x75,0x43,0x83,0x3e,0x0d,0x00,0x00,0x74,0x3c,0xa1,0x0f,0x00,0x8a,0x4c, -0x17,0xb5,0x00,0xd1,0xe1,0x3b,0xc1,0x77,0x1d,0xe8,0x40,0x00,0x80,0x3e,0x27,0x00, -0x4a,0x75,0x07,0xc1,0xe1,0x09,0x03,0xf9,0xeb,0x0c,0x8a,0x54,0x17,0xb6,0x00,0x2b, -0xc2,0xe8,0x3e,0x00,0x75,0x11,0x83,0x3e,0x0d,0x00,0x00,0x74,0x0a,0xa1,0x0f,0x00, -0x8b,0x0e,0x0d,0x00,0xe8,0x2b,0x00,0xf8,0xe8,0x2b,0x03,0xe8,0x17,0xff,0x61,0x8a, -0x26,0x1f,0x00,0x1f,0x22,0xe4,0x74,0x03,0xf9,0xb0,0x00,0xc3,0x2b,0xc8,0x41,0x3b, -0x0e,0x0d,0x00,0x76,0x04,0x8b,0x0e,0x0d,0x00,0x29,0x0e,0x0d,0x00,0x01,0x0e,0x0f, -0x00,0xc3,0x8b,0xd8,0x88,0x0e,0x17,0x00,0xf6,0x74,0x09,0xfe,0xc4,0x88,0x26,0x13, -0x00,0xd0,0xe8,0xa2,0x11,0x00,0xd0,0xd0,0x24,0x01,0xa2,0x12,0x00,0xa0,0x13,0x00, -0x02,0x06,0x17,0x00,0x72,0x06,0x48,0x3a,0x44,0x09,0x76,0x07,0xc6,0x06,0x1f,0x00, -0x04,0xeb,0x77,0x8a,0xc4,0x98,0xe8,0xbf,0xfc,0x74,0x18,0x8d,0x5c,0x09,0x48,0x43, -0xfe,0xc4,0x8a,0x0f,0x80,0xe9,0x02,0xb5,0x01,0xd2,0xe5,0x2a,0xc5,0x73,0xf0,0x02, -0xc5,0x86,0xe0,0xa2,0x13,0x00,0x88,0x26,0x16,0x00,0xe8,0xe8,0x01,0xb4,0x00,0x88, -0x26,0x15,0x00,0xe8,0x92,0xfc,0x75,0x09,0xa0,0x17,0x00,0x88,0x26,0x17,0x00,0xeb, -0x28,0x38,0x64,0x04,0x75,0x28,0x38,0x26,0x16,0x00,0x74,0x05,0xe8,0x31,0x00,0x72, -0x29,0x38,0x26,0x17,0x00,0x74,0x23,0xe8,0x9b,0x01,0x8a,0xc8,0xa0,0x17,0x00,0xf6, -0xf1,0x22,0xc0,0x74,0x09,0x88,0x26,0x17,0x00,0xe8,0x82,0x00,0x72,0x0c,0x80,0x3e, -0x17,0x00,0x00,0x74,0x05,0xe8,0x08,0x00,0x73,0xf4,0x80,0x3e,0x1f,0x00,0x00,0xc3, -0x50,0x80,0x3e,0x27,0x00,0x4a,0x74,0x16,0x80,0x3e,0x27,0x00,0x42,0x74,0x3b,0xe8, -0xbb,0x00,0x73,0x05,0xe8,0xdb,0x00,0x72,0x48,0xe8,0x6f,0x00,0xeb,0x43,0x80,0x3e, -0x16,0x00,0x00,0x75,0x09,0xe8,0x4d,0x01,0x38,0x06,0x17,0x00,0x73,0x14,0xe8,0x9c, -0x00,0x73,0x0f,0xc6,0x06,0x27,0x00,0x46,0xe8,0xb7,0x00,0xc6,0x06,0x27,0x00,0x4a, -0x72,0x1f,0xe8,0x46,0x00,0xe8,0xaa,0x00,0xeb,0x17,0x53,0x8a,0x1e,0x16,0x00,0xe8, -0x23,0x01,0xfe,0x0e,0x17,0x00,0x74,0x05,0x43,0x3a,0xd8,0x72,0xf5,0x5b,0xe8,0x91, -0x00,0x9c,0xfe,0x06,0x13,0x00,0xc6,0x06,0x16,0x00,0x00,0x9d,0x58,0xc3,0x50,0x22, -0xc0,0x74,0x16,0x8a,0x26,0x13,0x00,0x88,0x26,0x14,0x00,0x02,0xc4,0x48,0xa2,0x15, -0x00,0xfe,0xc0,0xe8,0x6c,0x00,0xa2,0x13,0x00,0x58,0xc3,0x50,0x53,0x51,0x56,0x8a, -0x1e,0x16,0x00,0xe8,0xdf,0x00,0x53,0xc1,0xe3,0x09,0x03,0x1e,0x19,0x00,0x8b,0xf3, -0xb9,0x00,0x01,0xe8,0x16,0x00,0xf3,0xa5,0xe8,0x11,0x00,0x5b,0xfe,0x0e,0x17,0x00, -0x74,0x05,0x43,0x3a,0xd8,0x72,0xdf,0x5e,0x59,0x5b,0x58,0xc3,0x2e,0x80,0x3e,0x27, -0x00,0x4a,0x74,0x02,0xf8,0xc3,0x87,0xf7,0x06,0x1e,0x07,0x1f,0xc3,0x50,0xa0,0x1b, -0x00,0x3a,0x06,0x0c,0x00,0x75,0x18,0xa0,0x11,0x00,0x8a,0x26,0x12,0x00,0x3b,0x06, -0x1c,0x00,0x75,0x0b,0xa0,0x1e,0x00,0x3a,0x06,0x13,0x00,0x75,0x02,0x58,0xc3,0xf9, -0x58,0xc3,0x50,0x53,0xe8,0x78,0x01,0x73,0x0f,0x80,0x3e,0x1f,0x00,0x00,0x75,0x05, -0x80,0x0e,0x1f,0x00,0x40,0xf9,0xeb,0x6a,0xe8,0x3d,0xfb,0xb0,0x02,0x74,0x0d,0x8d, -0x5c,0x0a,0x02,0x1e,0x13,0x00,0x80,0xd7,0x00,0x8a,0x47,0xff,0xa2,0x18,0x00,0x80, -0x3e,0x15,0x00,0x00,0x74,0x0b,0xe8,0x5c,0x02,0xc6,0x06,0x15,0x00,0x00,0x9c,0xeb, -0x3d,0x06,0x57,0x0e,0x07,0x8b,0x3e,0x19,0x00,0xa0,0x13,0x00,0xa2,0x14,0x00,0xa2, -0x15,0x00,0xe8,0x40,0x02,0xc6,0x06,0x15,0x00,0x00,0x5f,0x07,0x9c,0xb0,0xff,0x72, -0x0a,0x80,0x3e,0x27,0x00,0x42,0x74,0x16,0xa0,0x0c,0x00,0xa2,0x1b,0x00,0xa0,0x11, -0x00,0x8a,0x26,0x12,0x00,0xa3,0x1c,0x00,0xa0,0x13,0x00,0xa2,0x1e,0x00,0x9d,0xe8, -0x97,0xfc,0x5b,0x58,0xc3,0xe8,0xd0,0xfa,0xb0,0x01,0x74,0x18,0x53,0x51,0x8d,0x5c, -0x0a,0x02,0x1e,0x13,0x00,0x80,0xd7,0x00,0x8a,0x4f,0xff,0x80,0xe9,0x02,0xb0,0x01, -0xd2,0xe0,0x59,0x5b,0xc3,0x60,0x1e,0xbb,0x40,0x00,0x53,0x1f,0xb5,0xed,0xfa,0x2e, -0x8a,0x0e,0x0c,0x00,0xb0,0x01,0xd2,0xe0,0x84,0x47,0xff,0x74,0x04,0x38,0x2f,0x76, -0x33,0x08,0x47,0xff,0x80,0x67,0xff,0xcf,0x8a,0xc1,0xc0,0xe0,0x04,0x08,0x47,0xff, -0xc6,0x07,0xff,0xfb,0xba,0xf2,0x03,0x80,0xc1,0x04,0xb0,0x01,0xd2,0xe0,0x2e,0x0a, -0x06,0x0c,0x00,0x0c,0x0c,0xee,0xb8,0xfd,0x90,0xf8,0xcd,0x15,0x72,0x06,0xb8,0xe8, -0x03,0xe8,0x48,0x03,0x88,0x2f,0xfb,0x1f,0x61,0xc3,0x60,0xe8,0x68,0x00,0x8a,0x0e, -0x0c,0x00,0x8a,0xc1,0xc0,0xe0,0x02,0x0c,0x01,0xd2,0xe0,0x1e,0x6a,0x40,0x1f,0xfa, -0xa2,0x3f,0x00,0x80,0x26,0x3e,0x00,0x70,0x1f,0xc0,0xe0,0x04,0x0a,0xc1,0x0c,0x08, -0xba,0xf2,0x03,0xee,0xe8,0x08,0x03,0x0c,0x04,0xee,0xe8,0x1a,0x02,0xb0,0x08,0xe8, -0xc3,0x02,0xe8,0x82,0x02,0xe8,0x7f,0x02,0xe8,0x02,0x00,0x61,0xc3,0x50,0x1e,0x6a, -0x40,0x1f,0x8a,0x26,0x8b,0x00,0x1f,0xb0,0x03,0xe8,0xa9,0x02,0xb0,0xbf,0x80,0xe4, -0xc0,0x74,0x09,0xb0,0xaf,0x80,0xfc,0xc0,0x74,0x02,0xb0,0xdf,0xe8,0x96,0x02,0xb0, -0x02,0xe8,0x91,0x02,0x58,0xc3,0x60,0x1e,0xb0,0xff,0x72,0x0a,0x6a,0x00,0x1f,0xc5, -0x1e,0x78,0x00,0x8a,0x47,0x02,0x6a,0x40,0x1f,0xa2,0x40,0x00,0x1f,0x61,0xc3,0x60, -0xe8,0x87,0x00,0xe8,0xb7,0xff,0xb4,0x01,0x8a,0x0e,0x0c,0x00,0xd2,0xe4,0x1e,0x6a, -0x40,0x1f,0x84,0x26,0x3e,0x00,0x1f,0x75,0x05,0xe8,0xa6,0x00,0x72,0x69,0xbb,0x94, -0x00,0x02,0x1e,0x0c,0x00,0xa0,0x11,0x00,0x1e,0x6a,0x40,0x1f,0x08,0x26,0x3e,0x00, -0x8a,0x26,0x41,0x00,0x3a,0x07,0x88,0x07,0x1f,0x75,0x05,0x80,0xfc,0x40,0x75,0x44, -0xb0,0x0f,0xe8,0x30,0x02,0x72,0x40,0xa0,0x12,0x00,0xc0,0xe0,0x02,0x0a,0x06,0x0c, -0x00,0xe8,0x21,0x02,0xa0,0x11,0x00,0xe8,0x1b,0x02,0xe8,0x6a,0x01,0x72,0x28,0xb0, -0x08,0xe8,0x11,0x02,0x72,0x21,0xe8,0xce,0x01,0x72,0x1c,0x8a,0xe0,0xe8,0xc7,0x01, -0xf6,0xc4,0xc0,0x75,0x12,0xb0,0x0f,0x80,0x3e,0x27,0x00,0x4a,0x74,0x02,0xb0,0x01, -0x98,0xe8,0x38,0x02,0x61,0xf8,0xc3,0x61,0xf9,0xc3,0x60,0xe8,0x4a,0xf9,0x8b,0x44, -0x06,0x74,0x02,0x8a,0xc4,0x1e,0x6a,0x40,0x1f,0x8a,0x26,0x8b,0x00,0xc0,0xec,0x06, -0x3a,0xc4,0x74,0x10,0xba,0xf7,0x03,0xee,0xc0,0xe0,0x06,0x80,0x26,0x8b,0x00,0x3f, -0x08,0x06,0x8b,0x00,0x1f,0xbf,0x1f,0x00,0xb9,0x08,0x00,0x88,0x2d,0x47,0xe2,0xfb, -0x61,0xc3,0x60,0xbb,0x94,0x00,0x02,0x1e,0x0c,0x00,0x1e,0x6a,0x40,0x1f,0x88,0x3f, -0x1f,0xb9,0x02,0x00,0xb0,0x07,0xe8,0x9c,0x01,0x72,0x35,0xa0,0x12,0x00,0xc0,0xe0, -0x02,0x0a,0x06,0x0c,0x00,0xe8,0x8d,0x01,0x72,0x26,0xe8,0xda,0x00,0x72,0x21,0xb0, -0x08,0xe8,0x81,0x01,0x72,0x1a,0xe8,0x3e,0x01,0x72,0x15,0x8a,0xe0,0xe8,0x37,0x01, -0x80,0xf4,0x20,0xf6,0xc4,0xf0,0x75,0x08,0xb8,0x01,0x00,0xe8,0xae,0x01,0xeb,0x03, -0xe2,0xc2,0xf9,0x61,0xc3,0x50,0x53,0x51,0x52,0x8a,0x0e,0x18,0x00,0xb5,0x00,0xf9, -0xd2,0xd5,0xb1,0x00,0xa0,0x15,0x00,0x2a,0x06,0x14,0x00,0x40,0x98,0xf7,0xe1,0x8b, -0xd0,0x8b,0xc8,0x49,0x8c,0xc0,0xe8,0x72,0x00,0x72,0x6a,0xa0,0x27,0x00,0xe8,0xb7, -0x00,0x3c,0x4a,0xb0,0xc5,0x74,0x02,0xb0,0xe6,0xe8,0x29,0x01,0x72,0x57,0xa0,0x12, -0x00,0xc0,0xe0,0x02,0x0a,0x06,0x0c,0x00,0xe8,0x1a,0x01,0xa0,0x11,0x00,0xe8,0x14, -0x01,0xa0,0x12,0x00,0xe8,0x0e,0x01,0xa0,0x14,0x00,0xe8,0x08,0x01,0xa0,0x18,0x00, -0xe8,0x02,0x01,0xa0,0x15,0x00,0xe8,0xfc,0x00,0x8a,0x44,0x08,0xe8,0xf6,0x00,0xb0, -0x80,0xe8,0xf1,0x00,0xe8,0x40,0x00,0x9c,0xbb,0x20,0x00,0xb9,0x07,0x00,0xe8,0xa6, -0x00,0x88,0x07,0x43,0xe2,0xf8,0x9d,0x72,0x0c,0xf6,0x06,0x20,0x00,0xc0,0x75,0x05, -0x03,0xfa,0xf8,0xeb,0x01,0xf9,0x5a,0x59,0x5b,0x58,0xc3,0x52,0xbb,0x10,0x00,0xf7, -0xe3,0x03,0xc7,0x83,0xd2,0x00,0x8b,0xd8,0x8a,0xe2,0x8b,0xd1,0x03,0xd3,0x73,0x05, -0xc6,0x06,0x1f,0x00,0x09,0x5a,0xc3,0xfb,0x60,0x1e,0x6a,0x40,0x1f,0xb8,0x01,0x90, -0xf8,0xcd,0x15,0xba,0x80,0x02,0xbb,0x3e,0x00,0x72,0x0f,0x33,0xc9,0x84,0x17,0x75, -0x0f,0xe8,0xf6,0x00,0xe2,0xf7,0xfe,0xce,0x75,0xf1,0x2e,0x08,0x16,0x1f,0x00,0xf9, -0x9c,0x80,0x27,0x7f,0x9d,0x1f,0x61,0xc3,0x50,0xfa,0xe6,0x0b,0xb0,0x00,0xeb,0x00, -0xeb,0x00,0xe6,0x0c,0x8a,0xc3,0xeb,0x00,0xeb,0x00,0xe6,0x04,0x8a,0xc7,0xeb,0x00, -0xeb,0x00,0xe6,0x04,0xeb,0x00,0xeb,0x00,0x8a,0xc4,0xe6,0x81,0x8a,0xc1,0xeb,0x00, -0xeb,0x00,0xe6,0x05,0x8a,0xc5,0xeb,0x00,0xeb,0x00,0xe6,0x05,0xfb,0xb0,0x02,0xeb, -0x00,0xeb,0x00,0xe6,0x0a,0x58,0xc3,0x51,0x52,0x50,0xe8,0x72,0x00,0xba,0xf4,0x03, -0xb9,0x85,0x00,0xeb,0x00,0xeb,0x00,0xec,0x24,0xc0,0x3c,0xc0,0x74,0x1c,0xeb,0x00, -0xeb,0x00,0xe4,0x61,0x24,0x10,0x3a,0xc4,0x74,0xe9,0x8a,0xe0,0xe2,0xe5,0x58,0x5a, -0x59,0x80,0x0e,0x1f,0x00,0x80,0xb0,0x00,0xf9,0xc3,0x58,0x42,0xeb,0x00,0xeb,0x00, -0xec,0x5a,0x59,0xf8,0xc3,0x51,0x52,0x50,0xe8,0x34,0x00,0xba,0xf4,0x03,0xb9,0x85, -0x00,0xeb,0x00,0xeb,0x00,0xec,0xa8,0x80,0x75,0x1a,0xeb,0x00,0xeb,0x00,0xe4,0x61, -0x24,0x10,0x3a,0xc4,0x74,0xeb,0x8a,0xe0,0xe2,0xe7,0x58,0x5a,0x59,0x80,0x0e,0x1f, -0x00,0x80,0xf9,0xc3,0x42,0x58,0xeb,0x00,0xeb,0x00,0xee,0x5a,0x59,0xf8,0xc3,0x50, -0x51,0xb9,0x04,0x00,0xe8,0x23,0x00,0xe2,0xfb,0x59,0x58,0xc3,0x9c,0x60,0xba,0x4a, -0x42,0xf7,0xe2,0x8a,0xcc,0x8a,0xea,0x8a,0xd6,0xb6,0x00,0xe8,0x0c,0x00,0xe2,0xfb, -0x23,0xd2,0x74,0x03,0x4a,0xeb,0xf4,0x61,0x9d,0xc3,0xeb,0x00,0xeb,0x00,0xe4,0x61, -0x24,0x10,0x3a,0xc4,0x74,0xf4,0x8a,0xe0,0xc3,0x1e,0x16,0x1f,0x26,0xa2,0x2b,0x00, -0x26,0x88,0x26,0x43,0x00,0xbf,0xfc,0x09,0xbe,0x4c,0x00,0xfc,0xfa,0xa5,0xa5,0xc7, -0x44,0xfc,0x5b,0x00,0x8c,0x44,0xfe,0xfb,0x1f,0xcb,0x00,0x00,0xd9,0x09,0x55,0xaa -}; -#endif - -char program_2m_magic[] = { -0x2b,0x00,0x43,0x00,0x32,0x30,0x32,0x4d,0x2d,0x53,0x54,0x56,0x00,0x00,0x00,0x00 -}; - -do_2m_write() -{ - int i; - char * mbr; - - if( read_sector(bs_offset+1, buffer+512) != 0 ) - exit(1); - - if( memcmp(buffer+512, program_2m_magic, 16) == 0 ) - { - /* Seems to be properly formatted already */ - - write_sector(bs_offset, buffer); - return; - } -#ifdef HAS_2M20 - else if( disk_trck != 82 || disk_sect != 22 ) - { - fprintf(stderr, "To be bootable a 2M disk must be 22 sectors 82 tracks or formatted with DOS 2m.\n"); - if( !force ) exit(1); - fprintf(stderr, "But I'll try it\n"); - } - write_sector(bs_offset, buffer); - - /* This needs to be altered to allow for the disk format description to - be copied from the old boot sector */ - - if( disk_sect == 23 ) mbr = boot_sector_2m_23_82; - else mbr = boot_sector_2m_22_82; - - for(i=0; i<sysboot_dosfs_stat; i++) - buffer[i] = mbr[i]; - for(i=sysboot_codestart; i<512; i++) - buffer[i] = mbr[i]; - - write_sector(0, buffer); - - for(i=0; i<sizeof(program_2m_vsn_20); i+=512) - { - write_sector(bs_offset+i/512+1, program_2m_vsn_20+i); - } -#else - fprintf(stderr, "To be bootable a 2M disk must be formatted with the DOS 2m driver.\n"); - exit(1); -#endif -} diff --git a/bootblocks/mbr.s b/bootblocks/mbr.s index fdfadca..fb3ac50 100644 --- a/bootblocks/mbr.s +++ b/bootblocks/mbr.s @@ -1,513 +1,606 @@ ! ! This is a 'Master Boot Record' following the MSDOS 'standards'. -! This BB successfully boots MSDOS or Linux. +! This BB successfully boots MSDOS, Windows or Linux in CHS or Linear. ! -! In addition it can: -! Display a message configure at install time. -! Load and execute a small program before the boot blocks are checked. -! -! Or -! -! Space for 12 extra partitions in the 'Old Disk Manager' form that Linux -! _does_ understand (unfortunatly there doesn't appear to be an fdisk that -! understands them.) +! Copyright GPL2, Robert de Bath, 1996-2008. ! ! NB: This needs as86 0.16.0 or later - +! ! Lowest available is $0500, MSDOS appears to use $0600 ... I wonder why? -ORGADDR=$0500 -copyright=1 ! Add in the copyright message; if room. -preboot=0 ! Include the pre-boot loader. -mbrkey=0 ! Option to choose the boot record based on keystroke -message=1 ! Display boot message -use512=0 ! Put the end marker at byte 510..512 -markptab=1 ! Put an end marker just below the partition table. +ORGADDR=$0600 +BOOTADDR=0x7c00 -diskman=0 ! Disk manager partitions, allows 16 partitions but - ! don't overwrite this with a LILO BB. +pbr=0 ! Make this a partition boot record for ldboot. +direct=1 ! Direct boot from MBR to any sector. -linear=1 ! Use the linear addresses not the CHS ones (if available) +copyright=0 ! Add in the copyright message; if room. +mbrkey=0 ! Option to choose the boot record based on keystroke (107) +message=1 ! Display boot message (6+message space) + +markptab=1 ! Put an end marker just below the partition table. +use512=0 ! Put the end marker at byte 510..512 + +linear=1 ! Use the LBA BIOS addresses. useCHS=1 ! Disable CHS if you need space. +linCHS=1 ! Calculate CHS from linear mbr values. (41 bytes) -partition_start=ORGADDR+0x1BE -partition_size=0x10 -partition_end=ORGADDR+0x1FE +preboot=0 ! Include the pre-boot loader. (40 bytes) - if diskman - ! Partition table start ... - table_start=ORGADDR+0xFC - low_partition=table_start+2 - else - table_start=partition_start - endif +if linCHS + ! Allow immediate shifts etc. + use16 186 +endif + mbr_extras=ORGADDR+0x1B6 + partition_start=ORGADDR+0x1BE + partition_size=0x10 + partition_end=ORGADDR+0x1FE + +if pbr|direct + table_start=ORGADDR+0x1A2 ! Space for special table. +else + table_start=mbr_extras +endif +export pbr +export direct export linear -export diskman export useCHS +export linCHS export mbrkey +export end_of_code + +if preboot export preboot +endif org ORGADDR - cli ! Assume _nothing_! - cld - mov bx,#$7C00 ! Pointer to start of BB. - xor ax,ax ! Segs all to zero - mov ds,ax - mov es,ax - mov ss,ax - mov sp,bx ! SP Just below BB - mov cx,#$100 ! Move 256 words - mov si,bx ! From default BB - mov di,#ORGADDR ! To the correct address. - rep - movsw - jmpi cont,#0 ! Set CS:IP correct. + if pbr + ! Skip a potential MSDOS BPB. +boot_start: + j code + nop ! DOS appears to _require_ this to identify an MSDOS disk!! + + .blkb boot_start+3-* + .ascii "LINUX" ! System ID + .byte 0,0,0 + .blkb boot_start+0x5A-* +code: + endif + + cli ! Assume _nothing_! (needed for NT 4) + cld + mov bx,#BOOTADDR ! Pointer to start of BB. + xor ax,ax ! Segs all to zero + mov ss,ax + mov sp,bx ! SP Just below BB + if pbr + push [si+10] ! Save the inbound disk offset and drive + push [si+8] ! As if called pbr(drive, offset) + push dx + endif + mov ds,ax + mov es,ax + mov cx,#$100 ! Move 256 words + mov si,bx ! From default BB + mov di,#ORGADDR ! To the correct address. + rep + movsw + jmpi cont,#0 ! Set CS:IP correct. cont: - sti ! Let the interrupts back in. + sti ! Let the interrupts back in. + if pbr + pop [boot_drive] + pop [boot_part] + pop [boot_part+2] + endif + +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ! Next check for a pre-boot message, load or keypress - if message - call disp_message - endif - if preboot - call preboot_code - endif - if mbrkey - call key_wait - endif - - if (linear|useCHS) + if message + call disp_message + endif + if preboot + call preboot_code + endif + if mbrkey + call key_wait + endif +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +! + if (linear|useCHS) + + if pbr=0 ! Now check the partition table, must use SI as pointer cause that's what the ! partition boot blocks expect. -! If we're using diskman and we're short of space check the partitions in -! physical order. (Order. 4,3,2,1,5,6,7,8,9,10,11,12,13,14,15,16) - - if (diskman&linear&useCHS) - - mov si,#partition_end -check_next: - sub si,#partition_size - cmp byte [si],#$80 ! Flag for activated partition - jz found_active - cmp si,#low_partition - jnz check_next - - else - ! Normal active partition check, (Order: 1,2,3,4) - mov si,#partition_start + mov si,#partition_start check_active: - cmp byte [si],#$80 ! Flag for activated partition - jz found_active + cmp byte [si],#$80 ! Flag for activated partition + jz found_active + if direct=0 +try_next_part: ! Only if no direct. + endif + add si,#partition_size + cmp si,#partition_end + jnz check_active + endif + + if pbr|direct + mov si,#table_start + cmp byte [si],#0 + jnz found_active try_next_part: - add si,#partition_size - cmp si,#partition_end - jnz check_active - -! Check for Disk manager partitions in the order that Linux numbers them. - if diskman&~(linear&useCHS) - cmp word ptr diskman_magic,#$AA55 - jnz no_diskman - mov si,#partition_start -check_next: - sub si,#partition_size - cmp byte [si],#$80 ! Flag for activated partition - jz found_active - cmp si,#low_partition - jnz check_next - -no_diskman: - endif - endif - - if mbrkey=0 -bad_boot: - endif - mov si,#no_bootpart ! Message & boot - jmp no_boot + endif + + jmp no_partition +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ! Active partition found, boot it. found_active: - mov di,#6 ! Max retries, int doc says 3 ... double it - movb [$7DFE],#0 ! Clear magic for dosemu + mov di,#6 ! Max retries, int doc says 3 ... double it + movb [$7DFE],#0 ! Clear magic for dosemu retry: +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ! If the BIOS has LBA extensions use them. - if linear - if useCHS - mov ah,#$41 - mov bx,#$55AA - mov dx,[si] ! dh = Drive head, dl = $80 ie HD drive 0 - push si ! Save SI on read. - if mbrkey - test dl,#$80 - jz do_CHS - endif - int $13 - jc do_CHS - cmp bx,#$AA55 - jnz do_CHS - else - mov dx,[si] ! dh = Drive head, dl = $80 ie HD drive 0 - push si ! Save SI - endif - mov bx,#disk_address - mov ax,[si+8] - mov [bx],ax - mov ax,[si+10] - mov [bx+2],ax - mov si,#disk_packet - mov ah,#$42 - int $13 - pop si - jc retry_error - j sector_loaded -disk_packet: - .byte $10 - .byte 0 - .word 1 - .word $7C00 - .word 0 -disk_address: - .long 0 - .long 0 - - if useCHS +! If we have no CHS don't check for LBA just use it. + if linear + mov dx,[si] ! dh = Drive head, dl = $80 ie HD drive 0 + + if useCHS + mov ah,#$41 + mov bx,#$55AA + if mbrkey + test dl,#$80 + jz do_CHS + endif + int $13 + jc do_CHS ! Unknown call + cmp bx,#$AA55 + jnz do_CHS ! Wrong call + test cl,#1 + jz do_CHS ! EDD basic functions OK. + endif + + push si ! Save SI on read. + + if pbr|direct + mov ax,[si+8] ! 32bit disk address + mov cx,[si+10] + cmp si,#table_start + jnz normal_part + add ax,[boot_offset] + adc cx,[boot_offset+2] +normal_part: + endif + + xor bx,bx + push bx ! 64bit disk address + push bx + if pbr|direct + push cx ! 32bit disk address + push ax + else + push [si+10] ! 32bit disk address + push [si+8] + endif + push bx ! Load segment + push #BOOTADDR ! Load address + push #1 ! Number of sectors + push #16 ! Packet size + mov si,sp + mov ah,#$42 + int $13 + lea sp,[si+16] + + pop si + jc retry_error + j sector_loaded + + endif !linear + + if useCHS do_CHS: - pop si - endif - endif - -if useCHS - mov dx,[si] ! dh = Drive head, dl = $80 ie HD drive 0 - mov cx,[si+2] ! cx = Sector & head encoded for int $13 - ! bx is correct at $7C00 - - mov ax,#$0201 ! Read 1 sector - int $13 ! Disk read. - jnc sector_loaded -endif + + if linCHS + call calc_chs + else + mov dx,[si] ! dh = Drive head, dl = $80 ie HD drive 0 + mov cx,[si+2] ! cx = Sector & head encoded for int $13 + endif + + mov bx,#BOOTADDR ! Pointer to start of BB. + mov ax,#$0201 ! Read 1 sector + int $13 ! Disk read. + jnc sector_loaded + endif ! Error, reset and retry retry_error: - xor ax,ax - int $13 ! Disk reset + xor ax,ax + int $13 ! Disk reset - dec di - jnz retry ! Try again + dec di + jnz retry ! Try again - mov si,#disk_read_error - jmp no_boot ! Sorry it ain't gonna work. + mov si,#disk_read_error + jmp no_boot ! Sorry it ain't gonna work. sector_loaded: - mov di,#$7DFE ! End of sector loaded - cmp [di],#$AA55 ! Check for magic - if diskman - jnz bad_boot ! Can't try again, two places to return to. - else - jnz try_next_part ! No? Try next partition. - endif - - mov bp,si ! LILO says some BBs use bp rather than si - jmpi #$7C00,#0 ! Go! + mov di,#$7DFE ! End of sector loaded + cmp [di],#$AA55 ! Check for magic + jnz try_next_part ! No? Try next partition. - else - mov si,#no_bootpart ! Message & boot - endif !(linear|useCHS) + mov bp,si ! LILO says some BBs use bp rather than si + jmpi #BOOTADDR,#0 ! Go! -! Fatal errors ........... - if mbrkey -bad_boot: - mov si,#no_bootpart +no_partition: + mov si,#no_bootpart no_boot: ! SI now has pointer to error message - call puts - mov si,#crlf - call puts - j key_pause + call puts - else + endif !(linear|useCHS) -no_boot: ! SI now has pointer to error message - lodsb - cmp al,#0 - jz EOS - mov bx,#7 - mov ah,#$E ! Can't use $13 cause that's AT+ only! - int $10 - jmp no_boot -EOS: - cmp si,#press_end ! After msg output 'press key' message - jz keyboot - mov si,#press_key - jmp no_boot +! Fatal errors ........... + if mbrkey + mov si,#crlf + call puts + j key_pause + else + + mov si,#press_key + call puts keyboot: ! Wait for a key then reboot - xor ax,ax - int $16 - jmpi $0,$FFFF ! Reboot. + xor ax,ax + int $16 + jmpi $0,$FFFF ! Reboot. + endif + + if useCHS + if linCHS + +calc_chs: ! From lilo. + mov ah,#8 + int $13 ! Drive Geom + shr dx,#8 + xchg ax,dx + inc ax ! AX = No. Heads + dec cx ! Davide BIOS bug: CX=0 => Sectors=64 + and cx,#$3f ! CX = Sectors + inc cx + + mul cx + xchg ax,bx ! BX = Cylinder size + + mov ax,[si+8] ! Linear partition address. + mov dx,[si+10] + + if pbr|direct + cmp si,#table_start + jnz std_part + add ax,[boot_offset] + adc dx,[boot_offset+2] +std_part: + endif + + div bx ! AX = Cyl, DX = head & sect + + shl ah,#6 + xchg ah,al + xchg dx,ax + div cl ! AH = sect-1, AL = Head + or dl,ah ! merge for CX arg. + mov cx,dx + inc cx ! Adjust sector No. + + mov dx,[si] ! dh = Orig Drive head, dl = $80 ie HD drive 0 + + mov dh,al ! Head No. + ; CX & DX ready for int $13 + ret + + endif + endif +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +! + if message +disp_message: + mov si,#Banner + endif + +! Display message uses SI,AX,BX +puts: ! This is smaller than using $13 + lodsb + cmp al,#0 + jz .EOS + mov bx,#7 + mov ah,#$E + int $10 + jmp puts +.EOS: + ret + +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +! + + if mbrkey=0 press_key: - .asciz "\r\nPress return:" -press_end: - endif + .asciz "\r\nPress return:" + endif + +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +! + if (linear|useCHS) + if mbrkey +disk_read_error: no_bootpart: - .asciz "Bad partition" + .asciz "Boot error" + else disk_read_error: - .asciz "Read error" + .asciz "Disk read error" +no_bootpart: + .asciz "No bootable partition" + endif + endif !(linear|useCHS) !-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ! Choose the partition based on a pressed key ... - if mbrkey + if mbrkey key_wait: - mov si,#Prompt - call puts - call wait_key - jnz key_pause + mov si,#Prompt + call puts + call wait_key + jnz key_pause - mov si,#Unprompt ! Nothing has happened, return. - call puts - ret + mov si,#Unprompt ! Nothing has happened, return. + call puts + ret key_pause: - mov si,#Pause - call puts + mov si,#Pause + call puts key_tick: - call wait_key - jz key_tick - j Got_key + call wait_key + jz key_tick + j Got_key wait_key: - mov di,#19 ! Wait for 18-19 ticks + mov di,#19 ! Wait for 18-19 ticks next_loop: - mov ah,#1 - int $16 - jnz done_wait - mov ah,#0 - int $1A ! Get current tick - cmp dx,si ! If changed DEC our counter. - jz next_loop - mov si,dx - dec di - jnz next_loop + mov ah,#1 + int $16 + jnz done_wait + mov ah,#0 + int $1A ! Get current tick + cmp dx,si ! If changed DEC our counter. + jz next_loop + mov si,dx + dec di + jnz next_loop done_wait: - ret + ret Got_key: - mov ah,#0 ! Clean the kbd buffer. - int $16 - cmp al,#0x20 - jz key_tick - - push ax - mov Showkey,al - mov si,#Showkey - call puts - pop ax - - ! ... Now we use our key ... - ! 0 => Floppy - ! 1 .. 4 => Hard disk partition. - - if useCHS - cmp al,#'F - jz is_floppy - cmp al,#'f - jz is_floppy - endif - - cmp al,#'1 - jb key_pause - cmp al,#'4 - ja key_pause - - and ax,#0x7 - dec ax - mov cl,#4 - shl ax,cl - add ax,#partition_start - mov si,ax + mov ah,#0 ! Clean the kbd buffer. + int $16 + cmp al,#0x20 + jz key_tick + + push ax + mov Showkey,al + mov si,#Showkey + call puts + pop ax + + ! ... Now we use our key ... + ! 0 => Floppy + ! 1 .. 4 => Hard disk partition. + + if useCHS + cmp al,#'F + jz is_floppy + cmp al,#'f + jz is_floppy + endif + + cmp al,#'1 + jb key_pause + cmp al,#'4 + ja key_pause + + and ax,#0x7 + dec ax + mov cl,#4 + shl ax,cl + add ax,#partition_start + mov si,ax ! Set active flag for disk interrupt. - or byte [si],#$80 - br found_active + or byte [si],#$80 + br found_active - if useCHS + if useCHS is_floppy: - mov si,#floppy_part - br found_active - endif - - if message -disp_message: - mov si,#Banner - endif - -puts: - lodsb - cmp al,#0 - jz EOS - push bx - mov bx,#7 - mov ah,#$E ! Can't use $13 cause that's AT+ only! - int $10 - pop bx - jmp puts -EOS: - ret + mov si,#floppy_part + br found_active + endif Prompt: - .asciz "\rMBR: " + .asciz "\rMBR: " Unprompt: - .asciz "\r \r" + .asciz "\r \r" Pause: - if useCHS - .asciz "\rMBR F1234> " - else - .asciz "\rMBR 1234> " - endif + if useCHS + .asciz "\rMBR F1234> " + else + .asciz "\rMBR 1234> " + endif Showkey: - .ascii " " + .ascii " " crlf: - .asciz "\r\n" + .asciz "\r\n" floppy_part: - .word 0,1 + .word 0,1 - endif + endif !-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ! This is the pre-boot loader it uses CHS but that's ok for track 0 ! - if preboot + if preboot public preboot_code preboot_code: - push bx - mov si,#pre_boot_table - lodsw - mov di,ax ! First word is execute address + mov si,#pre_boot_table + lodsw + mov di,ax ! First word is execute address more_boot: - lodsw - test ah,ah - jz load_done - mov bx,ax ! word 1 address - lodsw - mov cx,ax ! word 2 CX, cylinder/sector - lodsw - mov dx,ax ! word 3 DX, drive, head - lodsw ! word 4 AX, $02, sector count - int $13 - jnc more_boot ! This doesn't retry, with a HD it shouldn't be bad. - - mov si,#disk_read_error - br no_boot ! Sorry it ain't gonna work. + lodsw + test ah,ah + jz load_done + mov bx,ax ! word 1 address + lodsw + mov cx,ax ! word 2 CX, cylinder/sector + lodsw + mov dx,ax ! word 3 DX, drive, head + lodsw ! word 4 AX, $02, sector count + int $13 + jnc more_boot ! This doesn't retry, with a HD it shouldn't be bad. + + mov si,#disk_read_error + br no_boot ! Sorry it ain't gonna work. load_done: - call di + call di exec_done: - pop bx - return: - ret + ret export pre_boot_table pre_boot_table: - ! Example: Do nothing. - .word return,0 - - ! Labels - ! .word <execute address> - ! Then repeat .. - ! .word <BX>, <CX>, <DX>, <AX> - ! Or. - ! .word <Load Address> - ! .byte <sector> + (<cyl> & $300)>>2), <cyl> & $FF, <Drive>, <Head>, <cnt>, 2 - ! Finally - ! .word 0 - - ! Example: Load rest of H0,C0 into mem at $7C00 (8k). - ! .word $7C00 - ! .word $7C00,$0002,$8000,$0210 - ! .word $0000 - endif + ! Example: Do nothing. + .word return,0 + + ! If the message is in use, preallocate some extents + if message + .blkb 64 + endif + + ! Labels + ! .word <execute address> + ! Then repeat .. + ! .word <BX>, <CX>, <DX>, <AX> + ! Or. + ! .word <Load Address> + ! .byte <sector> + (<cyl> & $300)>>2), <cyl> & $FF + ! .byte <Drive>, <Head>, <cnt>, 2 + ! Finally + ! .word 0 + + ! Example: Load rest of H0,C0 into mem at BOOTADDR + ! .word BOOTADDR + ! .word BOOTADDR,$0002,$8000,$0210 + ! .word $0000 + endif + +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +! +end_of_code: !-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ! - if message&~mbrkey -disp_message: - mov si,#Banner - -puts: - lodsb - cmp al,#0 - jz .EOS - push bx - mov bx,#7 - mov ah,#$E ! Can't use $13 cause that's AT+ only! - int $10 - pop bx - jmp puts -.EOS: - ret - endif - if message + if message export Banner Banner: - .blkb 16 ! 16 bytes for the message at least. - endif - -!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -! Now make sure this isn't too big! -end_of_code: - if *>table_start - fail! Partition table overlaps + if (linear|useCHS) + if *<ORGADDR+0x100 + org ORGADDR+0x100 + endif + .blkb 80 ! At least 80 bytes for the message. + else + .asciz "This disk is not bootable." + endif endif !-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -! The diskman magic number and empty DM partitions. - if diskman - org table_start -public diskman_magic -diskman_magic: - .word 0xAA55 - .blkb 12*partition_size-1 - endif +! Now make sure this isn't too big! Don't overlap disk serial numbers. + if *>table_start + fail! Partition table overlaps + endif !-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ! And a copyright message if there's room. - if copyright - if *<ORGADDR+0x180 - org ORGADDR+0x180 -.asciz "ELKS MBR " -.asciz "Robert de Bath," -.asciz "Copyright " -.asciz "1996-2003. " - org partition_start-1 - .byte 0xFF - endif - endif + if copyright + if *<ORGADDR+0x170 + org ORGADDR+0x170 + .asciz "ELKS MBR " + .asciz "Robert de Bath," + .asciz "Copyright GPL2 " + .asciz "1996-2008." + endif + endif + +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +! + if pbr|direct + if message + org table_start-1 + .byte 0xFF + else + org table_start + endif +boot_drive: + .word 0 + .blkb 6 +boot_part: + .long 0 + .long 0 +boot_offset: + .long 0x7FFFFFFF + + if pbr=0 +export boot_offset +export boot_drive +export boot_part + endif + endif + + org mbr_extras ! Dirty bit, Serial number + .word 0 +serial_no: + .blkb 4 !-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ! Clear the sector to the bottom of the partition table. - if markptab - if *<partition_start-1 - org partition_start-1 - .byte 0xFF - endif - endif - - if use512 - org ORGADDR+0x1FE - .word 0xAA55 - endif - - if 1&~(useCHS|linear|preboot) - fail! Errm, you can't boot anything without 'linear' or 'useCHS' - endif + if markptab + if *<partition_start + org partition_start-1 + .byte 0 + endif + endif + + if use512 + org ORGADDR+0x1FE + .word 0xAA55 + endif + +! Sanity check. + + if pbr|direct + if useCHS + if linCHS=0 + fail !Raw CHS doesn't work with pbr or direct. + endif + endif + endif !THE END diff --git a/bootblocks/mbr_dm.s b/bootblocks/mbr_dm.s new file mode 100644 index 0000000..9ec16f5 --- /dev/null +++ b/bootblocks/mbr_dm.s @@ -0,0 +1,313 @@ +! +! This is a 'Master Boot Record' following the MSDOS 'standards'. +! This BB successfully boots MSDOS, Windows or Linux in CHS or Linear. +! +! NB: This needs as86 0.16.0 or later + +! Lowest available is $0500, MSDOS appears to use $0600 ... I wonder why? +ORGADDR=$0500 +use512=0 ! Put the end marker at byte 510..512 +markptab=1 ! Put an end marker just below the partition table. + +diskman=1 ! Disk manager partitions, allows 16 partitions but + ! don't overwrite this with a LILO BB. +revorder=0 ! Use physical order for choosing diskman boot partition + +linear=0 ! Use the linear addresses not the CHS ones (if available) +useCHS=1 ! Disable CHS if you need space. +linCHS=0 ! Calculate CHS from linear mbr values. + + if 1&~(useCHS|linear) + fail! Errm, you can't boot anything without 'linear' or 'useCHS' + endif + +partition_start=ORGADDR+0x1BE +partition_size=0x10 +partition_end=ORGADDR+0x1FE + + if diskman + ! Partition table start ... + table_start=ORGADDR+0xFC + low_partition=table_start+2 + else + table_start=partition_start + endif + +export linear +export diskman +export useCHS +export linCHS + +org ORGADDR + cli ! Assume _nothing_! + cld + mov bx,#$7C00 ! Pointer to start of BB. + xor ax,ax ! Segs all to zero + mov ds,ax + mov es,ax + mov ss,ax + mov sp,bx ! SP Just below BB + mov cx,#$100 ! Move 256 words + mov si,bx ! From default BB + mov di,#ORGADDR ! To the correct address. + rep + movsw + jmpi cont,#0 ! Set CS:IP correct. +cont: + sti ! Let the interrupts back in. + + if (linear|useCHS) + +! Now check the partition table, must use SI as pointer cause that's what the +! partition boot blocks expect. + +! If we're using diskman and we're short of space check the partitions in +! physical order. (Order. 4,3,2,1,5,6,7,8,9,10,11,12,13,14,15,16) + + if (diskman&revorder) + + mov si,#partition_end +check_next: + sub si,#partition_size + cmp byte [si],#$80 ! Flag for activated partition + jz found_active + cmp si,#low_partition + jnz check_next + + else + +! Normal active partition check, (Order: 1,2,3,4) + mov si,#partition_start +check_active: + cmp byte [si],#$80 ! Flag for activated partition + jz found_active +try_next_part: + add si,#partition_size + cmp si,#partition_end + jnz check_active + +! Check for Disk manager partitions in the order that Linux numbers them. + if diskman&~(revorder) + cmp word ptr diskman_magic,#$AA55 + jnz no_diskman + mov si,#partition_start +check_next: + sub si,#partition_size + cmp byte [si],#$80 ! Flag for activated partition + jz found_active + cmp si,#low_partition + jnz check_next + +no_diskman: + endif + endif + +bad_boot: + mov si,#no_bootpart ! Message & boot + jmp no_boot + +! Active partition found, boot it. +found_active: + mov di,#6 ! Max retries, int doc says 3 ... double it + movb [$7DFE],#0 ! Clear magic for dosemu +retry: + +! If the BIOS has LBA extensions use them. + if linear + if useCHS + mov ah,#$41 + mov bx,#$55AA + mov dx,[si] ! dh = Drive head, dl = $80 ie HD drive 0 + push si ! Save SI on read. + int $13 + jc do_CHS + cmp bx,#$AA55 + jnz do_CHS + else + mov dx,[si] ! dh = Drive head, dl = $80 ie HD drive 0 + push si ! Save SI + endif + mov bx,#disk_address + mov ax,[si+8] + mov [bx],ax + mov ax,[si+10] + mov [bx+2],ax + mov si,#disk_packet + mov ah,#$42 + int $13 + pop si + jc retry_error + j sector_loaded +disk_packet: + .byte $10 + .byte 0 + .word 1 + .word $7C00 + .word 0 +disk_address: + .long 0 + .long 0 + + if useCHS +do_CHS: + pop si + endif + endif + +if useCHS +if linCHS + call calc_chs +else + mov dx,[si] ! dh = Drive head, dl = $80 ie HD drive 0 + mov cx,[si+2] ! cx = Sector & head encoded for int $13 + ! bx is correct at $7C00 +endif + + mov ax,#$0201 ! Read 1 sector + int $13 ! Disk read. + jnc sector_loaded +endif + +! Error, reset and retry +retry_error: + xor ax,ax + int $13 ! Disk reset + + dec di + jnz retry ! Try again + + mov si,#disk_read_error + jmp no_boot ! Sorry it ain't gonna work. + +sector_loaded: + mov di,#$7DFE ! End of sector loaded + cmp [di],#$AA55 ! Check for magic + if diskman + jnz bad_boot ! Can't try again, two places to return to. + else + jnz try_next_part ! No? Try next partition. + endif + + mov bp,si ! LILO says some BBs use bp rather than si + jmpi #$7C00,#0 ! Go! + + else + mov si,#no_bootpart ! Message & boot + endif !(linear|useCHS) + +! Fatal errors ........... + +no_boot: ! SI now has pointer to error message + call puts + mov si,#press_key + call puts + +keyboot: ! Wait for a key then reboot + xor ax,ax + int $16 + jmpi $0,$FFFF ! Reboot. + +if useCHS +if linCHS +calc_chs: + push bx ! Save load location + + mov ah,#8 + int $13 ! Drive Geom + shr dx,#8 + xchg ax,dx + inc ax ! AX = No. Heads + and cx,#$3f ! CX = Sectors + mul cx + xchg ax,bx ! BX = . + + mov ax,[si+8] ! Linear partition address. + mov dx,[si+10] + + div bx ! AX = Cyl, DX = head & sect + + shl ah,#6 + xchg ah,al + xchg dx,ax + div cl ! AH = sect-1, AL = Head + or dl,ah ! merge for CX arg. + mov cx,dx + inc cx ! Adjust sector No. + + mov dx,[si] ! dh = Orig Drive head, dl = $80 ie HD drive 0 + + mov dh,al ! Head No. + + ; CX & DX ready for int $13 + + pop bx + ret +endif +endif +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +! +puts: + lodsb + cmp al,#0 + jz .EOS + push bx + mov bx,#7 + mov ah,#$E ! Can't use $13 cause that's AT+ only! + int $10 + pop bx + jmp puts +.EOS: + ret + +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +! + +press_key: + .asciz "\r\nPress return:" +press_end: + +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +! + + if (linear|useCHS) +disk_read_error: + .asciz "Read error" +no_bootpart: + .asciz "Bad partition" + else +no_bootpart: + .asciz "Not a bootable disk" + endif !(linear|useCHS) + +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +! Now make sure this isn't too big! +end_of_code: + if *>table_start + fail! Partition table overlaps + endif + +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +! The diskman magic number and empty DM partitions. + if diskman + org table_start +public diskman_magic +diskman_magic: + .word 0xAA55 + .blkb 12*partition_size-1 + endif + +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +! Clear the sector to the bottom of the partition table. + if markptab + if *<partition_start-2 + org partition_start-2 + .word 0xAA55 + endif + endif + + if use512 + org ORGADDR+0x1FE + .word 0xAA55 + endif + +!THE END diff --git a/bootblocks/minix.c b/bootblocks/minix.c index 69daa1a..6532650 100644 --- a/bootblocks/minix.c +++ b/bootblocks/minix.c @@ -53,7 +53,7 @@ BOOTADDR = 0x7c00 org ORGADDR ! The lowest available address. start: #ifndef MIN_SPACE - include sysboot.s + include sysboot16.s org start ! The lowest available address, again. j skip_vars diff --git a/bootblocks/msdos.s b/bootblocks/msdos.s index 971975e..ddaa870 100644 --- a/bootblocks/msdos.s +++ b/bootblocks/msdos.s @@ -54,7 +54,7 @@ mend org ORGADDR start: -include sysboot.s +include sysboot16.s org dos_sysid .ascii "DOSFS" ! System ID diff --git a/bootblocks/nombr.s b/bootblocks/nombr.s new file mode 100644 index 0000000..b73947f --- /dev/null +++ b/bootblocks/nombr.s @@ -0,0 +1,23 @@ + +include sysmbr.s + +org codestart + mov si,#message +nextc: + lodsb + cmp al,#0 + jz eos + mov bx,#7 + mov ah,#$E ! Can't use $13 cause that's AT+ only! + int $10 + jmp nextc +eos: ! Wait for a key then reboot + xor ax,ax + int $16 + jmpi $0,$FFFF ! Wam! Try or die! + +export message +message: + .asciz "MBR loaded but not bootable.\r\n" + +include sysmbrtail.s diff --git a/bootblocks/sysboot.s b/bootblocks/sysboot.s index baac806..b6adc75 100644 --- a/bootblocks/sysboot.s +++ b/bootblocks/sysboot.s @@ -48,7 +48,8 @@ dos4_fattype: .blkb 8 ! FAT type ! ! This is where the code will be overlaid, the default is a hang -.blkb sysboot_start+0x3E-* +! The 0x5A offset clears the FAT32 header. +.blkb sysboot_start+0x5A-* public codestart codestart: j codestart diff --git a/bootblocks/sysboot16.s b/bootblocks/sysboot16.s new file mode 100644 index 0000000..baac806 --- /dev/null +++ b/bootblocks/sysboot16.s @@ -0,0 +1,82 @@ + +! The master boot sector will have setup a stack, +! this is normally at 0:7c00 down. +! DS, SS, CS and ES will all have value 0 so the execution address is 0:7c00 +! On entry the register SI will be pointer to the partition entry that +! this sector was loaded from, DL is the drive. + +! Also if it's a standard Master boot DH will be the head, CX will be the +! sector and cylinder, BX=7C00, AX=1, DI=7DFE, BP=SI. There's a reasonable +! chance that this isn't true though. + +! The Master boot itself will have been loaded and run at $07c00 +! The BIOS must have setup a stack because interrupts are enabled +! Little else can be assumed because DOS doesn`t assume anything either + +sysboot_start: +j codestart +nop ! DOS appears to _require_ this to identify an MSDOS disk!! + +.blkb sysboot_start+3-* +public dosfs_stat +dos_sysid: .ascii "LINUX" ! System ID + .byte 0,0,0 +dosfs_stat: +dos_sect: .blkw 1 ! Sector size +dos_clust: .blkb 1 ! Cluster size +dos_resv: .blkw 1 ! Res-sector +dos_nfat: .blkb 1 ! FAT count +dos_nroot: .blkw 1 ! Root dir entries +dos_maxsect: .blkw 1 ! Sector count (=0 if large FS) +dos_media: .blkb 1 ! Media code +dos_fatlen: .blkw 1 ! FAT length +dos_spt: .blkw 1 ! Sect/Track +dos_heads: .blkw 1 ! Heads +dos_hidden: .blkw 2 ! Hidden sectors + +! Here down is DOS 4+ and probably not needed for floppy boots. + +dos4_maxsect: .blkw 2 ! Large FS sector count +dos4_phy_drive: .blkb 1 ! Phys drive +.blkb 1 ! Reserved +.blkb 1 ! DOS 4 + +floppy_temp: +dos4_serial: .blkw 2 ! Serial number +dos4_label: .blkb 11 ! Disk Label (DOS 4+) +dos4_fattype: .blkb 8 ! FAT type + +! +! This is where the code will be overlaid, the default is a hang +.blkb sysboot_start+0x3E-* +public codestart +codestart: + j codestart + +! Partition table +public bootblock_magic + +.blkb sysboot_start+0x1BE-* +partition_1: +.blkb 8 ! IN,SH,SS,ST,OS,EH,ES,ET +.blkw 2 ! Linear position (0 based) +.blkw 2 ! Linear length +.blkb sysboot_start+0x1CE-* +partition_2: +.blkb 8 ! IN,SH,SS,ST,OS,EH,ES,ET +.blkw 2 ! Linear position (0 based) +.blkw 2 ! Linear length +.blkb sysboot_start+0x1DE-* +partition_3: +.blkb 8 ! IN,SH,SS,ST,OS,EH,ES,ET +.blkw 2 ! Linear position (0 based) +.blkw 2 ! Linear length +.blkb sysboot_start+0x1EE-* +partition_4: +.blkb 8 ! IN,SH,SS,ST,OS,EH,ES,ET +.blkw 2 ! Linear position (0 based) +.blkw 2 ! Linear length + +.blkb sysboot_start+0x1FE-* +bootblock_magic: +.word 0xAA55 diff --git a/bootblocks/sysmbr.s b/bootblocks/sysmbr.s new file mode 100644 index 0000000..eb609de --- /dev/null +++ b/bootblocks/sysmbr.s @@ -0,0 +1,76 @@ + +! The master boot sector will have setup a stack, +! this is normally at 0:7c00 down. +! DS, SS, CS and ES will all have value 0 so the execution address is 0:7c00 +! On entry the register SI will be pointer to the partition entry that +! this sector was loaded from, DL is the drive. + +! Also if it's a standard Master boot DH will be the head, CX will be the +! sector and cylinder, BX=7C00, AX=1, DI=7DFE, BP=SI. There's a reasonable +! chance that this isn't true though. + +! The Master boot itself will have been loaded and run at $07c00 +! The BIOS must have setup a stack because interrupts are enabled +! Little else can be assumed because DOS doesn`t assume anything either + +! Lowest available is $0500, MSDOS appears to use $0600 ... I wonder why? +ORGADDR=$0500 + +org ORGADDR + +sysboot_start: + cli ! Assume _nothing_! + cld + mov bx,#$7C00 ! Pointer to start of BB. + xor ax,ax ! Segs all to zero + mov ds,ax + mov es,ax + mov ss,ax + mov sp,bx ! SP Just below BB + mov cx,#$100 ! Move 256 words + mov si,bx ! From default BB + mov di,#ORGADDR ! To the correct address. + rep + movsw + jmpi cont,#0 ! Set CS:IP correct. +cont: + sti ! Let the interrupts back in. + +! This is where the code will be overlaid, the default is a hang +public codestart +codestart: + j codestart + +! Partition table +public bootblock_magic + +.blkb sysboot_start+0x1B6-* +table_start: +.blkb 2 ! Dirty bits +.blkb 4 ! Volume Serial Number +.blkb 2 ! Possible Magic number + +.blkb sysboot_start+0x1BE-* +partition_1: +.blkb 8 ! IN,SH,SS,ST,OS,EH,ES,ET +.blkw 2 ! Linear position (0 based) +.blkw 2 ! Linear length +.blkb sysboot_start+0x1CE-* +partition_2: +.blkb 8 ! IN,SH,SS,ST,OS,EH,ES,ET +.blkw 2 ! Linear position (0 based) +.blkw 2 ! Linear length +.blkb sysboot_start+0x1DE-* +partition_3: +.blkb 8 ! IN,SH,SS,ST,OS,EH,ES,ET +.blkw 2 ! Linear position (0 based) +.blkw 2 ! Linear length +.blkb sysboot_start+0x1EE-* +partition_4: +.blkb 8 ! IN,SH,SS,ST,OS,EH,ES,ET +.blkw 2 ! Linear position (0 based) +.blkw 2 ! Linear length + +.blkb sysboot_start+0x1FE-* +bootblock_magic: +.blkb 2 diff --git a/bootblocks/sysmbrtail.s b/bootblocks/sysmbrtail.s new file mode 100644 index 0000000..1b37022 --- /dev/null +++ b/bootblocks/sysmbrtail.s @@ -0,0 +1,13 @@ + +! Now make sure this isn't too big! +end_of_code: + if *>table_start + fail! Partition table overlaps + endif + +!-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +! Clear the sector to the bottom of the partition table. + if *<table_start-1 + org table_start-1 + .byte 0xFF + endif |