Create basic MCB at boot
This commit is contained in:
parent
70a675442a
commit
6c165f40c0
@ -3,6 +3,7 @@
|
||||
jmp 0x07C0:init
|
||||
|
||||
%include "inc/bpb.asm"
|
||||
%include "kernel/mcb.asm"
|
||||
|
||||
banner: db "rdos", 0xA, 0xD, 0
|
||||
|
||||
@ -39,8 +40,6 @@ entry: push bp
|
||||
mov ss, ax
|
||||
xor sp, sp
|
||||
|
||||
int 3
|
||||
|
||||
; Jump back to userspace
|
||||
ujump: cli
|
||||
mov ax, es
|
||||
@ -233,9 +232,8 @@ init: cli
|
||||
|
||||
call dnconv
|
||||
call select
|
||||
int 3
|
||||
mov ax, [cs:bpb+bpb_ss]
|
||||
int 3
|
||||
|
||||
call mcb_init
|
||||
|
||||
main: push cs
|
||||
pop ds
|
||||
|
40
kernel/mcb.asm
Normal file
40
kernel/mcb.asm
Normal file
@ -0,0 +1,40 @@
|
||||
; First MCB block is always at 00540
|
||||
mcb_first:
|
||||
mov ax, 0x54
|
||||
mov ds, ax
|
||||
ret
|
||||
|
||||
mcb_init:
|
||||
call mcb_first
|
||||
mov dx, ds
|
||||
inc dx
|
||||
xor si, si
|
||||
int 0x12
|
||||
mov cl, 6
|
||||
shl ax, cl
|
||||
sub ax, dx
|
||||
mov byte [si+0], 'Z'
|
||||
mov word [si+1], 0
|
||||
mov word [si+3], ax
|
||||
mov dx, cs
|
||||
call mcb_find
|
||||
int 3
|
||||
ret
|
||||
|
||||
; IN dx segment we look for
|
||||
; OUT ds segment where mcb starts
|
||||
mcb_find:
|
||||
call mcb_first
|
||||
xor si, si
|
||||
.loop: stc
|
||||
adc ax, [si+3]
|
||||
cmp dx, ax
|
||||
jc .found
|
||||
cmp byte [si+0], 'Z'
|
||||
jz .fail
|
||||
mov ds, ax
|
||||
jmp .loop
|
||||
.fail: stc
|
||||
ret
|
||||
.found: clc
|
||||
ret
|
Loading…
Reference in New Issue
Block a user