Bona Fide OS Development http://forums.osdever.net/ |
|
Text output does not work http://forums.osdever.net/viewtopic.php?f=6&t=346 |
Page 1 of 1 |
Author: | MTK358 [ Mon Apr 26, 2010 12:39 pm ] |
Post subject: | Text output does not work |
Somehow I can't get text output to work right. I made functions that print a character set the color, set the position, but I just can't get printing strings and scrolling to work. The OS is booted using GRUB, so it's in 32-bit Protected Mode. |
Author: | smeezekitty [ Mon Apr 26, 2010 5:07 pm ] |
Post subject: | Re: Text output does not work |
Show code. You are writing to B800:0000, right? |
Author: | smeezekitty [ Mon Apr 26, 2010 9:45 pm ] |
Post subject: | Re: Text output does not work |
Code: void put_character(char c) { if(c == '\n') { curx = 0; cury++; if(cury+1 == LINES || cury == LINES){scroll();} } else { videoram_get(curx, cury) = c | (curc << 8); if(++curx == COLS) { curx = 0; if(cury+1 == LINES || cury == LINES) scroll(); else cury++; } } } Try that. |
Author: | MTK358 [ Tue Apr 27, 2010 5:26 am ] |
Post subject: | Re: Text output does not work |
smeezekitty wrote: Code: void put_character(char c) { if(c == '\n') { curx = 0; cury++; if(cury+1 == LINES || cury == LINES){scroll();} } else { videoram_get(curx, cury) = c | (curc << 8); if(++curx == COLS) { curx = 0; if(cury+1 == LINES || cury == LINES) scroll(); else cury++; } } } Try that. What's the purpose of checking if cury AND cury+1 equals LINES? Why not >=, which will be simpler and more efficient? |
Author: | Kieran [ Tue Apr 27, 2010 5:41 am ] |
Post subject: | Re: Text output does not work |
Id go with >= too |
Author: | MTK358 [ Tue Apr 27, 2010 5:52 am ] |
Post subject: | Re: Text output does not work |
Code: void scroll() { int x, y; for(y=1; y<LINES; y++) { for(x=0; x<COLS; x++) { videoram_get(x, y-1) = videoram_get(x, y); } } cury--; } void put_character(char c) { if (c == '\n') { curx = 0; if (++cury == LINES) scroll(); } else { videoram_get(curx, cury) = c | (curc << 8); if (++curx == COLS) { curx = 0; if (++cury == LINES) scroll(); } } } Newer version, but still the same result. |
Author: | MTK358 [ Tue Apr 27, 2010 7:23 pm ] |
Post subject: | Re: Text output does not work |
Anyone? I would like to search it, but I just don't know what. I tried things like "vga characher output" and stuff but 99.9% of the results are completely irrelavent. |
Author: | Sharpner [ Thu Apr 29, 2010 3:38 am ] |
Post subject: | Re: Text output does not work |
Code: int8u attrib = 0x0F; void scroll(){ int32u blank = ' ' | (attrib << 8); if(csr_y >= 25){ int16u i; for (i = 0; i < 24*80; i++){ vga_ptr[i] = vga_ptr[i+80]; } for (i = 24*80; i < 25*80; i++){ vga_ptr[i] = blank; } csr_y = 24; } move_csr(); } I did it like that, maybe it helps you. bye Sharpner |
Page 1 of 1 | All times are UTC - 6 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |