wok rev 24479
BootProg: nasm 2.15.05 support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Feb 18 11:32:41 2022 +0000 (2022-02-18) |
parents | 04472f031354 |
children | b3011020f0ec |
files | BootProg/receipt BootProg/stuff/boot16.asm BootProg/stuff/boot32.asm BootProg/stuff/bootex.asm |
line diff
1.1 --- a/BootProg/receipt Fri Feb 18 10:06:45 2022 +0000 1.2 +++ b/BootProg/receipt Fri Feb 18 11:32:41 2022 +0000 1.3 @@ -15,8 +15,10 @@ 1.4 # Rules to configure and make the package. 1.5 compile_rules() 1.6 { 1.7 + mkdir -p $src && cd $src 1.8 for i in bootex boot16 boot32 ; do 1.9 - nasm $stuff/$i.asm -f bin -o $i.bin -l $i.lst 1.10 + cp $stuff/$i.asm . 1.11 + nasm $i.asm -f bin -o $i.bin -l $i.lst -O0 1.12 done 1.13 sed '1,/^exit 1/!d' $stuff/bootprog.sh > bootprog 1.14 tar czf - boot16.bin boot32.bin bootex.bin > set.tar.gz
2.1 --- a/BootProg/stuff/boot16.asm Fri Feb 18 10:06:45 2022 +0000 2.2 +++ b/BootProg/stuff/boot16.asm Fri Feb 18 11:32:41 2022 +0000 2.3 @@ -92,7 +92,6 @@ 2.4 [BITS 16] 2.5 [CPU 8086] 2.6 2.7 -? equ 0 2.8 ImageLoadSeg equ 60h 2.9 StackSize equ 3072 ; Stack + cluster list 2.10 2.11 @@ -112,27 +111,27 @@ 2.12 ;; BPB starts here ;; 2.13 ;;;;;;;;;;;;;;;;;;;;; 2.14 2.15 -bpbBytesPerSector DW ? ; 0x0B 2.16 -bpbSectorsPerCluster DB ? ; 0x0D 2.17 -bpbReservedSectors DW ? ; 0x0E 2.18 -bpbNumberOfFATs DB ? ; 0x10 2.19 -bpbRootEntries DW ? ; 0x11 2.20 -bpbTotalSectors DW ? ; 0x13 2.21 -bpbMedia DB ? ; 0x15 2.22 -bpbSectorsPerFAT DW ? ; 0x16 2.23 -bpbSectorsPerTrack DW ? ; 0x18 2.24 -bpbHeadsPerCylinder DW ? ; 0x1A 2.25 -bpbHiddenSectors DD ? ; 0x1C 2.26 -bpbTotalSectorsBig DD ? ; 0x20 2.27 +bpbBytesPerSector DW 0 ; 0x0B 2.28 +bpbSectorsPerCluster DB 0 ; 0x0D 2.29 +bpbReservedSectors DW 0 ; 0x0E 2.30 +bpbNumberOfFATs DB 0 ; 0x10 2.31 +bpbRootEntries DW 0 ; 0x11 2.32 +bpbTotalSectors DW 0 ; 0x13 2.33 +bpbMedia DB 0 ; 0x15 2.34 +bpbSectorsPerFAT DW 0 ; 0x16 2.35 +bpbSectorsPerTrack DW 0 ; 0x18 2.36 +bpbHeadsPerCylinder DW 0 ; 0x1A 2.37 +bpbHiddenSectors DD 0 ; 0x1C 2.38 +bpbTotalSectorsBig DD 0 ; 0x20 2.39 2.40 ;;;;;;;;;;;;;;;;;;; 2.41 ;; BPB ends here ;; 2.42 ;;;;;;;;;;;;;;;;;;; 2.43 2.44 -bsDriveNumber DB ? ; 0x24 2.45 -bsUnused DB ? ; 0x25 2.46 -bsExtBootSignature DB ? ; 0x26 2.47 -bsSerialNumber DD ? ; 0x27 2.48 +bsDriveNumber DB 0 ; 0x24 2.49 +bsUnused DB 0 ; 0x25 2.50 +bsExtBootSignature DB 0 ; 0x26 2.51 +bsSerialNumber DD 0 ; 0x27 2.52 bsVolumeLabel DB "NO NAME " ; 0x2B 2.53 bsFileSystem DB "FAT12 " ; 0x36 2.54 2.55 @@ -202,7 +201,7 @@ 2.56 pop ds 2.57 xor bx, bx 2.58 2.59 - and cx, 3Fh 2.60 + and cx, byte 3Fh 2.61 cmp [bx(bpbSectorsPerTrack)], cx 2.62 jne BadParams ; verify updated and validity 2.63 mov al, dh 2.64 @@ -263,7 +262,7 @@ 2.65 repe cmpsb 2.66 pop di 2.67 je FindNameFound 2.68 - add di, 32 2.69 + add di, byte 32 2.70 dec word [bx(bpbRootEntries)] 2.71 jnz FindNameCycle ; next root entry 2.72 2.73 @@ -311,7 +310,7 @@ 2.74 2.75 lodsw ; ax = next cluster 2.76 cmp ax, 0FFF8h 2.77 - jmp ReadClusterDone 2.78 + jmp short ReadClusterDone 2.79 2.80 ReadClusterFat12: 2.81 add si, [cs:di] 2.82 @@ -591,3 +590,4 @@ 2.83 ;;;;;;;;;;;;;;;;;;;;;;;;;; 2.84 2.85 ClusterList dw 0AA55h ; BIOS checks for this ID 2.86 +
3.1 --- a/BootProg/stuff/boot32.asm Fri Feb 18 10:06:45 2022 +0000 3.2 +++ b/BootProg/stuff/boot32.asm Fri Feb 18 11:32:41 2022 +0000 3.3 @@ -83,7 +83,6 @@ 3.4 3.5 [BITS 16] 3.6 3.7 -? equ 0 3.8 ImageLoadSeg equ 60h ; <=07Fh because of "push byte ImageLoadSeg" instructions 3.9 3.10 [SECTION .text] 3.11 @@ -101,18 +100,18 @@ 3.12 ;; BPB1 starts here ;; 3.13 ;;;;;;;;;;;;;;;;;;;;;; 3.14 3.15 -bpbBytesPerSector DW ? ; 0x0B 3.16 -bpbSectorsPerCluster DB ? ; 0x0D 3.17 -bpbReservedSectors DW ? ; 0x0E 3.18 -bpbNumberOfFATs DB ? ; 0x10 3.19 -bpbRootEntries DW ? ; 0x11 3.20 -bpbTotalSectors DW ? ; 0x13 3.21 -bpbMedia DB ? ; 0x15 3.22 -bpbSectorsPerFAT DW ? ; 0x16 3.23 -bpbSectorsPerTrack DW ? ; 0x18 3.24 -bpbHeadsPerCylinder DW ? ; 0x1A 3.25 -bpbHiddenSectors DD ? ; 0x1C 3.26 -bpbTotalSectorsBig DD ? ; 0x20 3.27 +bpbBytesPerSector DW 0 ; 0x0B 3.28 +bpbSectorsPerCluster DB 0 ; 0x0D 3.29 +bpbReservedSectors DW 0 ; 0x0E 3.30 +bpbNumberOfFATs DB 0 ; 0x10 3.31 +bpbRootEntries DW 0 ; 0x11 3.32 +bpbTotalSectors DW 0 ; 0x13 3.33 +bpbMedia DB 0 ; 0x15 3.34 +bpbSectorsPerFAT DW 0 ; 0x16 3.35 +bpbSectorsPerTrack DW 0 ; 0x18 3.36 +bpbHeadsPerCylinder DW 0 ; 0x1A 3.37 +bpbHiddenSectors DD 0 ; 0x1C 3.38 +bpbTotalSectorsBig DD 0 ; 0x20 3.39 3.40 ;;;;;;;;;;;;;;;;;;;; 3.41 ;; BPB1 ends here ;; 3.42 @@ -122,17 +121,17 @@ 3.43 ;; BPB2 starts here ;; 3.44 ;;;;;;;;;;;;;;;;;;;;;; 3.45 3.46 -bsSectorsPerFAT32 DD ? ; 0x24 3.47 -bsExtendedFlags DW ? ; 0x28 3.48 -bsFSVersion DW ? ; 0x2A 3.49 -bsRootDirectoryClusterNo DD ? ; 0x2C 3.50 -bsFSInfoSectorNo DW ? ; 0x30 3.51 -bsBackupBootSectorNo DW ? ; 0x32 3.52 -bsreserved times 12 DB ? ; 0x34 3.53 -bsDriveNumber DB ? ; 0x40 3.54 -bsreserved1 DB ? ; 0x41 3.55 -bsExtendedBootSignature DB ? ; 0x42 3.56 -bsVolumeSerialNumber DD ? ; 0x43 3.57 +bsSectorsPerFAT32 DD 0 ; 0x24 3.58 +bsExtendedFlags DW 0 ; 0x28 3.59 +bsFSVersion DW 0 ; 0x2A 3.60 +bsRootDirectoryClusterNo DD 0 ; 0x2C 3.61 +bsFSInfoSectorNo DW 0 ; 0x30 3.62 +bsBackupBootSectorNo DW 0 ; 0x32 3.63 +bsreserved times 12 DB 0 ; 0x34 3.64 +bsDriveNumber DB 0 ; 0x40 3.65 +bsreserved1 DB 0 ; 0x41 3.66 +bsExtendedBootSignature DB 0 ; 0x42 3.67 +bsVolumeSerialNumber DD 0 ; 0x43 3.68 bsVolumeLabel DB "NO NAME " ; 0x47 3.69 bsFileSystemName DB "FAT32 " ; 0x52 3.70
4.1 --- a/BootProg/stuff/bootex.asm Fri Feb 18 10:06:45 2022 +0000 4.2 +++ b/BootProg/stuff/bootex.asm Fri Feb 18 11:32:41 2022 +0000 4.3 @@ -86,7 +86,6 @@ 4.4 [BITS 16] 4.5 [CPU 386] 4.6 4.7 -? equ 0 4.8 ImageLoadSeg equ 60h 4.9 StackSize equ 1536 4.10 4.11 @@ -107,22 +106,22 @@ 4.12 ;; BPB starts here ;; 4.13 ;;;;;;;;;;;;;;;;;;;;; 4.14 4.15 -bpbSectorStart DQ ? ; 0x40 partition first sector 4.16 -bpbSectorCount DQ ? ; 0x48 partition sectors count 4.17 -bpbFatSectorStart DD ? ; 0x50 FAT first sector 4.18 -bpbFatSectorCount DD ? ; 0x54 FAT sectors count 4.19 -bpbClusterSectorStart DD ? ; 0x58 first cluster sector 4.20 -bpbClusterCount DD ? ; 0x5C total clusters count 4.21 -bpbRootDirCluster DD ? ; 0x60 first cluster of the root dir 4.22 -bpbVolumeSerial DD ? ; 0x64 volume serial number 4.23 -bpbFSVersionMinor DB ? ; 0x68 4.24 -bpbFSVersionMajor DB ? ; 0x69 4.25 -bpbVolumeStateFlags DW ? ; 0x6A 4.26 -bpbSectorSizeBits DB ? ; 0x6C sector size as (1 << n) 4.27 -bpbSectorPerClusterBits DB ? ; 0x6D sector per cluster as (1 << n) 4.28 -bpbNumberOfFATs DB ? ; 0x6E always 1 4.29 -bpbDriveNumber DB ? ; 0x6F alaways 0x80 4.30 -bpbAllocatedPercent DB ? ; 0x70 percentage of allocated space 4.31 +bpbSectorStart DQ 0 ; 0x40 partition first sector 4.32 +bpbSectorCount DQ 0 ; 0x48 partition sectors count 4.33 +bpbFatSectorStart DD 0 ; 0x50 FAT first sector 4.34 +bpbFatSectorCount DD 0 ; 0x54 FAT sectors count 4.35 +bpbClusterSectorStart DD 0 ; 0x58 first cluster sector 4.36 +bpbClusterCount DD 0 ; 0x5C total clusters count 4.37 +bpbRootDirCluster DD 0 ; 0x60 first cluster of the root dir 4.38 +bpbVolumeSerial DD 0 ; 0x64 volume serial number 4.39 +bpbFSVersionMinor DB 0 ; 0x68 4.40 +bpbFSVersionMajor DB 0 ; 0x69 4.41 +bpbVolumeStateFlags DW 0 ; 0x6A 4.42 +bpbSectorSizeBits DB 0 ; 0x6C sector size as (1 << n) 4.43 +bpbSectorPerClusterBits DB 0 ; 0x6D sector per cluster as (1 << n) 4.44 +bpbNumberOfFATs DB 0 ; 0x6E always 1 4.45 +bpbDriveNumber DB 0 ; 0x6F alaways 0x80 4.46 +bpbAllocatedPercent DB 0 ; 0x70 percentage of allocated space 4.47 4.48 ;;;;;;;;;;;;;;;;;;; 4.49 ;; BPB ends here ;; 4.50 @@ -167,7 +166,7 @@ 4.51 ;;;;;;;;;;;;;;;;;;;;;; 4.52 4.53 push es 4.54 - push main 4.55 + push byte main 4.56 retf 4.57 4.58 main: 4.59 @@ -179,7 +178,7 @@ 4.60 4.61 mov esi, [bx(bpbRootDirCluster)] ; esi=cluster # of root dir 4.62 4.63 - push ImageLoadSeg 4.64 + push byte ImageLoadSeg 4.65 pop es 4.66 4.67 RootDirReadContinue: 4.68 @@ -233,7 +232,7 @@ 4.69 je FindNameFound ; cx = 0 4.70 popa ; restore ax, cx, si, di 4.71 4.72 - add di, 32 4.73 + add di, byte 32 4.74 cmp di, bp 4.75 jne FindNameCycle ; next root entry 4.76 popf ; restore carry="not last sector" flag 4.77 @@ -350,7 +349,7 @@ 4.78 4.79 ReadCluster: 4.80 inc cx ; jcxnz 4.81 - add eax, 1 4.82 + add eax, byte 1 4.83 loop ReadSectorC 4.84 4.85 mov cl, [bx(bpbSectorSizeBits)] 4.86 @@ -437,7 +436,7 @@ 4.87 stc 4.88 loop ReadSectorNext 4.89 4.90 - cmp esi, 0FFFFFFF6h ; carry=0 if last cluster, and carry=1 otherwise 4.91 + cmp esi, byte -10 ; carry=0 if last cluster, and carry=1 otherwise 4.92 ReadSectorNext: 4.93 ret 4.94