OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Nov 21, 2017 11:15 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: How to print pseudographic symbols?
PostPosted: Tue Apr 21, 2015 3:10 am 
Offline
Member
Member
User avatar

Joined: Fri Apr 03, 2015 9:41 am
Posts: 489
I tried to print it just like normal character, but it displays me a blank white character. Can i print them by printing their ASCII codes?

_________________
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing

OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Tue Apr 21, 2015 6:07 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9228
Location: An der schönen blauen Donau, watching muppets
Quote:
just like normal character
Define "normal". Which exact character are you trying to print using which method? There are many ways I know of, all of which considered normal depending on context, and several of them work fundamentally different when it comes to non-alphanumeric characters.

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Tue Apr 21, 2015 10:52 am 
Offline
Member
Member
User avatar

Joined: Fri Apr 03, 2015 9:41 am
Posts: 489
Combuster wrote:
Quote:
just like normal character
Define "normal". Which exact character are you trying to print using which method? There are many ways I know of, all of which considered normal depending on context, and several of them work fundamentally different when it comes to non-alphanumeric characters.

I'm using standard terminal_putchar function, normal chars is 'a', '!', '_', just anything except pseudographic. I'm trying to print a borders for my window, but it displays me blank chars.

_________________
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing

OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Tue Apr 21, 2015 11:02 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9228
Location: An der schönen blauen Donau, watching muppets
Well, that's what you get for blindly trusting tutorials. It was pretty easy to find though, here's a hint:
Code:
-uint16_t c16 = c;
+uint16_t c16 = (uint8_t)c;

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Tue Apr 21, 2015 2:08 pm 
Offline
Member
Member

Joined: Tue May 13, 2014 3:02 am
Posts: 213
Location: Private, UK
Are you typing/pasting the pseudographic characters directly into your source code, or are you using character codes? The former won't work since the character encodings (some form of Unicode, probably UTF-8) used by your editor/IDE won't match the character positions in the VGA ROM (the "IBM extended ASCII" set)...

_________________
Image


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Tue Apr 21, 2015 2:38 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 558
Location: Moscow, Russia
Are you sure, you use pseudographics from ASCII, not Unicode?

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Tue Apr 21, 2015 2:40 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 558
Location: Moscow, Russia
mallard wrote:
Are you typing/pasting the pseudographic characters directly into your source code, or are you using character codes? The former won't work since the character encodings (some form of Unicode, probably UTF-8) used by your editor/IDE won't match the character positions in the VGA ROM (the "IBM extended ASCII" set)...

Isn't UTF-8 compatible with ASCII (i.e. ASCII symbols in Unicode are just one-byte ASCII)?

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Tue Apr 21, 2015 2:48 pm 
Offline
Member
Member

Joined: Tue May 13, 2014 3:02 am
Posts: 213
Location: Private, UK
Roman wrote:
Isn't UTF-8 compatible with ASCII (i.e. ASCII symbols in Unicode are just one-byte ASCII)?


UTF-8 is compatible with standard 7-bit ASCII, but not the full 8-bit "IBM extended ASCII" set.

_________________
Image


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Wed Apr 22, 2015 12:30 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 558
Location: Moscow, Russia
mallard wrote:
Roman wrote:
Isn't UTF-8 compatible with ASCII (i.e. ASCII symbols in Unicode are just one-byte ASCII)?


UTF-8 is compatible with standard 7-bit ASCII, but not the full 8-bit "IBM extended ASCII" set.

Thanks! I didn't know about the extended set. I always thought ASCII only takes 7 bits.

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Wed Apr 22, 2015 1:49 am 
Offline
Member
Member
User avatar

Joined: Fri Apr 03, 2015 9:41 am
Posts: 489
I'm now tried to print char code, but now it displays me that: (' ' is the blank char, and * is some char that i can't print)
LLLLLLLLLLLLLLLLLLL
;window caption ;
<LLLLLLLLLLLLLLLLLK
;window text ;
; ;
; ;
; ;
; ;
*LLLLLLLLLLLLLLLLLL
It displays me a wrong characters! There's a code of drawObj function:
Code:
void drawObj(window target)
{
   terminal_setcolor(26);
   goToPos(target.x, target.y);
   terminal_putchar(0xAD);
   for(size_t topcount = 0; topcount < target.width - 2; topcount++)
   {
      terminal_putchar(0x4C);
   }
   terminal_putchar(0xFB);
   for(size_t middlecount = 1; middlecount < target.height - 2; middlecount++)
   {
      goToPos(target.x, target.y+middlecount);
      terminal_putchar(0x3B);
      for(size_t middlecount2 = 0; middlecount2 < target.width - 2; middlecount2++)
      {
         terminal_putchar(' ');
      }
      terminal_putchar(0x3B);
   }
   goToPos(target.x, target.y+target.height-2);
   terminal_putchar(0x0C);
   for(size_t bcount = 0; bcount < target.width - 2; bcount++)
   {
      terminal_putchar(0x4C);
   }
   terminal_putchar(0x9D);
   goToPos(target.x, target.y+2);
   terminal_putchar(0x3C);
   for(size_t captioncount = 0; captioncount < target.width - 2; captioncount++)
   {
      terminal_putchar(0x4C);
   }
   terminal_putchar(0x4B);
   terminal_setcolor(26);
   goToPos(target.x,target.y);
   size_t newy = 0;
   terminal_setcolor(26);
   goToPos(target.x+1, target.y+1);
   terminal_writestring(target.caption);
   terminal_setcolor(26);
   goToPos(target.x+1, target.y + 3);
   terminal_writestring(target.text);
}

_________________
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing

OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Wed Apr 22, 2015 1:50 am 
Offline
Member
Member
User avatar

Joined: Fri Apr 03, 2015 9:41 am
Posts: 489
Oops, phpBB deleted repeated spaces.

_________________
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing

OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Wed Apr 22, 2015 2:55 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 1179
catnikita255 wrote:
It displays me a wrong characters!
Looks right to me.
Code:
0C ♀
3B ;
3C <
4B K
4C L
9D ¥
AD ¡
FB √
What kind of ASCII chart are you using, anyway?


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Wed Apr 22, 2015 3:01 am 
Offline
Member
Member
User avatar

Joined: Fri Apr 03, 2015 9:41 am
Posts: 489
Octocontrabass wrote:
catnikita255 wrote:
It displays me a wrong characters!
Looks right to me.
Code:
0C ♀
3B ;
3C <
4B K
4C L
9D ¥
AD ¡
FB √
What kind of ASCII chart are you using, anyway?

I don't know, i'm found ASCII codes of pseudographic in Wikipedia, and it dispayed me a blank chars, then i'm typed their ASCII codes in reverse order, and it showed me that. I'll try to type them in normal order.

_________________
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing

OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Wed Apr 22, 2015 3:05 am 
Offline
Member
Member
User avatar

Joined: Fri Apr 03, 2015 9:41 am
Posts: 489
Now it displays me only blank chars instead of window borders.

_________________
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing

OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.


Top
 Profile  
 
 Post subject: Re: How to print pseudographic symbols?
PostPosted: Wed Apr 22, 2015 4:08 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9228
Location: An der schönen blauen Donau, watching muppets
Combuster wrote:
Well, that's what you get for blindly trusting tutorials. It was pretty easy to find though, here's a hint:
Code:
-uint16_t c16 = c;
+uint16_t c16 = (uint8_t)c;


Did you fix this yet?

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], TimothyWilliams and 8 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