I want to send "Hello world" to the memory of the graphics card, the code is as follows:
section MBR vstart=0x7C00
...
mov ax, 0xB800
mov gs, ax
...
mov cx, 0
mov bx, 0
cmp cx, STRLEN
jl cycle
jmp end
cycle:
mov byte ah, [MESSAGE + cx]
mov [gs:(0x00 + bx)], ah
mov [gs:(0x00 + bx + 1)], STYLE
add bx, 2
add cx, 1
cmp cx, STRLEN
jl cycle
end:
jmp $
MESSAGE db "Hello World!"
STRLEN equ $ - MESSAGE
; Set the text attribute, A means the green background flashes, 4 means the foreground color is red
STYLE equ 0xA4
times 510-($-$$) db 0
db 0x55, 0xAA
This is an MBR program, and when I compile it through nasm, I get this error:
mbr.asm:47: error: invalid effective address
Line 47 is mov byte ah, [MESSAGE + cx]
.
How can I send a string to the graphics card's memory through a loop?