flat assembler
Message board for the users of flat assembler.

Index > Windows > UNICODE

Author
Thread Post new topic Reply to topic
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 22 Jul 2006, 19:46
Along with ASM, i'm currently studying japanese. I saw some of the win32 examples, and i'm wondering if it's possible to make programs that use Kana or one of the other characters that have values higher than 255. It appears that every time i try to compile one i get an error. Is this a bug, or do i have to stick to values 0-255 for this assembler?
Post 22 Jul 2006, 19:46
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 22 Jul 2006, 21:27
Do you mean using Unicode in source code or in released program?
Post 22 Jul 2006, 21:27
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 23 Jul 2006, 01:47
Both would be nice. lol I don't use the GUI to compile. I use commandline, i attributed asm with the commandline so i only have to double click to compile. Anyway, both would be nice. lol
Post 23 Jul 2006, 01:47
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
wht36



Joined: 18 Sep 2005
Posts: 106
wht36 23 Jul 2006, 07:36
Put double quotes around your kana string. It should work fine then.
Post 23 Jul 2006, 07:36
View user's profile Send private message Reply with quote
donkey7



Joined: 31 Jan 2005
Posts: 127
Location: Poland, Malopolska
donkey7 23 Jul 2006, 09:32
use du instead of db for defining strings plus change include file from 'win32a.inc' to 'win32w.inc'. this would allow to use unicode in programs. afaik source code can be written only using 8- bit alphabet.
Post 23 Jul 2006, 09:32
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8349
Location: Kraków, Poland
Tomasz Grysztar 23 Jul 2006, 11:38
At least UTF-8 in source code is currently supported (but you need a capable editor for this, fasmw is 8-bit only, and Notepad adds some unwanted header to the beginning of text files saved in UTF-8 ), see the sample in attachment.

You can also, of course, write the character codes directly, like:
Code:
du 'Unicode character: ',20ACh,0    

If this didn't work for you with values higher than 255 then you've probably used "db" instead of "du". And, as already mentioned, to work on unicode strings instead of 8-bit ones you need to use 'win32w' includes instead of 'win32a'.
However all the texts in resources (dialogs, for example) are always in unicode anyway.


Description: Example of UTF-8 encoded source.
Download
Filename: HELLO.ASM
Filesize: 239 Bytes
Downloaded: 237 Time(s)

Post 23 Jul 2006, 11:38
View user's profile Send private message Visit poster's website Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 23 Jul 2006, 14:03
i do that and all the sudden ".code" in the hello example is considered wrong...

BUT, a little screwing around and it worked... for chars...

Quote:
F:\testinggrounds\ASM>hello.asm
flat assembler version 1.67.6 (164450 kilobytes memory)
F:\testinggrounds\ASM\HELLO.ASM [1]:

error: illegal instruction.
.

Oh well, at least i can use kana via the individual values used (i can't even do that in C++ with the current support i have for that) so i'm ratherp leased to use something other than a bunch of "boxes"/"Rs" in my programs. lol That is UTF-8bit though... hm... Like i said, i'm still pleased i can use some form of unicode at this point. Very Happy

Thank you all for your input, i'm going to work on fixing the compiler to see the  correctly. That's the beauty of assembly, you can do that. lol
Post 23 Jul 2006, 14:03
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8349
Location: Kraków, Poland
Tomasz Grysztar 23 Jul 2006, 14:16
Quote:
F:\testinggrounds\ASM>hello.asm
flat assembler version 1.67.6 (164450 kilobytes memory)
F:\testinggrounds\ASM\HELLO.ASM [1]:

error: illegal instruction.

You did edit it with Notepad, perhaps?
I suggest using some editor that is able to save UTF-8 without adding a BOM.
Post 23 Jul 2006, 14:16
View user's profile Send private message Visit poster's website Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 23 Jul 2006, 14:20
BOM? Do explain, cause i was planning on making a unicode text (and hex) editor in the long run based on notepad's output. (and i might be able to hexout the "bom".)
Post 23 Jul 2006, 14:20
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8349
Location: Kraków, Poland
Tomasz Grysztar 23 Jul 2006, 14:32
See for example http://www.w3.org/International/questions/qa-utf8-bom or google for more.

From a nice editors that can write UTF-8 files without adding a BOM I can recommend PSPad.
Post 23 Jul 2006, 14:32
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 23 Jul 2006, 14:38
BOM is a prefix code that tells editors what format the text is in (utf-8, one of the 16bit encodings, bla bla). Try saving some unicode text in notepad and have a look at it with a hex editor.

GoASM supports UNICODE natively, but IMHO the best thing to do when you need unicode is to store all your strings externally. Either as resources + loadstring, or some of your own. It's easier to manage that way, especially if you want to translate your app to other languages.
Post 23 Jul 2006, 14:38
View user's profile Send private message Visit poster's website Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 23 Jul 2006, 15:12
No more giving back...


Last edited by kohlrak on 07 Aug 2008, 15:09; edited 2 times in total
Post 23 Jul 2006, 15:12
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8349
Location: Kraków, Poland
Tomasz Grysztar 23 Jul 2006, 15:30
You need an "include" statement appropriate for your encoding. You didn't look at the example I attached above, did you?

See also http://flatassembler.net/docs.php?article=win32#1.7
Post 23 Jul 2006, 15:30
View user's profile Send private message Visit poster's website 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.