Strange letter displays before string [ACTUALLY SOLVED]

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.
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

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

Post by iansjack »

If you think you have fixed the bug, try doing a WriteChar() to position 0, 0.
User avatar
DixiumOS
Member
Member
Posts: 84
Joined: Tue Jan 10, 2017 3:19 pm
Libera.chat IRC: NunoLava1998

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

Post 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);
(not so frequently updated) Code is at:

https://github.com/NunoLava1998/DixiumOS-1
Octocontrabass
Member
Member
Posts: 5587
Joined: Mon Mar 25, 2013 7:01 pm

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

Post by Octocontrabass »

Did you read iansjack's post? He said writechar(), not writestring().
User avatar
DixiumOS
Member
Member
Posts: 84
Joined: Tue Jan 10, 2017 3:19 pm
Libera.chat IRC: NunoLava1998

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

Post 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
(not so frequently updated) Code is at:

https://github.com/NunoLava1998/DixiumOS-1
User avatar
matt11235
Member
Member
Posts: 286
Joined: Tue Aug 02, 2016 1:52 pm
Location: East Riding of Yorkshire, UK

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

Post 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?
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum
User avatar
DixiumOS
Member
Member
Posts: 84
Joined: Tue Jan 10, 2017 3:19 pm
Libera.chat IRC: NunoLava1998

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

Post 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.
Last edited by DixiumOS on Wed Jan 11, 2017 4:28 am, edited 2 times in total.
(not so frequently updated) Code is at:

https://github.com/NunoLava1998/DixiumOS-1
MDenham
Member
Member
Posts: 62
Joined: Sat Nov 10, 2012 1:16 pm

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

Post 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)).
Octocontrabass
Member
Member
Posts: 5587
Joined: Mon Mar 25, 2013 7:01 pm

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

Post 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.
User avatar
DixiumOS
Member
Member
Posts: 84
Joined: Tue Jan 10, 2017 3:19 pm
Libera.chat IRC: NunoLava1998

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

Post 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.
(not so frequently updated) Code is at:

https://github.com/NunoLava1998/DixiumOS-1
User avatar
matt11235
Member
Member
Posts: 286
Joined: Tue Aug 02, 2016 1:52 pm
Location: East Riding of Yorkshire, UK

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

Post 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:
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum
User avatar
DixiumOS
Member
Member
Posts: 84
Joined: Tue Jan 10, 2017 3:19 pm
Libera.chat IRC: NunoLava1998

Re: Strange letter displays before string [ACTUALLY SOLVED]

Post by DixiumOS »

And now i just tested. It should say exactly what my real machine just put there:
http://i.imgur.com/wcPmWCf.jpg
Last edited by thepowersgang on Thu Jan 12, 2017 1:04 am, edited 1 time in total.
Reason: removed obnoxiously large image
(not so frequently updated) Code is at:

https://github.com/NunoLava1998/DixiumOS-1
andrewthompson555
Member
Member
Posts: 27
Joined: Thu Oct 13, 2016 2:07 pm

Re: Strange letter displays before string [ACTUALLY SOLVED]

Post 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.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Strange letter displays before string [ACTUALLY SOLVED]

Post 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. :)
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: Strange letter displays before string [ACTUALLY SOLVED]

Post 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!
Learn to read.
andrewthompson555
Member
Member
Posts: 27
Joined: Thu Oct 13, 2016 2:07 pm

Re: Strange letter displays before string [ACTUALLY SOLVED]

Post 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:
Post Reply