flat assembler
Message board for the users of flat assembler.

Index > Windows > Using TAB-symbol with encoding macro.

Author
Thread Post new topic Reply to topic
barmentalisk



Joined: 06 Sep 2005
Posts: 36
barmentalisk 03 Jun 2008, 11:38
My native language is Russian. I often need to include 'encoding\WIN1251.INC'. It worked well before today.
Today I had to use TAB-symbol in my russian menu, but when I do as it done in FASMW source
Code:
& & &
  _ equ ,09h,

  menu main_menu
       menuitem '&File',0,MFR_POPUP
                menuitem '&New' _ 'Ctrl+N',IDM_NEW
& & &
    

and change (for example) '&New' with russian equivalent in russian codepage, - I got in that string the same result as if I havent included WIN1251. Strings without ' _ ' are translated to russian codepage correctly as usual.
Of course, I can leave onebyte-spaces for tabulation in my code, and after compilation rewrite them manually to 0x09 in hex-editor; or include compilated res-file with correct russian menu. But I wonder if there is a way to use TAB-symbol directly in code, in manually defined resources?
Post 03 Jun 2008, 11:38
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20340
Location: In your JS exploiting you and your system
revolution 03 Jun 2008, 12:15
If you modify the WIN1251.INC file to the following then the code page conversion should work with the underscore equate:
Code:
; Windows 1251

macro du [arg]
 { local ..data,char
   ..data du arg
;  if arg eqtype ''
    repeat ($-..data)/2
     load char byte from ..data+(%-1)*2
     if char > 7Fh
      if char < 0C0h
       virtual at 0
       if char < 90h
       dw 401h,403h,201Ah,453h,201Eh,2026h,2020h,2021h,20ACh,2030h,409h,2039h,40Ah,40Ch,40Bh,40Fh
       else if char < 0A0h
 dw 452h,2018h,2019h,201Ch,201Dh,2022h,2013h,2014h,?,2122h,459h,203Ah,45Ah,45Ch,45Bh,45Fh
       else if char < 0B0h
   dw 0A0h,40Eh,45Eh,408h,0A4h,490h,0A6h,0A7h,401h,0A9h,404h,0ABh,0ACh,0ADh,0AEh,407h
       else
   dw 0B0h,0B1h,406h,456h,491h,0B5h,0B6h,0B7h,451h,2116h,454h,0BBh,458h,405h,455h,457h
       end if
       load char word from (char and 0Fh)*2
       end virtual
      else
       char = 410h+char-0C0h
      end if
      store word char at ..data+(%-1)*2
     end if
    end repeat
;  end if
 }

struc du [args]
 { common label . word
   du args }
    
Post 03 Jun 2008, 12:15
View user's profile Send private message Visit poster's website Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 03 Jun 2008, 13:12
i have no see any trouble with using existing WIN1251.INC and "9" directly:
menuitem <'Выход',9,'Alt+X'>,IDM_EXIT,MFR_END
Post 03 Jun 2008, 13:12
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20340
Location: In your JS exploiting you and your system
revolution 03 Jun 2008, 17:20
shoorick wrote:
i have no see any trouble with using existing WIN1251.INC and "9" directly:
menuitem <'Выход',9,'Alt+X'>,IDM_EXIT,MFR_END
It won't encode as Unicode because the arg eqtype '' will never match.
Post 03 Jun 2008, 17:20
View user's profile Send private message Visit poster's website Reply with quote
barmentalisk



Joined: 06 Sep 2005
Posts: 36
barmentalisk 03 Jun 2008, 21:11
Thanks for your help!
I consider shoorick's variant to be the best for me.
I just didnt know how to combine a number of arguments in one argument.
Now everything is clear.

Quote:

It won't encode as Unicode because the arg eqtype '' will never match.

But it works correct...
Post 03 Jun 2008, 21:11
View user's profile Send private message 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.