rdos/kernel/main.asm

75 lines
902 B
NASM
Raw Normal View History

cpu 8086
; Memory layout (starting from top)
2019-09-29 14:23:39 +02:00
%define self 0xF000
; A single sector for disk i/o
%define diskbuf (self-0x200)
2019-09-29 14:23:39 +02:00
; DWORD partition offset for C: and D:
2019-09-29 23:25:29 +02:00
%define parttab (diskbuf - (2*4))
2019-09-29 14:23:39 +02:00
%define stack (parttab)
2019-09-29 23:25:29 +02:00
%define default_drive BYTE [0x5B]
%define fcb_size 16
%define bpb_size 18
org self
jmp init
2019-09-06 00:24:39 +02:00
banner:
db "RDOS 2019-09", 0x0A, 0x0D, 0
print_banner:
mov cl, 2
mov si, banner
.loop:
mov dl, BYTE [si]
test dl, dl
jz .end
call cpm_syscall
inc si
jmp .loop
.end:
ret
2019-09-19 22:02:16 +02:00
init:
mov sp, stack
call print_banner
2019-09-29 14:23:39 +02:00
mov si, init_program
call exec
cli
.halt:
hlt
jmp .halt
2019-09-06 00:24:39 +02:00
2019-09-29 14:23:39 +02:00
init_program:
db "HELLO.COM", 0
cpm_syscall:
cmp cl, 0x02
je putc
stc
ret
putc:
push ax
push bx
mov al, dl
mov ah, 0x0e
mov bx, 0x0000
int 0x10
pop bx
pop ax
ret
2019-09-29 14:23:39 +02:00
%include "exec.asm"
%include "fcb.asm"
2019-09-29 23:25:29 +02:00
%include "bpb.asm"
%include "drive.asm"