Make bootloader load both kernel and kernel config
This commit is contained in:
parent
6411dc0c9c
commit
a4e6a943b0
45
boot/fat.asm
45
boot/fat.asm
@ -2,11 +2,9 @@
|
||||
%define self 0x00600 ; 1 sector
|
||||
%define fattab 0x01000 ; variable size
|
||||
%define rootdir 0x06000 ; variable size
|
||||
%define psp (prog - 0x100)
|
||||
%define config 0x07800
|
||||
%define prog 0x07C00
|
||||
|
||||
%define arguments (psp + 0x81)
|
||||
|
||||
org self
|
||||
|
||||
jmp short init
|
||||
@ -61,14 +59,12 @@ times (62 - ($-$$)) nop
|
||||
init:
|
||||
cli
|
||||
|
||||
; Stack grows down from PSP + 64k
|
||||
mov ax, (psp >> 4)
|
||||
; Stack grows down from 64k
|
||||
xor ax, ax
|
||||
mov ss, ax
|
||||
xor sp, sp
|
||||
push sp
|
||||
mov sp, ax
|
||||
|
||||
; Relocate from [prog] to [self]
|
||||
xor ax, ax
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov si, prog
|
||||
@ -107,20 +103,28 @@ main:
|
||||
; clusters start after rootdir
|
||||
mov [cluster_offset], ax
|
||||
|
||||
mov ax, filename
|
||||
mov bx, prog
|
||||
|
||||
mov ax, kernel_name
|
||||
call load_file
|
||||
mov bp, 0x3332
|
||||
jc error
|
||||
|
||||
mov si, bx
|
||||
sub si, prog
|
||||
|
||||
push si
|
||||
|
||||
mov ax, config_name
|
||||
call load_file
|
||||
|
||||
pop si
|
||||
|
||||
int3
|
||||
|
||||
; restore boot drive number
|
||||
mov dl, [fdc.drv]
|
||||
|
||||
; setup segment registers
|
||||
push ss
|
||||
pop ds
|
||||
push ss
|
||||
pop es
|
||||
|
||||
; jump into target
|
||||
jmp 0x07C0:0x0000
|
||||
|
||||
@ -128,6 +132,7 @@ main:
|
||||
; IN AX pointer to 8.3 filename
|
||||
; ES:BX pointer to target area
|
||||
; OUT CF flag set if error
|
||||
; DI file size in bytes (<64K)
|
||||
load_file:
|
||||
mov si, rootdir
|
||||
mov cx, [fdc.rde]
|
||||
@ -142,12 +147,12 @@ load_file:
|
||||
je .read
|
||||
add si, 0x20
|
||||
loop .search
|
||||
xor di, di
|
||||
stc
|
||||
ret
|
||||
.read:
|
||||
add si, 0x1A
|
||||
lodsw
|
||||
mov bx, prog
|
||||
mov ax, [si+0x1A]
|
||||
mov di, [si+0x1C]
|
||||
jmp read_clusters
|
||||
|
||||
; Read the file given by cluster number
|
||||
@ -247,7 +252,9 @@ error:
|
||||
int 0x16
|
||||
int 0x19
|
||||
|
||||
filename:
|
||||
config_name:
|
||||
db "RCONFIG SYS"
|
||||
kernel_name:
|
||||
db "RDOS SYS"
|
||||
|
||||
times (0x1FE - ($-$$)) db 0
|
||||
|
Loading…
Reference in New Issue
Block a user