oemboot: use magic offsets macro

This commit is contained in:
E. C. Masloch 2024-02-07 00:39:37 +01:00 committed by Kenneth J Davis
parent 19058ff1bf
commit fc3032deb7
3 changed files with 17 additions and 6 deletions

View File

@ -44,7 +44,7 @@ _appenddigitstrdef %1, (%2 >> (0 * 4)) & 0Fh
%endif %endif
%endmacro %endmacro
%macro magicoffset 2-3.nolist %macro magicoffset 2-4.nolist ,0
%if ISFAT1216DUAL %if ISFAT1216DUAL
%ifdef ISFAT12 %ifdef ISFAT12
%define SYSOFFSET %2 %define SYSOFFSET %2
@ -62,7 +62,7 @@ _appenddigitstrdef %1, (%2 >> (0 * 4)) & 0Fh
%error Not in dual mode %error Not in dual mode
%endif %endif
%endif %endif
%assign NEWOFFSET $ - Entry %assign NEWOFFSET $ + %4 - Entry
%if NEWOFFSET != SYSOFFSET %if NEWOFFSET != SYSOFFSET
_autohexitsstrdef NEWOFFSETHEX, NEWOFFSET _autohexitsstrdef NEWOFFSETHEX, NEWOFFSET
%strcat _NEWOFFSETHEX _NEWOFFSETHEX,'h' %strcat _NEWOFFSETHEX _NEWOFFSETHEX,'h'

View File

@ -19,10 +19,10 @@ fat32chs.bin: boot32.asm magic.mac
fat32lba.bin: boot32lb.asm magic.mac 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 magic.mac
$(NASM) -dISFAT12 $(NASMBOOTFLAGS) oemboot.asm -l$*.lst -ooemfat12.bin $(NASM) -dISFAT12 $(NASMBOOTFLAGS) oemboot.asm -l$*.lst -ooemfat12.bin
oemfat16.bin: oemboot.asm oemfat16.bin: oemboot.asm magic.mac
$(NASM) -dISFAT16 $(NASMBOOTFLAGS) oemboot.asm -l$*.lst -ooemfat16.bin $(NASM) -dISFAT16 $(NASMBOOTFLAGS) oemboot.asm -l$*.lst -ooemfat16.bin
clobber: clean clobber: clean

View File

@ -116,6 +116,11 @@
; |IVT | Interrupt Vector Table ; |IVT | Interrupt Vector Table
; +--------+ 0000:0000 ; +--------+ 0000:0000
; NOTE: sys must be updated if magic offsets change
%assign ISFAT1216DUAL 1
%include "magic.mac"
CPU 8086 ; enable assembler warnings to limit instruction set CPU 8086 ; enable assembler warnings to limit instruction set
;%define ISFAT12 1 ; only 1 of these should be set, ;%define ISFAT12 1 ; only 1 of these should be set,
@ -227,15 +232,17 @@ Entry: jmp short real_start
; The filesystem ID is used by lDOS's instsect (by ecm) ; The filesystem ID is used by lDOS's instsect (by ecm)
; by default to validate that the filesystem matches. ; by default to validate that the filesystem matches.
%ifdef ISFAT12 %ifdef ISFAT12
db "FAT12" ; filesystem id %define FATFS "FAT12"
%ifdef ISFAT16 %ifdef ISFAT16
%error Must select one FS %error Must select one FS
%endif %endif
%elifdef ISFAT16 %elifdef ISFAT16
db "FAT16" %define FATFS "FAT16"
%else %else
%define FATFS "unknown"
%error Must select one FS %error Must select one FS
%endif %endif
db FATFS ; filesystem id
times 3Eh - ($ - $$) db 32 times 3Eh - ($ - $$) db 32
;----------------------------------------------------------------------- ;-----------------------------------------------------------------------
@ -282,6 +289,7 @@ real_start:
; in DL, however we work around this in SYS.COM by NOP'ing out the use of DL ; 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) ; (formerly we checked for [drive]==0xff; update sys.c if code moves)
; ;
magicoffset "set unit", 4Fh, 4Fh
mov [drive], dl ; rely on BIOS drive number in DL mov [drive], dl ; rely on BIOS drive number in DL
@ -470,6 +478,7 @@ cluster_next: lodsw ; AX = next cluster to read
%else %else
jmp LOADSEG:0000 ; yes, pass control to kernel jmp LOADSEG:0000 ; yes, pass control to kernel
%endif %endif
magicoffset "load jump ofs", 11Ah, 118h, -4
; failed to boot ; failed to boot
@ -655,6 +664,8 @@ read_skip:
ret ret
times 0x01f1-$+$$ db 0 times 0x01f1-$+$$ db 0
magicoffset "kernel name", 1F1h, 1F1h
%ifdef MSCOMPAT %ifdef MSCOMPAT
filename db "IO SYS" filename db "IO SYS"
%else %else