boot32, boot32lb: mark magic offsets with macro

This commit is contained in:
E. C. Masloch 2024-02-07 00:18:22 +01:00 committed by Kenneth J Davis
parent d9b0615ad5
commit 9783ac97e0
3 changed files with 19 additions and 3 deletions

View File

@ -28,6 +28,10 @@
;%define MULTI_SEC_READ 1 ;%define MULTI_SEC_READ 1
; NOTE: sys must be updated if magic offsets change
%assign ISFAT1216DUAL 0
%include "magic.mac"
segment .text segment .text
@ -96,12 +100,14 @@ real_start: cld
jmp word 0x1FE0:cont jmp word 0x1FE0:cont
loadseg_off dw 0 loadseg_off dw 0
magicoffset "loadseg", 78h
loadseg_seg dw LOADSEG loadseg_seg dw LOADSEG
cont: mov ds, ax cont: mov ds, ax
mov ss, ax mov ss, ax
lea sp, [bp-0x20] lea sp, [bp-0x20]
sti sti
magicoffset "set unit", 82h
mov [drive], dl ; BIOS passes drive number in DL mov [drive], dl ; BIOS passes drive number in DL
; call print ; call print
@ -401,6 +407,7 @@ no_incr_es:
times 0x01f1-$+$$ db 0 times 0x01f1-$+$$ db 0
magicoffset "kernel name", 1F1h
filename db "KERNEL SYS",0,0 filename db "KERNEL SYS",0,0
sign dw 0xAA55 sign dw 0xAA55

View File

@ -53,6 +53,11 @@
; We support values between 0x60 and 0x200 here, with file size ; We support values between 0x60 and 0x200 here, with file size
; of up to 128 KiB (rounded to cluster size). Default is 0x60. ; of up to 128 KiB (rounded to cluster size). Default is 0x60.
; NOTE: sys must be updated if magic offsets change
%assign ISFAT1216DUAL 0
%include "magic.mac"
segment .text segment .text
org 0x7c00 ; this is a boot sector org 0x7c00 ; this is a boot sector
@ -129,7 +134,9 @@ real_start: cld
rep movsw ; move boot code to the 0x1FE0:0x0000 rep movsw ; move boot code to the 0x1FE0:0x0000
jmp word 0x1FE0:cont jmp word 0x1FE0:cont
loadseg_off dw 0, LOADSEG loadseg_off dw 0
magicoffset "loadseg", 78h
dw LOADSEG
; ------------- ; -------------
@ -137,6 +144,7 @@ cont: mov ds, ax
mov ss, ax ; stack and BP-relative moves up, too mov ss, ax ; stack and BP-relative moves up, too
lea sp, [bp-0x20] lea sp, [bp-0x20]
sti sti
magicoffset "set unit", 82h
mov [drive], dl ; BIOS passes drive number in DL mov [drive], dl ; BIOS passes drive number in DL
%ifndef QUIET %ifndef QUIET
@ -413,6 +421,7 @@ msg_BootError db "No "
; currently, only "kernel.sys not found" gives a message, ; currently, only "kernel.sys not found" gives a message,
; but read errors in data or root or fat sectors do not. ; but read errors in data or root or fat sectors do not.
magicoffset "kernel name", 1F1h
filename db "KERNEL SYS" filename db "KERNEL SYS"
sign dw 0, 0xAA55 sign dw 0, 0xAA55

View File

@ -13,10 +13,10 @@ fat12com.bin: boot.asm magic.mac
fat16com.bin: boot.asm magic.mac fat16com.bin: boot.asm magic.mac
$(NASM) -dISFAT16 $(NASMBOOTFLAGS) boot.asm -l$*.lst -ofat16com.bin $(NASM) -dISFAT16 $(NASMBOOTFLAGS) boot.asm -l$*.lst -ofat16com.bin
fat32chs.bin: boot32.asm fat32chs.bin: boot32.asm magic.mac
$(NASM) $(NASMBOOTFLAGS) boot32.asm -l$*.lst -ofat32chs.bin $(NASM) $(NASMBOOTFLAGS) boot32.asm -l$*.lst -ofat32chs.bin
fat32lba.bin: boot32lb.asm fat32lba.bin: boot32lb.asm magic.mac
$(NASM) $(NASMBOOTFLAGS) boot32lb.asm -l$*.lst -ofat32lba.bin $(NASM) $(NASMBOOTFLAGS) boot32lb.asm -l$*.lst -ofat32lba.bin
oemfat12.bin: oemboot.asm oemfat12.bin: oemboot.asm