# HG changeset patch # User Pascal Bellard # Date 1645183961 0 # Node ID d211771a0500d92f964a47c48a7925350931f214 # Parent 04472f031354c1ad0ecee9cf6262a0ca7b9bee11 BootProg: nasm 2.15.05 support diff -r 04472f031354 -r d211771a0500 BootProg/receipt --- a/BootProg/receipt Fri Feb 18 10:06:45 2022 +0000 +++ b/BootProg/receipt Fri Feb 18 11:32:41 2022 +0000 @@ -15,8 +15,10 @@ # Rules to configure and make the package. compile_rules() { + mkdir -p $src && cd $src for i in bootex boot16 boot32 ; do - nasm $stuff/$i.asm -f bin -o $i.bin -l $i.lst + cp $stuff/$i.asm . + nasm $i.asm -f bin -o $i.bin -l $i.lst -O0 done sed '1,/^exit 1/!d' $stuff/bootprog.sh > bootprog tar czf - boot16.bin boot32.bin bootex.bin > set.tar.gz diff -r 04472f031354 -r d211771a0500 BootProg/stuff/boot16.asm --- a/BootProg/stuff/boot16.asm Fri Feb 18 10:06:45 2022 +0000 +++ b/BootProg/stuff/boot16.asm Fri Feb 18 11:32:41 2022 +0000 @@ -92,7 +92,6 @@ [BITS 16] [CPU 8086] -? equ 0 ImageLoadSeg equ 60h StackSize equ 3072 ; Stack + cluster list @@ -112,27 +111,27 @@ ;; BPB starts here ;; ;;;;;;;;;;;;;;;;;;;;; -bpbBytesPerSector DW ? ; 0x0B -bpbSectorsPerCluster DB ? ; 0x0D -bpbReservedSectors DW ? ; 0x0E -bpbNumberOfFATs DB ? ; 0x10 -bpbRootEntries DW ? ; 0x11 -bpbTotalSectors DW ? ; 0x13 -bpbMedia DB ? ; 0x15 -bpbSectorsPerFAT DW ? ; 0x16 -bpbSectorsPerTrack DW ? ; 0x18 -bpbHeadsPerCylinder DW ? ; 0x1A -bpbHiddenSectors DD ? ; 0x1C -bpbTotalSectorsBig DD ? ; 0x20 +bpbBytesPerSector DW 0 ; 0x0B +bpbSectorsPerCluster DB 0 ; 0x0D +bpbReservedSectors DW 0 ; 0x0E +bpbNumberOfFATs DB 0 ; 0x10 +bpbRootEntries DW 0 ; 0x11 +bpbTotalSectors DW 0 ; 0x13 +bpbMedia DB 0 ; 0x15 +bpbSectorsPerFAT DW 0 ; 0x16 +bpbSectorsPerTrack DW 0 ; 0x18 +bpbHeadsPerCylinder DW 0 ; 0x1A +bpbHiddenSectors DD 0 ; 0x1C +bpbTotalSectorsBig DD 0 ; 0x20 ;;;;;;;;;;;;;;;;;;; ;; BPB ends here ;; ;;;;;;;;;;;;;;;;;;; -bsDriveNumber DB ? ; 0x24 -bsUnused DB ? ; 0x25 -bsExtBootSignature DB ? ; 0x26 -bsSerialNumber DD ? ; 0x27 +bsDriveNumber DB 0 ; 0x24 +bsUnused DB 0 ; 0x25 +bsExtBootSignature DB 0 ; 0x26 +bsSerialNumber DD 0 ; 0x27 bsVolumeLabel DB "NO NAME " ; 0x2B bsFileSystem DB "FAT12 " ; 0x36 @@ -202,7 +201,7 @@ pop ds xor bx, bx - and cx, 3Fh + and cx, byte 3Fh cmp [bx(bpbSectorsPerTrack)], cx jne BadParams ; verify updated and validity mov al, dh @@ -263,7 +262,7 @@ repe cmpsb pop di je FindNameFound - add di, 32 + add di, byte 32 dec word [bx(bpbRootEntries)] jnz FindNameCycle ; next root entry @@ -311,7 +310,7 @@ lodsw ; ax = next cluster cmp ax, 0FFF8h - jmp ReadClusterDone + jmp short ReadClusterDone ReadClusterFat12: add si, [cs:di] @@ -591,3 +590,4 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;; ClusterList dw 0AA55h ; BIOS checks for this ID + diff -r 04472f031354 -r d211771a0500 BootProg/stuff/boot32.asm --- a/BootProg/stuff/boot32.asm Fri Feb 18 10:06:45 2022 +0000 +++ b/BootProg/stuff/boot32.asm Fri Feb 18 11:32:41 2022 +0000 @@ -83,7 +83,6 @@ [BITS 16] -? equ 0 ImageLoadSeg equ 60h ; <=07Fh because of "push byte ImageLoadSeg" instructions [SECTION .text] @@ -101,18 +100,18 @@ ;; BPB1 starts here ;; ;;;;;;;;;;;;;;;;;;;;;; -bpbBytesPerSector DW ? ; 0x0B -bpbSectorsPerCluster DB ? ; 0x0D -bpbReservedSectors DW ? ; 0x0E -bpbNumberOfFATs DB ? ; 0x10 -bpbRootEntries DW ? ; 0x11 -bpbTotalSectors DW ? ; 0x13 -bpbMedia DB ? ; 0x15 -bpbSectorsPerFAT DW ? ; 0x16 -bpbSectorsPerTrack DW ? ; 0x18 -bpbHeadsPerCylinder DW ? ; 0x1A -bpbHiddenSectors DD ? ; 0x1C -bpbTotalSectorsBig DD ? ; 0x20 +bpbBytesPerSector DW 0 ; 0x0B +bpbSectorsPerCluster DB 0 ; 0x0D +bpbReservedSectors DW 0 ; 0x0E +bpbNumberOfFATs DB 0 ; 0x10 +bpbRootEntries DW 0 ; 0x11 +bpbTotalSectors DW 0 ; 0x13 +bpbMedia DB 0 ; 0x15 +bpbSectorsPerFAT DW 0 ; 0x16 +bpbSectorsPerTrack DW 0 ; 0x18 +bpbHeadsPerCylinder DW 0 ; 0x1A +bpbHiddenSectors DD 0 ; 0x1C +bpbTotalSectorsBig DD 0 ; 0x20 ;;;;;;;;;;;;;;;;;;;; ;; BPB1 ends here ;; @@ -122,17 +121,17 @@ ;; BPB2 starts here ;; ;;;;;;;;;;;;;;;;;;;;;; -bsSectorsPerFAT32 DD ? ; 0x24 -bsExtendedFlags DW ? ; 0x28 -bsFSVersion DW ? ; 0x2A -bsRootDirectoryClusterNo DD ? ; 0x2C -bsFSInfoSectorNo DW ? ; 0x30 -bsBackupBootSectorNo DW ? ; 0x32 -bsreserved times 12 DB ? ; 0x34 -bsDriveNumber DB ? ; 0x40 -bsreserved1 DB ? ; 0x41 -bsExtendedBootSignature DB ? ; 0x42 -bsVolumeSerialNumber DD ? ; 0x43 +bsSectorsPerFAT32 DD 0 ; 0x24 +bsExtendedFlags DW 0 ; 0x28 +bsFSVersion DW 0 ; 0x2A +bsRootDirectoryClusterNo DD 0 ; 0x2C +bsFSInfoSectorNo DW 0 ; 0x30 +bsBackupBootSectorNo DW 0 ; 0x32 +bsreserved times 12 DB 0 ; 0x34 +bsDriveNumber DB 0 ; 0x40 +bsreserved1 DB 0 ; 0x41 +bsExtendedBootSignature DB 0 ; 0x42 +bsVolumeSerialNumber DD 0 ; 0x43 bsVolumeLabel DB "NO NAME " ; 0x47 bsFileSystemName DB "FAT32 " ; 0x52 diff -r 04472f031354 -r d211771a0500 BootProg/stuff/bootex.asm --- a/BootProg/stuff/bootex.asm Fri Feb 18 10:06:45 2022 +0000 +++ b/BootProg/stuff/bootex.asm Fri Feb 18 11:32:41 2022 +0000 @@ -86,7 +86,6 @@ [BITS 16] [CPU 386] -? equ 0 ImageLoadSeg equ 60h StackSize equ 1536 @@ -107,22 +106,22 @@ ;; BPB starts here ;; ;;;;;;;;;;;;;;;;;;;;; -bpbSectorStart DQ ? ; 0x40 partition first sector -bpbSectorCount DQ ? ; 0x48 partition sectors count -bpbFatSectorStart DD ? ; 0x50 FAT first sector -bpbFatSectorCount DD ? ; 0x54 FAT sectors count -bpbClusterSectorStart DD ? ; 0x58 first cluster sector -bpbClusterCount DD ? ; 0x5C total clusters count -bpbRootDirCluster DD ? ; 0x60 first cluster of the root dir -bpbVolumeSerial DD ? ; 0x64 volume serial number -bpbFSVersionMinor DB ? ; 0x68 -bpbFSVersionMajor DB ? ; 0x69 -bpbVolumeStateFlags DW ? ; 0x6A -bpbSectorSizeBits DB ? ; 0x6C sector size as (1 << n) -bpbSectorPerClusterBits DB ? ; 0x6D sector per cluster as (1 << n) -bpbNumberOfFATs DB ? ; 0x6E always 1 -bpbDriveNumber DB ? ; 0x6F alaways 0x80 -bpbAllocatedPercent DB ? ; 0x70 percentage of allocated space +bpbSectorStart DQ 0 ; 0x40 partition first sector +bpbSectorCount DQ 0 ; 0x48 partition sectors count +bpbFatSectorStart DD 0 ; 0x50 FAT first sector +bpbFatSectorCount DD 0 ; 0x54 FAT sectors count +bpbClusterSectorStart DD 0 ; 0x58 first cluster sector +bpbClusterCount DD 0 ; 0x5C total clusters count +bpbRootDirCluster DD 0 ; 0x60 first cluster of the root dir +bpbVolumeSerial DD 0 ; 0x64 volume serial number +bpbFSVersionMinor DB 0 ; 0x68 +bpbFSVersionMajor DB 0 ; 0x69 +bpbVolumeStateFlags DW 0 ; 0x6A +bpbSectorSizeBits DB 0 ; 0x6C sector size as (1 << n) +bpbSectorPerClusterBits DB 0 ; 0x6D sector per cluster as (1 << n) +bpbNumberOfFATs DB 0 ; 0x6E always 1 +bpbDriveNumber DB 0 ; 0x6F alaways 0x80 +bpbAllocatedPercent DB 0 ; 0x70 percentage of allocated space ;;;;;;;;;;;;;;;;;;; ;; BPB ends here ;; @@ -167,7 +166,7 @@ ;;;;;;;;;;;;;;;;;;;;;; push es - push main + push byte main retf main: @@ -179,7 +178,7 @@ mov esi, [bx(bpbRootDirCluster)] ; esi=cluster # of root dir - push ImageLoadSeg + push byte ImageLoadSeg pop es RootDirReadContinue: @@ -233,7 +232,7 @@ je FindNameFound ; cx = 0 popa ; restore ax, cx, si, di - add di, 32 + add di, byte 32 cmp di, bp jne FindNameCycle ; next root entry popf ; restore carry="not last sector" flag @@ -350,7 +349,7 @@ ReadCluster: inc cx ; jcxnz - add eax, 1 + add eax, byte 1 loop ReadSectorC mov cl, [bx(bpbSectorSizeBits)] @@ -437,7 +436,7 @@ stc loop ReadSectorNext - cmp esi, 0FFFFFFF6h ; carry=0 if last cluster, and carry=1 otherwise + cmp esi, byte -10 ; carry=0 if last cluster, and carry=1 otherwise ReadSectorNext: ret