75 lines
902 B
NASM
75 lines
902 B
NASM
cpu 8086
|
|
|
|
; Memory layout (starting from top)
|
|
%define self 0xF000
|
|
|
|
; A single sector for disk i/o
|
|
%define diskbuf (self-0x200)
|
|
|
|
; DWORD partition offset for C: and D:
|
|
%define parttab (diskbuf - (2*4))
|
|
|
|
%define stack (parttab)
|
|
|
|
%define default_drive BYTE [0x5B]
|
|
|
|
%define fcb_size 16
|
|
%define bpb_size 18
|
|
|
|
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"
|
|
%include "bpb.asm"
|
|
%include "drive.asm"
|