From 9783ac97e0d981099476bbbe9ca0e3f242d4f130 Mon Sep 17 00:00:00 2001 From: "E. C. Masloch" Date: Wed, 7 Feb 2024 00:18:22 +0100 Subject: [PATCH] boot32, boot32lb: mark magic offsets with macro --- boot/boot32.asm | 7 +++++++ boot/boot32lb.asm | 11 ++++++++++- boot/makefile | 4 ++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/boot/boot32.asm b/boot/boot32.asm index cd5327c..5f72690 100644 --- a/boot/boot32.asm +++ b/boot/boot32.asm @@ -28,6 +28,10 @@ ;%define MULTI_SEC_READ 1 + ; NOTE: sys must be updated if magic offsets change +%assign ISFAT1216DUAL 0 + %include "magic.mac" + segment .text @@ -96,12 +100,14 @@ real_start: cld jmp word 0x1FE0:cont loadseg_off dw 0 + magicoffset "loadseg", 78h loadseg_seg dw LOADSEG cont: mov ds, ax mov ss, ax lea sp, [bp-0x20] sti + magicoffset "set unit", 82h mov [drive], dl ; BIOS passes drive number in DL ; call print @@ -401,6 +407,7 @@ no_incr_es: times 0x01f1-$+$$ db 0 + magicoffset "kernel name", 1F1h filename db "KERNEL SYS",0,0 sign dw 0xAA55 diff --git a/boot/boot32lb.asm b/boot/boot32lb.asm index 708861a..7f0e48b 100644 --- a/boot/boot32lb.asm +++ b/boot/boot32lb.asm @@ -53,6 +53,11 @@ ; We support values between 0x60 and 0x200 here, with file size ; 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 org 0x7c00 ; this is a boot sector @@ -129,7 +134,9 @@ real_start: cld rep movsw ; move boot code to the 0x1FE0:0x0000 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 lea sp, [bp-0x20] sti + magicoffset "set unit", 82h mov [drive], dl ; BIOS passes drive number in DL %ifndef QUIET @@ -413,6 +421,7 @@ msg_BootError db "No " ; currently, only "kernel.sys not found" gives a message, ; but read errors in data or root or fat sectors do not. + magicoffset "kernel name", 1F1h filename db "KERNEL SYS" sign dw 0, 0xAA55 diff --git a/boot/makefile b/boot/makefile index e8c4a7e..6bd7f68 100644 --- a/boot/makefile +++ b/boot/makefile @@ -13,10 +13,10 @@ fat12com.bin: boot.asm magic.mac fat16com.bin: boot.asm magic.mac $(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 -fat32lba.bin: boot32lb.asm +fat32lba.bin: boot32lb.asm magic.mac $(NASM) $(NASMBOOTFLAGS) boot32lb.asm -l$*.lst -ofat32lba.bin oemfat12.bin: oemboot.asm