Printing special (non-Latin) characters in a legacy-BIOS bootloader

Viewed 121

I'm making a simple bootloader. I want to print some non-latin text on the screen but it can't print the character 'ü' correctly. How can I make my OS print characters like ü? I've searched for it but I couldn't find anything about it.

main.asm

[org 0x7c00]

call clear
mov bx, SELAM
call print
call print_nl
mov bx, NABER
call print

jmp $

%include "print.asm"

SELAM:
    db 'Selamun Aleyküm.', 0
NABER:
    db 'Nabün?', 0

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

print.asm

print:
    pusha

start:
    mov al, [bx]
    cmp al, 0 
    je done

    mov ah, 0x0e
    int 0x10
    
    add bx, 1
    jmp start

done:
    popa
    ret



print_nl:
    pusha
    
    mov ah, 0x0e
    mov al, 0x0a
    int 0x10
    mov al, 0x0d
    int 0x10
    
    popa
    ret

clear:
    pusha
    mov ah, 0x00
    mov al, 0x03
    int 0x10
    popa
    ret

And I use NASM as Assembler.

2 Answers

The editor that you use to write the source text might not map the ASCII code for the character "ü" to the number 129. But the computer that executes your bootloader will be using codepage 437 (at startup), and thus require 129 to display "ü".

You can manually insert the correct ASCII code in the text like so:

SELAM:
    db 'Selamun Aleyk', 129, 'm.', 0
NABER:
    db 'Nab', 129, 'n?', 0

There's also an uppercase version "Ü":

SELAM:
    db 'SELAMUN ALEYK', 154, 'M.', 0
NABER:
    db 'NAB', 154, 'N?', 0
Related