Search code examples
assemblyx86-16bootloaderbasic

How do I load .BAS files From An Assembly Operating System


I need to load some basic (.bas) files from inside my boot loader.

My boot loader is very basic, and all it is supposed to do is display some text and load a .bas file into memory and execute it.

(I am very new to assembly, and don't fully understand it yet, so you might have to explain some things.)

Here is my simple code so far (all it does is display the text.):

    BITS 16

start:
    mov ax, 07C0h       
    add ax, 288     
    mov ss, ax
    mov sp, 4096

    mov ax, 07C0h       
    mov ds, ax


    mov si, text_string 
    call print_string   

    jmp $           


    text_string db 'MyOS BootLoader...', 10, 13
                db 'Looking For Kernel..., 10, 13




    ; *** INSERT .BAS LOADING CODE HERE :D *** 

print_string:           
    mov ah, 0Eh     

.repeat:
    lodsb           
    cmp al, 0
    je .done        
    int 10h         
    jmp .repeat

.done:
    ret


    times 510-($-$$) db 0   
    dw 0xAA55       

(My Code Is Based Of MikeOS by Mike Saunders (found here))

I would appreciate if someone could help me. :)


Solution

  • My boot loader is very basic, and all it is supposed to do is display some text and load a .bas file into memory and execute it.

    This is more difficult than you think. Running a BASIC program requires an interpreter. Unless you're on a genuine IBM PC with BASIC in ROM (which hasn't been a thing since the 1980s), you'd need to include an interpreter in your boot sector. (Which is not going to fit.)

    Consider loading a different type of executable -- like a COM file.