x86 Wrote a boot loader that prints a message to the screen but the characters are completely different to what I expected

35 Views Asked by At

I've been following a tutorial for creating a bootloader but whenever I run Bochs for testing the OS I get different characters from what I expected. I expected to get a Hello, world but I get ´°» 1Ò½|ß those caracters instead. I'm quite new to programming in assembly so I apologize in advance because I may need more than a single explanation. The code for the bootloader:

[BITS 16] 
[ORG 0x7c00]

start:
    xor ax, ax 
    mov ds, ax 
    mov es, ax 
    mov ss, ax 
    mov sp, 0x7c00

ChangeBackground:
    mov AH, 06h   
    xor al, al    
    xor cx, cx    
    mov dx, 184FH 
    mov BH, 12h  
    int 10H

PrintMessage:
    mov ah, 0x13 
    mov al, 1 
    mov bx, 0xa 
    xor dx, dx 
    mov bp, PrintMessage 
    mov cx, MessageLen 
    int 0x10 

End:
    hlt
    jmp End

Message:    db 'Hello, world'
MessageLen: equ $-Message 

times (0x1be-($-$$)) db 0 
    db 80h
    db 0, 2, 0
    db 0f0h
    db 0ffh, 0ffh, 0ffh
    dd 1
    dd (20*16*63-1)

    times (16*3) db 0

    db 0x55
    db 0xaa

I tried to store the message and its length in a .data section to see if maybe it worked but nope.

0

There are 0 best solutions below