Why is the string split when outputting ASCII strings in MBR?

24 Views Asked by At

In the MBR program, the following code is used to print "Hello world" to the screen:

section MBR vstart=0x7C00
    mov sp, $$
    ...
    ; Set the memory address of the graphics card to the ES register.
    mov ax, 0xB800
    mov es, ax

    ...

    ; Output string to 0xB8000
    mov byte [es: 0x00], 'H'
    mov byte [es: 0x02], 'e'
    mov byte [es: 0x04], 'l'
    mov byte [es: 0x06], 'l'
    mov byte [es: 0x08], 'o'
    mov byte [es: 0x10], ' '
    mov byte [es: 0x12], 'w'
    mov byte [es: 0x14], 'o'
    mov byte [es: 0x16], 'r'
    mov byte [es: 0x18], 'l'
    mov byte [es: 0x20], 'd'

    mov byte [es: 0x01], STYLE
    mov byte [es: 0x03], STYLE
    ...
    mov byte [es: 0x19], STYLE
    mov byte [es: 0x21], STYLE

    jmp $

; Set the style of the string, the background color is green, the text is blinking, and the foreground color is black.
STYLE equ 0xA4
times 510-($-$$) db 0
db 0x55, 0xAA

I get this result:

enter image description here

It looks like a break in groups of 5 characters. why is that?

0

There are 0 best solutions below