rdos/kernel/main.asm

72 lines
896 B
NASM

cpu 8086
; Memory layout (starting from top)
%define self 0xF000
; A single sector for disk i/o
%define diskbuf (self-0x200)
; BYTE sectors/track and BYTE number of sides
; 4 times for A: B: C: and D:
%define chstab (diskbuf - (4*2))
; DWORD partition offset for C: and D:
%define parttab (chstab - (2*4))
%define stack (parttab)
org self
jmp init
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
init:
mov sp, stack
call print_banner
mov si, init_program
call exec
cli
.halt:
hlt
jmp .halt
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
%include "exec.asm"
%include "fcb.asm"