Page 2 of 3

Re: Strange letter displays before string (Closed, fixed)

Posted: Wed Jan 11, 2017 2:55 am
by iansjack
If you think you have fixed the bug, try doing a WriteChar() to position 0, 0.

Re: Strange letter displays before string (Closed, fixed)

Posted: Wed Jan 11, 2017 2:59 am
by DixiumOS
iansjack wrote:If you think you have fixed the bug, try doing a WriteChar() to position 0, 0.
Woooorks. I already said i changed the math for it to become correct.


Image

Code used:

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);

Re: Strange letter displays before string (Closed, fixed)

Posted: Wed Jan 11, 2017 3:07 am
by Octocontrabass
Did you read iansjack's post? He said writechar(), not writestring().

Re: Strange letter displays before string (Closed, fixed)

Posted: Wed Jan 11, 2017 3:15 am
by DixiumOS
Octocontrabass wrote:Did you read iansjack's post? He said writechar(), not writestring().
Oh, okay, i'll try that.

EDIT: It doesn't work.
Image

Re: Strange letter displays before string (Closed, fixed)

Posted: Wed Jan 11, 2017 3:43 am
by matt11235
DixiumOS wrote:
Octocontrabass wrote:This bug.
That isn't a bug
DixiumOS wrote:EDIT: It doesn't work.
Read through it again, or check the values with a debugger to see the value that you're actually passinig to terminal_writechar.

Anyway, didn't we go through all of this already in your old project?

Re: Strange letter displays before string (Closed, fixed)

Posted: Wed Jan 11, 2017 4:11 am
by DixiumOS
zenzizenzicube wrote:
DixiumOS wrote:
Octocontrabass wrote:This bug.
That isn't a bug
DixiumOS wrote:EDIT: It doesn't work.
Read through it again, or check the values with a debugger to see the value that you're actually passinig to terminal_writechar.

Anyway, didn't we go through all of this already in your old project?
" 10007d: 66 89 94 1b fe 7f 0b mov %dx,0xb7ffe(%ebx,%ebx,1)"

The hell are you doing with 0xB7FFE, GCC?
B8000 - 1 does not equal B7FFE.
Let's see if this changes if i change B8000 to B8001.

Nahh...



Image

EDIT: Finally got it working. Ya' little..

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);
}
Image

Oh, wait, now terminal_writestring doesn't work. #-o

EDIT: It does, just that i tried writing to line 25. It's 24, not 25.

Re: Strange letter displays before string (Closed, fixed)

Posted: Wed Jan 11, 2017 4:20 am
by MDenham
DixiumOS wrote: The hell are you doing with 0xB7FFE, GCC?
B8000 - 1 does not equal B7FFE.
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)).

Re: Strange letter displays before string (Closed, fixed)

Posted: Wed Jan 11, 2017 4:34 am
by Octocontrabass
DixiumOS wrote:EDIT: Finally got it working. Ya' little..
No, you just added more bugs.

Use terminal_writechar() to put a character at 0,0 and at 1,1. They won't show up at the correct locations.

Re: Strange letter displays before string (Closed, fixed)

Posted: Wed Jan 11, 2017 4:36 am
by DixiumOS
Octocontrabass wrote:
DixiumOS wrote:EDIT: Finally got it working. Ya' little..
No, you just added more bugs.

Use terminal_writechar() to put a character at 0,0 and at 1,1. They won't show up at the correct locations.
1,1 displays in 0,1, but 0,0 does display in 0,0. I just...

Format is x,y by the way.

EDIT: Just add a x++ and everything will be fine
Image

Code used:

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);
EDIT: Except terminal_writestring(_freestanding) loves to put it one line down. EDIT TO THAT: Why did i forget again computers count from 0? It should be line 3 if lines were 1-25.

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.

Re: Strange letter displays before string (Closed, fixed)

Posted: Wed Jan 11, 2017 5:21 am
by matt11235
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);
}
Or you could just increment x after calling terminal_writechar, instead of before :roll:

Re: Strange letter displays before string [ACTUALLY SOLVED]

Posted: Wed Jan 11, 2017 5:41 am
by DixiumOS
And now i just tested. It should say exactly what my real machine just put there:
http://i.imgur.com/wcPmWCf.jpg

Re: Strange letter displays before string [ACTUALLY SOLVED]

Posted: Wed Jan 11, 2017 6:29 am
by andrewthompson555
Now I know who NunoLava1998 is... You're him! DixiumOS, you're NunoLava1998. Your GitHub page has NunoLava1998. Everyone calls me it all the time.

Re: Strange letter displays before string [ACTUALLY SOLVED]

Posted: Wed Jan 11, 2017 6:36 am
by Love4Boobies
Yeah, we know who he is. But somehow you managed to occupy the same space in our minds. That's not his fault. :)

Re: Strange letter displays before string [ACTUALLY SOLVED]

Posted: Wed Jan 11, 2017 7:52 am
by dozniak
Hello again, NunoLava1998. I need to update my ignore list again. Please refrain from updating your nickname in the future. Thank you very much!

Re: Strange letter displays before string [ACTUALLY SOLVED]

Posted: Wed Jan 11, 2017 10:31 am
by andrewthompson555
Forums are nuts these days... Are you this guy? Are you that guy?! Everything you've done is all wrong. Ugh... Ugh... Ugh! :evil: