How to print pseudographic symbols?

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
osdever
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am
Contact:

How to print pseudographic symbols?

Post by osdever »

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.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: How to print pseudographic symbols?

Post by Combuster »

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 ]
User avatar
osdever
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am
Contact:

Re: How to print pseudographic symbols?

Post by osdever »

Combuster wrote:
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.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: How to print pseudographic symbols?

Post by Combuster »

Well, that's what you get for blindly trusting tutorials. It was pretty easy to find though, here's a hint:

Code: Select all

-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 ]
mallard
Member
Member
Posts: 280
Joined: Tue May 13, 2014 3:02 am
Location: Private, UK

Re: How to print pseudographic symbols?

Post by mallard »

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
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: How to print pseudographic symbols?

Post by Roman »

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
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: How to print pseudographic symbols?

Post by Roman »

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
mallard
Member
Member
Posts: 280
Joined: Tue May 13, 2014 3:02 am
Location: Private, UK

Re: How to print pseudographic symbols?

Post by mallard »

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
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: How to print pseudographic symbols?

Post by Roman »

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
User avatar
osdever
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am
Contact:

Re: How to print pseudographic symbols?

Post by osdever »

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: Select all

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.
User avatar
osdever
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am
Contact:

Re: How to print pseudographic symbols?

Post by osdever »

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

Re: How to print pseudographic symbols?

Post by Octocontrabass »

catnikita255 wrote:It displays me a wrong characters!
Looks right to me.

Code: Select all

0C ♀
3B ;
3C <
4B K
4C L
9D ¥
AD ¡
FB √
What kind of ASCII chart are you using, anyway?
User avatar
osdever
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am
Contact:

Re: How to print pseudographic symbols?

Post by osdever »

Octocontrabass wrote:
catnikita255 wrote:It displays me a wrong characters!
Looks right to me.

Code: Select all

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.
User avatar
osdever
Member
Member
Posts: 492
Joined: Fri Apr 03, 2015 9:41 am
Contact:

Re: How to print pseudographic symbols?

Post by osdever »

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.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: How to print pseudographic symbols?

Post by Combuster »

Combuster wrote:Well, that's what you get for blindly trusting tutorials. It was pretty easy to find though, here's a hint:

Code: Select all

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