flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Menu with language different from english |
Author |
|
Tomasz Grysztar 10 Sep 2003, 08:48
This:
Code: load ..char byte from $ - ..size + % - 1 can be replaced with just: Code: load ..char byte from % - 1 |
|||
10 Sep 2003, 08:48 |
|
Dunduk 10 Sep 2003, 09:25
Oh, sure! Where were my eyes?! It was most unlikely for me piece of macro. Thanks a lot, Privalov.
|
|||
10 Sep 2003, 09:25 |
|
Tomasz Grysztar 10 Sep 2003, 09:41
It can be also made more universal by just redefining du as a macro, so everything that uses du (menu macros in particular) can use such conversion:
Code: macro du [args] { common local ..times,..size,..char virtual at 0 db args ..size = $ end virtual repeat ..size virtual at 0 db args load ..char byte from $ - ..size + % - 1 end virtual if ..char > 127 db ..char-0b0h, 04h else du ..char end if end repeat } struc du [args] { common du args } |
|||
10 Sep 2003, 09:41 |
|
Dunduk 10 Sep 2003, 09:54
Oh, yeah! I always forget about redefining. It is much better, I understand. But... It's not understandable for me why last string (struc). I have to think a little...
|
|||
10 Sep 2003, 09:54 |
|
Tomasz Grysztar 10 Sep 2003, 09:57
The struc is defined to allow labeled du also.
Maybe we could also try making some UTF-8 conversion for du as a macro? |
|||
10 Sep 2003, 09:57 |
|
Tomasz Grysztar 10 Sep 2003, 10:12
And here's the conversion macro for Polish language:
Code: macro du [args] { common local ..times,..size,..char virtual at 0 db args ..size = $ end virtual repeat ..size virtual at 0 db args load ..char byte from $ - ..size + % - 1 end virtual if ..char = 0B9h dw 105h else if ..char = 0E6h dw 107h else if ..char = 0EAh dw 119h else if ..char = 0B3h dw 142h else if ..char = 0F1h dw 144h else if ..char = 09Ch dw 15Bh else if ..char = 9Fh dw 17Ah else if ..char = 0BFh dw 17Ch else if ..char = 0A5h dw 104h else if ..char = 0C6h dw 106h else if ..char = 0CAh dw 118h else if ..char = 0A3h dw 141h else if ..char = 0D1h dw 143h else if ..char = 8Ch dw 15Ah else if ..char = 8Fh dw 179h else if ..char = 0AFh dw 17Bh else du ..char end if end repeat } |
|||
10 Sep 2003, 10:12 |
|
Dunduk 10 Sep 2003, 11:02
It would be very nice to have universal (for many languages) macro... But it must be so sophisticated and big... Will it work if for example to use 'if used LANG_RUSSIAN' for selection from many language section in 'if'?... I have no time to test it, tomorrow I will.
|
|||
10 Sep 2003, 11:02 |
|
S.T.A.S. 16 Apr 2004, 19:47
Here is some unicode example using new store directive.
Could be useful for some languages Code: ;; sample unicode prog format PE GUI 4.0 at 400000h data import dd RVA ExitProcess, 0, 0, RVA k32, RVA ExitProcess dd RVA MessageBox, 0, 0, RVA u32, RVA MessageBox dd 0, 0, 0, 0, 0 ;; end of directory k32 db 'kernel32.dll',0 u32 db 'user32.dll',0 EP db 0,0, 'ExitProcess',0 MB db 0,0, 'MessageBoxW',0 align 4 ExitProcess dd RVA EP, 0 MessageBox dd RVA MB, 0 end data ;; conversion macro macro du [arg] { local ..char, ..uchar, ..i ..i = $ du arg repeat ($-..i)/2 load ..char from ..i+(%-1)*2 virtual file 'russian.a2u' :..char*2,2 load ..uchar word from $-2 end virtual store word ..uchar at ..i+(%-1)*2 end repeat } entry $ push 64 push text push caption push 0 call [MessageBox] push 0 call [ExitProcess] caption: du '03>;>2>:',0 text: du '"5:AB',0 The language-specific map file can be created by such way: Code: xor ebx, ebx invoke CreateFile,'russian.a2u',GENERIC_WRITE,ebx,ebx,CREATE_ALWAYS,ebx,ebx xchg eax, edi push ebx ;; local char mov esi, esp push ebx ;; local uchar mov ebp, esp @@: mov [esi],ebx ;; using russian codepage invoke MultiByteToWideChar,1251,1,esi,1,ebp,1 invoke WriteFile, edi, ebp, 2,esp,0 inc bl jnz @b invoke CloseHandle,edi invoke ExitProcess,ebx
|
|||||||||||
16 Apr 2004, 19:47 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.