rdos/kernel/main.asm
2019-08-30 22:18:05 +00:00

104 lines
1.5 KiB
NASM

cpu 8086
org 0x0000
db 0x55, 0xAA
optrom_length:
db 0x00
jmp optrom_init
; reserved area
times (0x1A - ($-$$)) db 0
dw pnp
align 16
pnp:
db "$PnP"
.version:
db 1 ; version 1
.length:
db 2 ; 2 * 16 length
dw 0 ; offset of next header
db 0
.checksum:
db 0 ; checksum (filled by fix-rom)
dd 0 ; device identifier
dw str_vendor ; manufacturer string
dw str_product ; 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 start ; bootstrap entry point
dw 0 ; reserved
dw 0
str_vendor:
db "Nero", 0
str_product:
db "Nero DOS ", 60, 234, 62, 0
optrom_init:
; setup data stack below code stack
mov bp, sp
sub bp, 0x80
; intnum and offset to data stack
mov word [ss:bp], 0x18
mov word [ss:bp+2], start
call intr_register
retf
putc:
push bx
push cx
mov ah, 0x0e
mov bx, 0x0000
int 0x10
pop cx
pop bx
ret
announce:
push ds
push cs
mov ax, cs
mov ds, ax
mov ax, str_product
push ax
call printf
db "%S (CS=%Xh)", 0x0A, 0x0D, 0x00
add sp, 4
pop ds
ret
start:
xor ax, ax
mov ds, ax
mov es, ax
; setup code + data stack
mov ss, ax
mov sp, ax
mov bp, sp
call announce
call malloc_reset
call malloc_dump
cli
.halt:
hlt
jmp .halt
%include "printf.inc"
%include "print.asm"
%include "popcnt.asm"
%include "intr.asm"
%include "debug.asm"
%include "malloc.asm"
times 512 nop
align 512