Throw DOS api away, re-layout memory to fit CP/M model
This commit is contained in:
parent
2935d7ee6c
commit
56f9df5773
5 changed files with 57 additions and 210 deletions
60
boot/fat.asm
60
boot/fat.asm
|
@ -1,13 +1,15 @@
|
|||
; Memory layout:
|
||||
%define self 0x00600 ; 1 sector
|
||||
%define fattab 0x01000 ; variable size
|
||||
%define rootdir 0x06000 ; variable size
|
||||
%define config 0x07800
|
||||
%define prog 0x07C00
|
||||
%define segment 0x00100
|
||||
|
||||
%define self (0x7C00-(segment<<4)) ; 1 sector
|
||||
%define fattab (self+0x200) ; variable size
|
||||
%define rootdir 0x00100 ; variable size
|
||||
%define prog 0x0F000 ; 4K at the end for OS
|
||||
|
||||
org self
|
||||
|
||||
jmp short init
|
||||
dw self
|
||||
|
||||
cluster_offset:
|
||||
dw 0
|
||||
|
@ -58,23 +60,16 @@ times (62 - ($-$$)) nop
|
|||
|
||||
init:
|
||||
cli
|
||||
|
||||
; Stack grows down from 64k
|
||||
xor ax, ax
|
||||
mov ss, ax
|
||||
mov sp, ax
|
||||
|
||||
; Relocate from [prog] to [self]
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov si, prog
|
||||
mov di, self
|
||||
mov cx, 0x100
|
||||
rep movsw
|
||||
|
||||
jmp 0:main
|
||||
jmp segment:main
|
||||
|
||||
main:
|
||||
; Stack grows down from 64k
|
||||
mov ax, cs
|
||||
mov ss, ax
|
||||
mov sp, prog
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
mov [fdc.drv], dl ; save drive number in fd
|
||||
sti
|
||||
|
||||
|
@ -110,31 +105,10 @@ main:
|
|||
mov bp, 0x3332
|
||||
jc error
|
||||
|
||||
; Load config file after kernel
|
||||
push bx
|
||||
mov ax, config_name
|
||||
call load_file
|
||||
pop bx
|
||||
|
||||
; Write a null byte after config file
|
||||
mov BYTE [bx+di], 0
|
||||
|
||||
; Setup registers for kernel
|
||||
xor ax, ax
|
||||
; CX is size of config
|
||||
mov cx, di
|
||||
; DL is drive number
|
||||
xor dx, dx
|
||||
mov dl, [fdc.drv]
|
||||
; BX is offset of config
|
||||
sub bx, prog
|
||||
; the pointers are 0
|
||||
xor bp, bp
|
||||
xor si, si
|
||||
xor di, di
|
||||
|
||||
; jump into kernel
|
||||
jmp (prog>>4):0
|
||||
jmp segment:prog
|
||||
|
||||
; Load a file into memory
|
||||
; IN AX pointer to 8.3 filename
|
||||
|
@ -260,8 +234,6 @@ error:
|
|||
int 0x16
|
||||
int 0x19
|
||||
|
||||
config_name:
|
||||
db "RCONFIG SYS"
|
||||
kernel_name:
|
||||
db "RDOS SYS"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue