Start working on rom-based kernel

This commit is contained in:
Nero 2020-05-29 00:32:30 +02:00
parent 04a7087d79
commit 65564b78af
3 changed files with 141 additions and 0 deletions

68
rom/kernel.asm Normal file
View file

@ -0,0 +1,68 @@
cpu 8086
org 0x0000
db 0x55, 0xAA
db 0x00
jmp near init
times (0x18 - ($-$$)) db 0
dw 0
dw pnp
pnp: db "$PnP"
db 1 ; version 1
db 2 ; 2 * 16 length
dw 0 ; offset of next header
db 0
db 0 ; checksum (filled by fix-rom)
dd 0 ; device identifier
dw 0 ; manufacturer string
dw name ; product name string
db 0,0,0 ; device type string
db 0x20 ; device indicator, bit for "read cacheable" set
dw 0 ; boot connection vector
dw 0 ; boot disconnect vector
dw boot ; bootstrap entry point
dw 0 ; reserved
; zero for setting sreg without using reg
zero: dw 0
name: db "rdos", 0
init: push ds
; DS := 0
mov ds, [cs:zero]
; set entry points vectors
mov word [0x19*4], boot
mov word [0x19*4+2], cs
pop ds
retf
; entry point on boot, preempting disks
; this also doubles as entry point for reboot
boot: xor ax, ax
mov ss, ax
mov sp, stack
int 3
hlt: hlt
jmp hlt
%include "kernel/intr.asm"
align 512
absolute 0x400
resb (0x501 - ($-$$))
; copy of the first 32 interrupt vectors
ivt2: resd 0x20
; 8kb stack
alignb 2
resw 0x2000
stack: