Hi, i've got this function that displays text that can effectively be called by anything else in my kernel.
So far this text display function is almost nothing, very simple. Printed below:
standard_display:
mov edi, 0xB8000
.standard_display_loop:
lodsb
stosw
or al, al
jnz .standard_display_loop
retn
This is called with esi pointed to a location of a text string in memory and ah contains the vga colour attribute, 0x0F when im using it in this particular function.
My problem is that i load esi with a variable containing a text string, but a further 2 variables are stored after it get displayed too, even though i never call the display function with their location in esi. I do wish to display them but the code to do so is commented out so it doesn't, but the text strings in the next 2 variables still get displayed. Why?. And how can i fix it.
Bascially this is how i call the display function:
mov ESI, kernel_name
mov AH, 0x0F
call standard_display
...
kernel_name db "kernel name"
kernel_version db "kernel version" ; These two don't get called for
kernel_auther db "kernel auther" ; but they still show on
; the screen after the first variable
Also the first character in the first variables doesn't get shown.
Is there something wrong with how im handling the strings in the display function?
Thanks in advance.
Regards, Brill.
Displaying text
RE:Displaying text
Hi,i made a quick workaround.
kernel_name db 'kernel name', 0x00
That cos of the or al, al bit to check whether theres anymore characters forces the printing function to see no more characters and exit. But is there another 'cleaner' way of doing it?
kernel_name db 'kernel name', 0x00
That cos of the or al, al bit to check whether theres anymore characters forces the printing function to see no more characters and exit. But is there another 'cleaner' way of doing it?
RE:Displaying text
The only other way I've seen it done is to have the first character of the string represent the length of the string. I wouldn't recommend this, though.
This limits strings to 255 characters, forces the programmer to know the length of manually created strings, and wont work with C/C++ code.
asciz (zero delimited strings) is pretty standard, I'd stick with it.
Jeff
This limits strings to 255 characters, forces the programmer to know the length of manually created strings, and wont work with C/C++ code.
asciz (zero delimited strings) is pretty standard, I'd stick with it.
Jeff
RE:Displaying text
Thanks, i've also changed my display function around because it wasn't working right. Now i need a new line feature. But before that, my kernel loads from grub. Grub leaves a bugger of a line thats not an underscore that blinks and stays there even when i run some code that wides the screen of text. What is it if it's not any kind of character? And how do i remove it?
Thanks.
Regards, Brill.
Thanks.
Regards, Brill.