From 4ae6f22249fc91577c586eb3e5b6b410120e5fd2 Mon Sep 17 00:00:00 2001
From: "E. C. Masloch" <pushbx@ulukai.org>
Date: Tue, 6 Feb 2024 23:58:10 +0100
Subject: [PATCH] sys, boot: mark additional magic offsets

---
 boot/boot.asm | 3 +++
 sys/sys.c     | 1 +
 2 files changed, 4 insertions(+)

diff --git a/boot/boot.asm b/boot/boot.asm
index 6b94d48..a52bb52 100644
--- a/boot/boot.asm
+++ b/boot/boot.asm
@@ -264,6 +264,7 @@ real_start:
                 jmp     word 0x1FE0:cont
 
 loadseg_off     dw      0
+	magicoffset "loadseg", 5Ch, 5Ch
 loadseg_seg     dw      LOADSEG
 
 cont:
@@ -276,6 +277,7 @@ cont:
 ; in DL, however we work around this in SYS.COM by NOP'ing out the use of DL
 ; (formerly we checked for [drive]==0xff; update sys.c if code moves)
 ;
+	magicoffset "set unit", 66h, 66h
                 mov     [drive], dl     ; rely on BIOS drive number in DL
 
                 mov     LBA_SIZE, 10h
@@ -616,6 +618,7 @@ do_int13_read:
 
        times   0x01f1-$+$$ db 0
 
+	magicoffset "kernel name", 1F1h, 1F1h
 filename        db      "KERNEL  SYS",0,0
 
 sign            dw      0xAA55
diff --git a/sys/sys.c b/sys/sys.c
index eb6d0dc..3cffcc6 100644
--- a/sys/sys.c
+++ b/sys/sys.c
@@ -1762,6 +1762,7 @@ void put_boot(SYSOptions *opts)
   
   {
     int i = 0;
+    /* magic offset: (first) kernel filename */
     memset(&newboot[0x1f1], ' ', 11);
     while (opts->kernel.kernel[i] && opts->kernel.kernel[i] != '.')
     {