Bootloader that prints a string in assembly

Viewed 829

I have a very simple boot loader in assembly that is supposed to print a string. I've tried looking up many different ways to print a string in assembly but none of them have worked for me. this is my most recent attempt that I've seen in a couple of tutorials but it doesn't work. it prints a T rather than the message.

mov si, message       ;The message location *you can change this*
    call print            ;CALL tells the pc to jump back here when done

    print:
      mov ah, 0Eh         ;Set function

    .run:
      lodsb               ;Get the char
    ; cmp al, 0x00        ;I would use this but ya know u dont so use:
      cmp al, 0           ;0 has a HEX code of 0x48 so its not 0x00
      je .done            ;Jump to done if ending code is found
      int 10h             ;Else print
      jmp .run            ; and jump back to .run

    .done:
      ret                 ;Return

    message           db  'Hello, world', 0 ;IF you use 0x00
    ;message          db  'Hello, world', 0x00

jmp $

times 510-($-$$) db 0
dw 0xaa55
0 Answers
Related