[ASM] Simple bootloader FASM

Results 1 to 3 of 3
  1. #1
    Alpha Member Emily is offline
    MemberRank
    Oct 2012 Join Date
    The NetherlandsLocation
    2,408Posts

    [ASM] Simple bootloader FASM

    Hello guys,

    Recently I've been making a simple bootloader in FASM. I want to improve my assembly and I want to start a simple DOS-OS.
    I want to share my code and please review it!

    PHP Code:
    start:
        
    mov ax07C0h
        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 'I like dis shiz'13100

    print_string
    :    
        
    mov ah0Eh

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

    .done:
        
    ret


        times 510
    -($-$$) db 0
        dw 0xAA55 
    I KNOW it's not really good but I want a review!
    I like to improve it a lot.

    Thanks already. Have a good day.


  2. #2

    Re: [ASM] Simple bootloader FASM

    Your sample starts bei setting the stack location & segments to hogwarts. Means, it uses some "magic".


    You are using the BIOS interrupt call 10h, but you're not initializing the BX register. Depending on certain video modes, it wouldn't even work.


    Performance tips:

    1. Video mode setting
    2. Pointing registers to the main memory location (shared with the video card)
    3. Writing characters into the video memory



    But don't worry, your sample is okay.
    I'll expand my post soon, I haven't got much time for the moment.


    // Some pretty useful resources:
    http://wiki.osdev.org/Bootloader
    http://wiki.osdev.org/Rolling_Your_Own_Bootloader
    Last edited by Haku Douga; 22-04-14 at 03:32 PM.

  3. #3
    Alpha Member Emily is offline
    MemberRank
    Oct 2012 Join Date
    The NetherlandsLocation
    2,408Posts

    Re: [ASM] Simple bootloader FASM

    Quote Originally Posted by Haku Douga View Post
    Your sample starts bei setting the stack location & segments to hogwarts. Means, it uses some "magic".


    You are using the BIOS interrupt call 10h, but you're not initializing the BX register. Depending on certain video modes, it wouldn't even work.


    Performance tips:

    1. Video mode setting
    2. Pointing registers to the main memory location (shared with the video card)
    3. Writing characters into the video memory



    But don't worry, your sample is okay.
    I'll expand my post soon, I haven't got much time for the moment.


    // Some pretty useful resources:
    http://wiki.osdev.org/Bootloader
    http://wiki.osdev.org/Rolling_Your_Own_Bootloader
    Thanks for your review.
    I know it's not the best but all this is for is just to learn. When I've learnt more in the future I might concider a real OS, but for now, just a simple, small one is enough.
    Will take a look at the links you gave me.



Advertisement