Re: Strange letter displays before string (Closed, fixed)
Posted: Wed Jan 11, 2017 2:55 am
If you think you have fixed the bug, try doing a WriteChar() to position 0, 0.
The Place to Start for Operating System Developers
http://f.osdev.org/
Woooorks. I already said i changed the math for it to become correct.iansjack wrote:If you think you have fixed the bug, try doing a WriteChar() to position 0, 0.
Code: Select all
terminal_clrscr();
terminal_writestring("[", WHITE, BLACK, 0, 0);
terminal_writestring("Dixium OS", WHITE, LIGHT_BLUE, 1, 0);
terminal_writestring("]", WHITE, BLACK, 10, 0);
terminal_writestring(" Write string succesful.", WHITE, BLACK, 11, 0);
Oh, okay, i'll try that.Octocontrabass wrote:Did you read iansjack's post? He said writechar(), not writestring().
DixiumOS wrote:That isn't a bugOctocontrabass wrote:This bug.
Read through it again, or check the values with a debugger to see the value that you're actually passinig to terminal_writechar.DixiumOS wrote:EDIT: It doesn't work.
" 10007d: 66 89 94 1b fe 7f 0b mov %dx,0xb7ffe(%ebx,%ebx,1)"zenzizenzicube wrote:DixiumOS wrote:That isn't a bugOctocontrabass wrote:This bug.Read through it again, or check the values with a debugger to see the value that you're actually passinig to terminal_writechar.DixiumOS wrote:EDIT: It doesn't work.
Anyway, didn't we go through all of this already in your old project?
Code: Select all
void terminal_writechar(unsigned char c, unsigned char fc, unsigned char bc, int x, int y)
{
if (x == 80) {
x = 0;
y++;
}
if (x == 0) {
x++;
}
uint16_t attribute = (bc << 4) | (fc & 0x0F);
volatile uint16_t * loc;
loc = (volatile uint16_t *)0xB8000 + (y * 80 + x - 1);
*loc = c | (attribute << 8);
}
Pointer math. If the type you're using for the pointer is short*, "-1" means it subtracts sizeof(short) from the pointer value (and likewise with any other pointer - for t*, -1 subtracts sizeof(t)).DixiumOS wrote: The hell are you doing with 0xB7FFE, GCC?
B8000 - 1 does not equal B7FFE.
No, you just added more bugs.DixiumOS wrote:EDIT: Finally got it working. Ya' little..
1,1 displays in 0,1, but 0,0 does display in 0,0. I just...Octocontrabass wrote:No, you just added more bugs.DixiumOS wrote:EDIT: Finally got it working. Ya' little..
Use terminal_writechar() to put a character at 0,0 and at 1,1. They won't show up at the correct locations.
Code: Select all
terminal_clrscr();
terminal_writechar_freestanding('a', WHITE, BLUE, 0, 0);
terminal_writechar_freestanding('b', BLUE, WHITE, 1, 1);
terminal_writestring_freestanding("I like potato!", BLUE, WHITE, 12, 12);
DixiumOS wrote:EDIT: After doing some testing, it seems the tty.c forgot something that incremented the value yet again by one. Now i need to remove 2 for it to work.
Code: Select all
for (size_t i = 0; i < len; i++) {
x++;
terminal_writechar(data[i], fc, bc, x, y);
}