Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
mov eax,1
mov esi,Welcome
int 0x80
...
Welcome db "Welcome to Mattise (from the Shell)!",13,10,0
This works properly, and I can see the text printed. There's just one thing: the first character of the line does not print. If I add a space before it, the string prints properly. You can see this weird problem at this location
Thanks in advance!
Edit: Actually, it's a problem with my kprintf() function... any ideas?
Well does the kprintf work just fine from within the kernel. (Had to ask) Also the code for the call to kprintf would be nice to see. You might want to use bochs to see if the pointers are pointing to the same location in memory or if someone they point to a location 1 byte apart. (Maybe the interrupt handler accidentally adds 1 to the argument).
I don't think your printing function works with your kernel accurately either. I downloaded your OS' image file and run it in VirtualPC. After logging in with root, I typed HELP and then LP. See what happened:
All the first characters of the lines printed in the red oval's area are not printed. I am guessing you are not handing newlines correctly or maybe you are printing those characters with a black foreground color.
Attachments
Error.PNG (8.36 KiB) Viewed 980 times
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
XCHG wrote:I don't think your printing function works with your kernel accurately either. I downloaded your OS' image file and run it in VirtualPC. After logging in with root, I typed HELP and then LP. See what happened:
All the first characters of the lines printed in the red oval's area are not printed. I am guessing you are not handing newlines correctly or maybe you are printing those characters with a black foreground color.
Actually that's a really old build, but the same printf function... I hadn't seen that for a while
I doubt it's handling newlines, because everywhere else they work. It's just in the context of a kprintf( "%s", str ); that they don't work...
I have since fixed the problem by using the same function the kprintf helper function calls (cons.Output( str )) and it works properly so far. I would still like to fix the problem, though.
I think that it may be an issue in the code with having a string first up and not reading the first character properly. I really have no idea though
case SYSCALL_PRINTSTR:
52
53 // print the string in ESI
54 {
55 char* esi = (char*) r->esi;
56 cons.Output( esi );
57 }
58 break;
and I didn't see anything wrong with cons.Output( ). I am all out of ideas. The only thing I can think of is to painfully step through your kernel in bochs and look for where the pointer gets screwed up or it forgets to print the first character.
pcmattman wrote:I have since fixed the problem by using the same function the kprintf helper function calls (cons.Output( str )) and it works properly so far. I would still like to fix the problem, though.
It did call kprintf... I'll have to step through the code slowly and painfully... Thanks for your help though!