flat assembler
Message board for the users of flat assembler.

Index > Main > Unicode support

Author
Thread Post new topic Reply to topic
Kevin_Zheng



Joined: 04 Jul 2003
Posts: 125
Location: China
Kevin_Zheng
Hi,Privalov:
Please see the belowing link:
http://board.flatassembler.net/topic.php?t=307

Can the FASM support completely unicode set ? Because I want write purely unicode program on the win2003, and I can't use the local language set on the resource . Of course, I can use the .res file to fix the issue, But I think that fasm should support unicode encode completely on the complier itself.

Do you think it?
Thank you.
Post 30 Jan 2004, 04:21
View user's profile Send private message MSN Messenger Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
Privalov wrote:
The assembly sources are in ASCII format.


Now "du" directive defines UNICODE string with high-order byte set to 0.
What about adding directive "language <bytevalue>" that to change the default high-order byte that will be used with "du"?

Regards
Post 30 Jan 2004, 11:24
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
This one you can make easily with macros.
Also "du" is not really an unicode data definition directive, it's just a variant of "dw".
Post 30 Jan 2004, 12:11
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
Well, my previous insertion was not very competent. I read some articles on www.unicode.org and the things seems to be more complex. But in generally it is not a bad idea to make FASM to have some methods of coding UNICODE strings.
Post 30 Jan 2004, 13:02
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Kevin_Zheng



Joined: 04 Jul 2003
Posts: 125
Location: China
Kevin_Zheng
Hi, Privalov:
I have found a temp solution for unicode suppoted feature. Please see the belowing "du" macro define:
Code:
macro du      [args]
{
  common local ..count,..current,..byte,..wide,..match,..step,..eof
  ..match = 0
  ..step  = 0
  virtual at 0 
    db args 
    ..count = $ 
  end virtual 
   ..current = 0 
  repeat ..count 
    if ..current<..count 
     virtual at 0 
     db args
     load ..byte byte from ..current 
     if ..byte=0FEh 
      ..eof      = 1
      ..match    = 1
      ..step     = 1
      ..current = ..current+1 
      load ..byte byte from ..current
      ..wide    = ..byte
      ..current = ..current+1 
      load ..byte byte from ..current 
      ..wide = ..wide + (..byte SHL 8) 
     else if ..byte=0FFh 
      ..eof   = 0
      ..match    = 0
      ..step     = 0
     else if ..step=1
      ..wide    = ..byte
      ..current = ..current+1 
      load ..byte byte from ..current 
      ..wide = ..wide + (..byte SHL 8)
     else 
      ..eof     = 1
      ..wide = ..byte 
     end if 
     ..current = ..current+1 
     end virtual 
     if  ..eof=1
             dw ..wide 
     end if
    end if 
  end repeat
  if ..match<>0
      display "Error! The unicode string [",args,"] can't match!",0DH,0AH
  end if 
}
U_      FIX     0FEH,
_U      FIX     ,0FFH
...
du "&File",U_<49H,6CH>_U    

Through the "du" macro, I have modifed the fasmw.asm and get a unicode string menu. Please see the belowing screen snot:
[img]unicode_menu.jpg[/img]

And others, I think that the "du" instruction syntax maybe do the belowing extended: (Supported "U(" and ")" to mark the unicode string)
ASCII string:
du 'a' =====> 30 00
Unicode String:
du U(34H,56H) ===>34 56
Do you think it ?
Thank you.
Post 30 Jan 2004, 13:20
View user's profile Send private message MSN Messenger Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
Well, let try to explain, what I undertand, reading documents on unicode.org

Just a little example:

Let say, I am using cyrillic. I can code the ASCII files using Win-1251 code table, where main cyrillic alphabet is between $c0 and $ff
In the UNICODE table the same letters in the same order are in interval:
$410 to $44f
This mean that if I (using ASCII editor with Win-1251 font) write in my source file: (select Win-1251 encoding to see proper characters)
Code:
    language langCyrillic   ; langCyrillic = $350
uni:
    du    'ÀÁÂÃÄ', 0
ascii:
    db    'ÀÁÂÃÄ', 0
    


FASM should ADD $350 to each ascii code in the quotes, converted to word and the binary file should be:

Code:
; Hexadecimal codes
uni:
    10 04 
    11 04 
    12 04
    13 04
    14 04
ascii:
    c0 
    c1
    c2
    c3
    c4
    


langAscii = $0000
lang<somelang> = i don't know Very Happy

The good thing is that the order of characters in Win1251 and UNICODE is the same, but it is not so in some other languages AFAIK.

Regards
Post 30 Jan 2004, 13:21
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Kevin_Zheng



Joined: 04 Jul 2003
Posts: 125
Location: China
Kevin_Zheng
Dear All:
It present a very simple method for it. The du instruction have been supported word fefine:
for example:
;The _chs_string that means chinese unicode menu
_chs_string equ 4E2DH,6587H,083DCH,5355H
menu main_menu
menuitem <'&File',_chs_string>,0,MFR_POPUP

Code:
du  1234H,34H  ===>34 12 34 00    
Post 30 Jan 2004, 13:32
View user's profile Send private message MSN Messenger Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
JohnFound: To generate the 30 00 34 56 data just can just do
Code:
du 'a',5634h    


And the conversion fo strings from ASCII to Unicode for particular encodings was already discussed here. For example here you've got the "du" macros for Russian and Polish language: http://board.flatassembler.net/topic.php?t=248
Post 30 Jan 2004, 13:36
View user's profile Send private message Visit poster's website Reply with quote
Kevin_Zheng



Joined: 04 Jul 2003
Posts: 125
Location: China
Kevin_Zheng
Dear All:
The attached package is a unicode menu demo program. It is a Multilanguage Application. When the program start, it will change the menu resource to fit your OS language Language Identifiers . Of course, You can through the "Language" menuitem to force change the menu resource.

It supported English and Simple-Chinese language menu resources, now. You can change the unicode font encode file ("res\string.fnt") to fit your OS Language.

Thank you. Very Happy


Description:
Download
Filename: menu.zip
Filesize: 39.23 KB
Downloaded: 493 Time(s)

Post 31 Jan 2004, 11:39
View user's profile Send private message MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.