Printing a string directly to the video memory
Posted: Sun Dec 18, 2016 10:31 am
Hi !
I made a function to print the SI register on the screen directly through the video memory.
It's weird but this function only write the first character ...
I call it with this code :
I run it in protected mode.
Thanks !
I made a function to print the SI register on the screen directly through the video memory.
It's weird but this function only write the first character ...
Code: Select all
writeCharacterToVideoMemoryFunc: ; al=character ah=attributes cx=offset(byte)
mov esi, 0xB8000
add si, cx
mov byte [esi], al
mov byte [esi+1], ah
ret
writeSIToVideoMemory: ; cx=offset
mov al, [si]
cmp al, 0
je end
mov ah, 00001111b
call writeCharacterToVideoMemoryFunc
inc si
add cx, 2d ; inc cx 2 times
jmp writeSIToVideoMemory
end:
ret
Code: Select all
mov si, MSG
mov cx, 40d
call writeSIToVideoMemory
jmp $
MSG: db "OK !", 0
Thanks !