cpu 8086 org 0x0700 %include "inc/bpb.asm" %include "inc/mbr.asm" %include "inc/fcb.asm" %include "inc/dpt.asm" init: cli xor ax, ax mov ds, ax mov es, ax mov ss, ax mov sp, ax mov si, 0x7C00 ; relocate to 00700 mov di, text_start mov cx, text_length + rodata_length + data_length rep movsb ; clear out bss section mov cx, bss_length rep stosb ; jump to copy call 0:relinit section .rodata %define V 0x %+ VERSION version: dd V section .text relinit: ; print banner push word [version] push word [version+2] call printf db "RDOS ",2,2, 0x0A, 0x0D, 0 push dx call dinit pop dx mov word [0x21*4], int21 mov word [0x21*4+2], cs ; set current PSP, directly after us mov ax, stack mov cl, 4 shr ax, cl mov word [curpsp], ax cmp dl, 0x80 jc .k sub dl, (0x80-2) .k: call setdd mov ah, 2 mov dl, 0x37 int 0x21 mov dx, testfcb mov ah, 0xF int 0x21 restart: hlt: hlt jmp hlt %include "kernel/syscall.asm" %include "kernel/char.asm" %include "kernel/fcb.asm" %include "kernel/drive.asm" %include "kernel/printf.asm" section .data testfcb: db 0 db "HELLO ", "COM" times 30 db 0 section .text text_start equ $$ text_length equ $-$$ section .rodata rodata_start equ $$ rodata_length equ $-$$ section .data data_start equ $$ data_length equ $-$$ section .bss resw 256 ; 512b kern stack alignb 16 stack: ; stack grows into this ^ ; this is also the end marker ; programs with their psp start here bss_start equ $$ bss_length equ $-$$