rdos/kernel/main.asm

66 lines
889 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]
2019-10-08 19:54:39 +02:00
%define fcb_size 31
2019-09-29 23:25:29 +02:00
org self
jmp init
2019-09-06 00:24:39 +02:00
banner:
2019-10-08 21:53:41 +02:00
db "RDOS 2019-09", 0x0A, 0x0D, '$', 0
2019-09-19 22:02:16 +02:00
init:
mov sp, stack
2019-10-08 21:53:41 +02:00
mov default_drive, 0x01
2019-10-08 21:53:41 +02:00
mov dx, banner
call print_string
2019-09-29 14:23:39 +02:00
2019-10-08 21:53:41 +02:00
mov dx, 0x79
mov byte [0x79], 0x7F
call read_buffer
mov ax, [0x79]
int3
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:
2019-10-08 21:53:41 +02:00
cmp cl, 0
je init
cmp cl, 1
je console_input
cmp cl, 2
je console_output
cmp cl, 9
je print_string
cmp cl, 10
je read_buffer
stc
ret
2019-10-08 21:53:41 +02:00
%include "char.asm"
2019-09-29 14:23:39 +02:00
%include "exec.asm"
%include "fcb.asm"
2019-10-08 19:54:39 +02:00
%include "fcbparse.asm"
2019-09-29 23:25:29 +02:00
%include "drive.asm"
2019-10-08 19:54:39 +02:00
%include "log2.asm"