Keyboard help

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.
ribas

Keyboard help

Post by ribas »

i've tried to program my keyboard driver ... it works fine in US layout i presume, but i'm from Portugal so i modified the code i?ve found to be able to work with my keyboard .. all ok except for symbols like ( ? , ?, ?, ? ,?) and accents ?`? ... i send the right code ( i think ..) but for these i only get a dummy space with white background. if anyone knows hot to fix this, please help ....
The keyboard driver works fine without these key but i would like to make it work from the beginning (maybe a bios problem .. i really don't know). Thanks.

Ribas
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:Keyboard help

Post by bubach »

You cant just type in those characters in your char-table from windows.. Add these chars from a DOS editor or write the ASCII values by hand, like "a", 148, "bcde" etc....
All ASCII supported values can be found at: http://www.lookuptables.com/
If you need support for other characters you would have to implement UTF-8 or similar.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Keyboard help

Post by Candy »

As bubach said, those characters don't exist. They're a figment of Microsoft's imagination.

Make a new character set other than ASCII (which you're now using and in which they don't exist) and use that for printing. You might need graphical modes.
ribas

Re:Keyboard help

Post by ribas »

ok. i'm going to keep it this way just for testing .. anyway i want to go to svga mode and use bitmap fonts (i think this is possible), anyone knows where to find some info on bmp fonts, and how to switch to vga mode im pm mode??

thanks guys
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:Keyboard help

Post by bubach »

But most of them does exist.. I think that even ? is implemented in newer BIOS's (by the loss of some other not as used char.)
For example:

Code: Select all

`  =  ASCII value 96 dec.
?  =  ASCII value 144 dec.
?  =  ASCII value 175 dec.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:Keyboard help

Post by bubach »

VGA modes can be switched to by registers.
SVGA modes are interfaced though the VESA standard and can be set by BIOS interrupt 0x10.
For that you will need code that can jump between 16- and 32-bit mode, or a VM86 monitor.

/ Christoffer
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
ribas

Re:Keyboard help

Post by ribas »

thanks bubach .. now it prints the chars but i think i've to change the text mode cause all these chars change my text colour and background attributes ... i think i'm messing with some video memory.
mystran

Re:Keyboard help

Post by mystran »

bubach wrote: But most of them does exist.. I think that even ? is implemented in newer BIOS's (by the loss of some other not as used char.)
For example:

Code: Select all

`  =  ASCII value 96 dec.
?  =  ASCII value 144 dec.
?  =  ASCII value 175 dec.
ASCII is 7-bit and anything beyond 128 dec is not ASCII. Most definitely it also won't be the same values between computers in different countries (most of western europe+USA being main exception with Latin1), unless one agrees to use Unicode instead.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Keyboard help

Post by Brendan »

Hi,
mystran wrote: ASCII is 7-bit and anything beyond 128 dec is not ASCII. Most definitely it also won't be the same values between computers in different countries (most of western europe+USA being main exception with Latin1), unless one agrees to use Unicode instead.
Can someone confirm this?

I assumed that (even though ASCII is 7 bit) the standard IBM screen display codes are 8 bit and are used as the default for all text video modes and BIOS character fonts. I also thought DOS used to be able to change the default character set to support different languages (for e.g. "MODE device CP SELECT=yyy").

I was hoping to convert Unicode into screen display codes for any character that has a "close enough" equivelent. If screen display codes aren't standard then I'll need to create my own "standard" character data :(.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Keyboard help

Post by Candy »

Brendan wrote:
mystran wrote: ASCII is 7-bit and anything beyond 128 dec is not ASCII. Most definitely it also won't be the same values between computers in different countries (most of western europe+USA being main exception with Latin1), unless one agrees to use Unicode instead.
Can someone confirm this?
Confirmed hereby. However, the limit is strictly speaking 127, whereas char 128 is not existant.
I assumed that (even though ASCII is 7 bit) the standard IBM screen display codes are 8 bit and are used as the default for all text video modes and BIOS character fonts. I also thought DOS used to be able to change the default character set to support different languages (for e.g. "MODE device CP SELECT=yyy").
They load a new "font" for the upper 128 blocks to do so. Mode does not function without the codepages on disk somewhere.
I was hoping to convert Unicode into screen display codes for any character that has a "close enough" equivelent. If screen display codes aren't standard then I'll need to create my own "standard" character data :(.
No. You cannot squeeze more than a million characters in 256 (or 512) character spaces. You very much need graphical displays.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Keyboard help

Post by Brendan »

Hi,
Candy wrote:Confirmed hereby. However, the limit is strictly speaking 127, whereas char 128 is not existant.
My original question was poorly worded. Specifically, if I had this code in a boot sector:

Code: Select all

   mov cx,128
   mov al,128
   mov ah,0x0F
   mov es,0xB800
   mov di,0
   cld
.l1:
   stosw
   inc al
   loop .l1
Would it display the same results on every computer (assuming the BIOS starts the boot sector in text mode)?

I'm not talking ASCII here, but "standard IBM screen display codes"...
Candy wrote:
I was hoping to convert Unicode into screen display codes for any character that has a "close enough" equivelent. If screen display codes aren't standard then I'll need to create my own "standard" character data :(.
No. You cannot squeeze more than a million characters in 256 (or 512) character spaces. You very much need graphical displays.
Sure you can - you just end up with a lot of '?' characters :).

For example, the Unicode strings "f?vrier", "M?rz" and "vas?rnap" (French "February", German "March" and Hungarian "Sunday" respectively) can hopefully all be represented with standard IBM screen display codes (or text video modes), even though it can't be done with strict ASCII.

Something like "Կիրակի" (Armenian "Sunday") or "日曜日" (Japanese "Sunday") would end up being "??????" or "???" because these characters can't be displayed.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Keyboard help

Post by Candy »

Why do I have the feeling that ???? ?? ???? ? ?? ?????? ???? ?????? is not going to help japanese people use your OS?
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Keyboard help

Post by Brendan »

Hi,
Candy wrote: Why do I have the feeling that ???? ?? ???? ? ?? ?????? ???? ?????? is not going to help japanese people use your OS?
You're right - there's many languages that can't be displayed in text mode regardless of what I do. Then there's many languages that will benefit from this in varying degrees (French, German, Hungarian, Greek, etc).

There's also cases where languages are mixed - "The vistor said '????? ???? ????' before riding his horse into the night.".

Anyway, it's better than displaying '?' for anything that's not strict ASCII...


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:Keyboard help

Post by bubach »

I'm not talking ASCII here, but "standard IBM screen display codes"...
Hmm.. From 127-255 is "Extended ASCII" which is the same on all computers I ever seen at bootup. It can be changed, but that is mostly done by the OS after bootup by changing the font.

- http://www.webopedia.com/TERM/E/extended_ASCII.html
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Keyboard help

Post by Brendan »

Hi,
bubach wrote:
I'm not talking ASCII here, but "standard IBM screen display codes"...
Hmm.. From 127-255 is "Extended ASCII" which is the same on all computers I ever seen at bootup. It can be changed, but that is mostly done by the OS after bootup by changing the font.

- http://www.webopedia.com/TERM/E/extended_ASCII.html
That's them! :)

There's actually 31 more of them (from 0x01 to 0x1F) - for e.g. "mov [0x000B8000],0x0A" will give you a reversed circle, where in ASCII it's a control code (linefeed).

I've never seen a computer that doesn't have these characters either (not that I'd expect to find one in South Australia). I guess/hope that no-one has created any variations on this..


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply