OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 18, 2024 1:16 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: Strange letter displays before string (Closed, fixed)
PostPosted: Wed Jan 11, 2017 2:55 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
If you think you have fixed the bug, try doing a WriteChar() to position 0, 0.


Top
 Profile  
 
 Post subject: Re: Strange letter displays before string (Closed, fixed)
PostPosted: Wed Jan 11, 2017 2:59 am 
Offline
Member
Member
User avatar

Joined: Tue Jan 10, 2017 3:19 pm
Posts: 84
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:
   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


Top
 Profile  
 
 Post subject: Re: Strange letter displays before string (Closed, fixed)
PostPosted: Wed Jan 11, 2017 3:07 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5137
Did you read iansjack's post? He said writechar(), not writestring().


Top
 Profile  
 
 Post subject: Re: Strange letter displays before string (Closed, fixed)
PostPosted: Wed Jan 11, 2017 3:15 am 
Offline
Member
Member
User avatar

Joined: Tue Jan 10, 2017 3:19 pm
Posts: 84
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


Top
 Profile  
 
 Post subject: Re: Strange letter displays before string (Closed, fixed)
PostPosted: Wed Jan 11, 2017 3:43 am 
Offline
Member
Member
User avatar

Joined: Tue Aug 02, 2016 1:52 pm
Posts: 286
Location: East Riding of Yorkshire, UK
DixiumOS wrote:
Octocontrabass wrote:
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


Top
 Profile  
 
 Post subject: Re: Strange letter displays before string (Closed, fixed)
PostPosted: Wed Jan 11, 2017 4:11 am 
Offline
Member
Member
User avatar

Joined: Tue Jan 10, 2017 3:19 pm
Posts: 84
zenzizenzicube wrote:
DixiumOS wrote:
Octocontrabass wrote:
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:
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.

_________________
(not so frequently updated) Code is at:

https://github.com/NunoLava1998/DixiumOS-1


Last edited by DixiumOS on Wed Jan 11, 2017 4:28 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Strange letter displays before string (Closed, fixed)
PostPosted: Wed Jan 11, 2017 4:20 am 
Offline
Member
Member

Joined: Sat Nov 10, 2012 1:16 pm
Posts: 62
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)).


Top
 Profile  
 
 Post subject: Re: Strange letter displays before string (Closed, fixed)
PostPosted: Wed Jan 11, 2017 4:34 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5137
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.


Top
 Profile  
 
 Post subject: Re: Strange letter displays before string (Closed, fixed)
PostPosted: Wed Jan 11, 2017 4:36 am 
Offline
Member
Member
User avatar

Joined: Tue Jan 10, 2017 3:19 pm
Posts: 84
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:
   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


Top
 Profile  
 
 Post subject: Re: Strange letter displays before string (Closed, fixed)
PostPosted: Wed Jan 11, 2017 5:21 am 
Offline
Member
Member
User avatar

Joined: Tue Aug 02, 2016 1:52 pm
Posts: 286
Location: East Riding of Yorkshire, UK
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:
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


Top
 Profile  
 
 Post subject: Re: Strange letter displays before string [ACTUALLY SOLVED]
PostPosted: Wed Jan 11, 2017 5:41 am 
Offline
Member
Member
User avatar

Joined: Tue Jan 10, 2017 3:19 pm
Posts: 84
And now i just tested. It should say exactly what my real machine just put there:
http://i.imgur.com/wcPmWCf.jpg

_________________
(not so frequently updated) Code is at:

https://github.com/NunoLava1998/DixiumOS-1


Last edited by thepowersgang on Thu Jan 12, 2017 1:04 am, edited 1 time in total.
removed obnoxiously large image


Top
 Profile  
 
 Post subject: Re: Strange letter displays before string [ACTUALLY SOLVED]
PostPosted: Wed Jan 11, 2017 6:29 am 
Offline
Member
Member

Joined: Thu Oct 13, 2016 2:07 pm
Posts: 27
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.


Top
 Profile  
 
 Post subject: Re: Strange letter displays before string [ACTUALLY SOLVED]
PostPosted: Wed Jan 11, 2017 6:36 am 
Offline
Member
Member
User avatar

Joined: Fri Mar 07, 2008 5:36 pm
Posts: 2111
Location: Bucharest, Romania
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 ]


Top
 Profile  
 
 Post subject: Re: Strange letter displays before string [ACTUALLY SOLVED]
PostPosted: Wed Jan 11, 2017 7:52 am 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 723
Location: Tallinn, Estonia
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.


Top
 Profile  
 
 Post subject: Re: Strange letter displays before string [ACTUALLY SOLVED]
PostPosted: Wed Jan 11, 2017 10:31 am 
Offline
Member
Member

Joined: Thu Oct 13, 2016 2:07 pm
Posts: 27
Forums are nuts these days... Are you this guy? Are you that guy?! Everything you've done is all wrong. Ugh... Ugh... Ugh! :evil:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], SemrushBot [Bot] and 235 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group