The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: herge on September 18, 2008, 11:14:29 AM

Title: Japanese text
Post by: herge on September 18, 2008, 11:14:29 AM
 Hi ALL:

日本語の日時

This is date and time in Japanese!
I don't see it in qeditor. ie a bunch of ????
i do see.
I think I need unicows.dll and unicows.lib
Any help would be great.

Regards herge
Title: Re: Japanese text
Post by: Tedd on September 18, 2008, 04:24:34 PM
QEditor only supports ansi text, so you will get "?" for any characters not in the Latin-1 codepage.
"unicows" was a fix for non-NT versions to support unicode, you don't need it unless you're on Win95/98.

For Unicode text editing, you'll need an editor that supports it (notepad does :lol)
Title: Re: Japanese text
Post by: herge on September 19, 2008, 12:17:42 PM

Thanks Tedd:

I will have to do something else.

Regards herge
Title: Re: Japanese text
Post by: jj2007 on September 21, 2008, 12:53:48 AM
herge,
Farabi asked for Arabic in this post (http://www.masm32.com/board/index.php?board=1;topic=9961.2#msg72961). As it seems, Arabic can be displayed in RichMasm, which is based on RichEdit 3.0. I would be surprised if it didn't work for Japanese, but the language support must be enabled. Firefox does not ask for it, try MSIE instead. I just tried that on my puter, but it wants the original installation dvd, which is certainly lurking somewhere under a pile of .. somewhere in my office - if my vendor bothered to hand it out to me.
Title: Re: Japanese text
Post by: herge on September 21, 2008, 02:24:40 AM
 
Hi jj2007:

Yes it does display in Richmasm, but ML.EXE is going to
choke on it, IE give an error, in fact it does NOT like
unicode. ML.EXE can only handle ANSI text files.
I think I will have to create a text file in Notepad and
save as UNICODE and then read the file.
I must admit I have not tried this yet. Except that I
have created text files with  Japanese text with
Notepad.
You also have to set IE up for Japanese text.
I was going to use the adobe print pack
but does not work with adobe 9.0
I remember you needed a XP system disk at one point.

Regards herge
Title: Re: Japanese text
Post by: jj2007 on September 21, 2008, 06:17:48 AM
Quote from: herge on September 21, 2008, 02:24:40 AM

Hi jj2007:

Yes it does display in Richmasm, but ML.EXE is going to
choke on it, IE give an error, in fact it does NOT like
unicode. ML.EXE can only handle ANSI text files.


Hmmmm.... RichMasm saves an Ansi text file (Tmp_file.asm) for assembly. ml.exe does not choke on a sample code with Arabic comments. I cannot test it for Japanese, though.
Title: Re: Japanese text
Post by: herge on September 21, 2008, 09:15:08 AM

Hi jj2007:


; JAPANESE.ASM 5:58:49 AM Thursday, September 18, 2008
include \masm32\include\masm32rt.inc
; Wednesday, July 16, 2008 9:17:12 AM
.data
dtbuf db 260 dup(0)
dw 0
AppName db "Date and Time", 0
crlf db 13, 10, 0
tf db "HH':'mm':'ss", 0
.code


Start:
invoke StdOut, addr AppName
invoke GetDateFormat, 1041, DATE_LONGDATE, 0, 0, addr dtbuf, 260
invoke lstrcat, addr dtbuf, addr crlf
push esi
mov esi, offset dtbuf
add esi, len(esi)
invoke GetTimeFormat, 1041, 0, 0, addr tf, esi, 40
pop esi
invoke MessageBoxW, NULL, addr dtbuf, addr AppName, MB_OK
         
        inkey
exit
      ret

end Start



This displays some Japanese script.
I have not a clue what it says.

Regards herge


[attachment deleted by admin]
Title: Re: Japanese text
Post by: six_L on September 21, 2008, 10:25:03 AM
try it.
invoke WideCharToMultiByte, CP_ACP, NULL, addr dtbuf, -1, addr buffer, 256, NULL, NULL
invoke MessageBoxW, NULL, addr buffer, addr AppName, MB_OK
Title: Re: Japanese text
Post by: herge on September 21, 2008, 10:53:09 AM

hi six_L:

Did japanese.exe work?

Regards herge
Title: Re: Japanese text
Post by: six_L on September 21, 2008, 11:00:31 AM
i don't know.
i'm not a Japanese.
Title: Re: Japanese text
Post by: jj2007 on September 21, 2008, 03:26:37 PM
Quote from: herge on September 21, 2008, 10:53:09 AM
Did japanese.exe work?

It can work only if Japanese language support is enabled.

EDIT: Here is a full example for various languages including Australian English :bg

; Date and time in any language to the clipboard - inspired by herge (http://www.masm32.com/board/index.php?action=profile;u=1718), 22.09.2008
; Country codes, see MSDN (http://msdn.microsoft.com/en-us/library/ms776260(VS.85).aspx) - last one in the list will be taken

CoCode = 0411h ; Japanese
CoCode = 03001h ; Arabic
CoCode = 0407h ; German
CoCode = 0c09h ; Australian English (greetings to Hutch)

.nolist
include \masm32\include\masm32rt.inc

Unicode2Clipboard PROTO: DWORD
szLenUC PROTO: DWORD

uchr$ MACRO ansitext:VARARG ; use like chr$, output is Unicode
LOCAL ansisrc, ucdest, strsize, quotes, srcarg
  quotes INSTR <ansitext>, <">
  if quotes eq 0
quotes INSTR <ansitext>, <'>
  endif
  if quotes
.data
ansisrc db ansitext, 0
strsize = SIZEOF ansisrc
srcarg equ <ansisrc>
  else
strsize = SIZEOF ansitext
srcarg equ <ansitext>
  endif
  .data?
ucdest dd strsize dup(?)
  .code
  mov eax, offset srcarg
  mov edx, offset ucdest
  call ansi2uc
  EXITM <offset ucdest>
ENDM

uclen MACRO lpString ; use like len, output is bytes (not words)
  invoke szLenUC, reparg(lpString)
  EXITM <eax>
ENDM;

.data?
dtbuf db 260 dup(?)
tmpbuffer dd 260 dup(?)

.data
crlf db 13, 10, 0

.code
Start: push esi
mov esi, offset dtbuf
invoke GetDateFormatW, CoCode, DATE_LONGDATE, 0, 0, esi, 520
invoke lstrcatW, addr dtbuf, uchr$(crlf)
invoke GetTimeFormatW, CoCode, 0, 0, uchr$("HH':'mm':'ss"), offset tmpbuffer, 40
invoke lstrcatW, addr dtbuf, offset tmpbuffer
invoke MessageBoxW, NULL, esi,
uchr$('Date and Time: Copy to clipboard?'),
MB_OKCANCEL or MB_DEFBUTTON2
.if eax==IDOK
invoke Unicode2Clipboard, esi
.endif
pop esi
exit

Unicode2Clipboard proc pBuffer
LOCAL cptClip:DWORD, hWnd
invoke GetDesktopWindow
mov hWnd, eax
push esi
push edi
push ebx
mov esi, pBuffer
mov ecx, uclen(esi)
add ecx, 2 ; len plus trailing nullword
push ecx
invoke GlobalAlloc, GHND or GMEM_SHARE, ecx
mov ebx, eax ; the handle
invoke GlobalLock, ebx ; returns dest pointer
mov edi, eax ; dest
pop ecx ; pushed len
sar ecx, 1 ; unicode, so let's
rep movsw ; move words
invoke GlobalUnlock, ebx
invoke OpenClipboard, hWnd
invoke EmptyClipboard
invoke SetClipboardData, CF_UNICODETEXT, ebx
invoke CloseClipboard
pop ebx
pop edi
pop esi
ret
Unicode2Clipboard endp

ansi2uc proc
  invoke MultiByteToWideChar,
CP_ACP, ; code page
MB_PRECOMPOSED, ; character-type options
eax, ; address of source string to map
-1, ; source string is zero delimited
edx, ; buffer that receives the translated string.
0FFFFFFFh ; size of buffer nearly unlimited
  ret
ansi2uc endp

szLenUC proc uses edi ecx src:DWORD
  or ecx, -1
  mov edi, src ; pointer to string
  xor eax, eax ; mov ax, 0
  repnz scasw ; rep until a nullword is found
  mov eax, ecx ; we take eax to preserve ecx
  not eax ; example 10 words: start -1,
  dec eax ; now -10: not -11 = 10
  add eax, eax ; we return bytes, not words
  ret
szLenUC endp

end Start
Title: Re: Japanese text
Post by: herge on September 21, 2008, 03:36:22 PM

Hi jj2007:

Great work.
It works for me!

Regards herge
Title: Re: Japanese text
Post by: herge on September 21, 2008, 03:43:22 PM

Hi jj2007:

A MicroSoft link for country locales.


http://www.microsoft.com/globaldev/reference/lcid-all.mspx


Regards herge
Title: Re: Japanese text
Post by: Mark Jones on September 21, 2008, 07:58:44 PM
Quote from: herge on September 21, 2008, 09:15:08 AM
...This displays some Japanese script. I have not a clue what it says...

Hello Herge, sorry I do not know what it says either. But it does display on my WinXP with the East-Asian language support installed. I just wanted to mention two things. First, several of the characters in that example did not display, and instead appeared as squares. Apparently some of those characters are not present on my system.

Second, I did a test of the number of clock cycles required to display ASCII text versus the same text as UNICODE, and despite the fact that modern Windows supposedly converts ASCII text to UNICODE internally to display it, there is virtually no speed improvement in using UNICODE strings natively.
Title: Re: Japanese text
Post by: herge on September 22, 2008, 11:19:38 AM

Hi all:

This is a Date & Time Program.


; EFG.ASM Monday, September 22, 2008 6:47 AM
; Date & Time in English French German
; herge
include \masm32\include\masm32rt.inc
.data
dtbuf db 512 dup(0)
dd 0
index   dd 0
country dd 1036
dd 2060
dd 3084
dd 4108
dd 1043
dd 2067
dd 1126 ; Edo(45)
dd 1033
dd 2057
dd 3081
dd 10249
dd 4105 ; CANADA(50)
dd 9225
dd 15369
dd 16393
dd 14345
dd 6153
dd 8201
dd 17417
dd 5129
dd 13321
dd 18441
dd 7177
dd 11273
dd 1031
dd 3079
dd 5127
dd 4103
dd 2055
dd 1032
dd 1040
dd 2064
dd 1041

dd 0
location db "French - France",0
db "French - Belgium",0
db "French - Quebec",0
db "French - Swiss",0
db "Dutch - Netherlands",0
db "Dutch - Belgium",0
db "Edo",0  ; (45)
db "English - United States",0
db "English - United Kingdom",0
db "English - Australia",0
db "English - Belize",0
db "English - Canada",0
db "English - Caribbean",0
db "English - Hong Kong SAR",0
db "English - India",0
db "English - Indonesia",0
db "English - Ireland",0
db "English - Jamaica",0
db "English - Malaysia",0
db "English - New Zealand",0
db "English - Philippines",0
db "English - Singapore",0
db "English - South Africa",0
db "English - Trinidad",0
db "German - Germany",0
db "German - Austria",0
db "German - Liechtenstein",0
db "German - Luxembourg",0
db "German - Swiss",0
db "Greek",0
db "Italian - Italy",0
db "Italian - Swiss",0
db "Japanese",0
db 0

AppName db "Date and Time "
AppNameI db 20 dup(32)
db 0
Count db "Index Count "
CountI db 20 dup (32)
db 0
crlf db 13, 10, 0
dfo db "ddd',' MMM dd yyyy", 0 
tf db "hh':'mm':'ss tt", 0
.code
InsertEntry proc
; EDI > Out Print Buffer
; ECX = length
; ESI > In Table Buffer
      mov   ecx,0
@@:
mov al,[esi]
mov [edi],al
inc esi
inc edi
inc            ecx
and al,al
jnz @b
      mov   word ptr [edi-1], 0A0Dh
inc edi
inc ecx   
ret
InsertEntry endp
clearbuf proc
push ecx
mov ecx, 512
push edi
@@:
mov word ptr [edi], 0
add edi, 2
sub cx, 2
jc @F
jnz   @B
@@:; opps odd # or zero
pop edi
pop ecx
ret
clearbuf endp
PrintRegion proc
push ebx
push ecx
push esi
lea  esi, location
lea  edi, dtbuf
call clearbuf
call CX_TH_Entry
call InsertEntry
      lea  eax, dtbuf
      push edi
      sub  edi, eax
      mov  eax, edi
      pop  edi
pop  esi
      pop  ecx
pop  ebx
ret
PrintRegion endp
CX_TH proc
; ESI > Table
; ECX is entry in table we
; want.
; find cx_th entry in table
jcxz cx_th_exit
dec cx ; is it first entry
jcxz cx_th_exit; is first then exit
@@:
mov al,[esi] ; get a byte
inc esi ; point to next byte
and al,al ; is byte equal zero
jnz @B; search for zero
dec ecx
jnz @B; find cx_th zero
cx_th_exit:
; cx_th zero found exit
ret
CX_TH endp
CX_TH_Entry proc
push ecx
call CX_TH
pop ecx
ret
CX_TH_Entry endp
main proc
Start::
      mov   ecx, 0 
      lea   esi, country
@@:
      mov   ebx,[esi]
      and   ebx, ebx
      jz    @F
      inc   ecx
      mov   [index], ecx
      push  ecx
      push  esi
      call PrintRegion
      invoke GetDateFormat, ebx, 0, 0, addr dfo, edi, 260
      add   edi, eax
      mov   byte ptr [edi-1], " "    
      invoke GetTimeFormat, ebx, 0, 0, addr tf, edi, 40
      add   edi, eax
      mov   word ptr [edi-1], 0A0Dh
      inc   edi
      invoke dwtoa, index, addr AppNameI
      invoke dwtoa, index, edi ; convert prime to ASCII 
      invoke MessageBox, NULL, addr dtbuf, addr AppName, MB_OK
      pop   esi
      add   esi, 4
      pop   ecx
      jmp   @B
@@:
      invoke dwtoa, ecx, addr CountI; convert prime to ASCII
      invoke MessageBox, NULL, addr Count, addr Count, MB_OK
      invoke ExitProcess, NULL
      ret
main endp
end Start



Regards herge
Title: Re: Japanese text
Post by: herge on September 29, 2008, 02:41:38 AM

Hi All:

An updated program. I have to get the X button or
cancel button to work. So you have to press ok a lot!


; LOC.ASM 7:05 AM 9/21/2008
; herge
include \masm32\include\masm32rt.inc
.data
dtbuf db 512 dup(0)
dd 0
index   dd 0
country dd 1078 ; South Africa
dd 1052
dd 1118
dd 1025
dd 5121
      dd 15361
dd 3073
dd 2049
dd 11265
dd 13313
dd 12289
dd 4097
dd 6145
dd 8193
dd 16385
dd 10241
dd 7169
dd 14337
dd 9217
dd 1067
dd 1101
dd 2092
dd 1068
dd 1069 ; Basque
dd 1059
dd 1093
dd 2117
dd 5146
dd 1026
dd 1109
dd 1027 ; Catalan(31)
  dd 1116
dd 2052
dd 4100
dd 1028
dd 3076
dd 5124
dd 1050
dd 4122
dd 1029
dd 1030 ; Danish(41)
dd 1125
dd 1043
dd 2067
dd 1126 ; Edo(45)
dd 1033
dd 2057
dd 3081
dd 10249
dd 4105 ; CANADA(50)
dd 9225
dd 15369
dd 16393
dd 14345
dd 6153
dd 8201
dd 17417
dd 5129
dd 13321
dd 18441
dd 7177
dd 11273
dd 12297
dd 1061
dd 1080 ; Faroese(65)
dd 1065
dd 1124
dd 1035
dd 1036
dd 2060
dd 11276
dd 3084
dd 9228
dd 12300
dd 15372
dd 5132
dd 13324
dd 6156
dd 14348
dd 58380
dd 8204
dd 10252
dd 4108
dd 7180
dd 1122
dd 1127
dd 1071
dd 2108 ; Gaelic(88)
    dd 1084
dd 1110
dd 1079
dd 1031
dd 3079
dd 5127
dd 4103
dd 2055
dd 1032
dd 1140
dd 1095
dd 1128 ; Nigeria(100)
  dd 1141
dd 1037
dd 1081
dd 1038
dd 1129
dd 1039
dd 1136
dd 1057
dd 1117
dd 1040
dd 2064
dd 1041 ; Japan
dd 1099 ; Kaanada(113)
dd 1137
dd 2144
dd 1120
dd 1087
dd 1107
dd 1111
dd 1042
dd 1088
dd 1108 ; Lao(122)
dd 1142
dd 1062
dd 1063
dd 1086 ; Malay - Malaysia(126)
dd 2110
dd 1100
dd 1082
dd 1112
dd 1153
dd 1102
dd 1104
dd 2128
dd 1121 ; Nepali(135)
dd 2145
dd 1044
dd 2068
dd 1096
dd 1138
dd 1145 ; Papiamentu(141)
dd 1123
dd 1045
dd 1046
dd 2070
dd 1094
dd 2118
dd 1131
dd 2155
dd 3179 ; Peru(150)
  dd 1047
dd 1048
dd 2072
dd 1049
dd 2073
dd 1083 ; Sami (Lappish)
dd 1103
dd 1132
dd 3098
dd 2074
dd 1113
dd 2137
dd 1115
dd 1051
dd 1060
dd 1143
dd 1070
dd 3082
dd 1034
dd 11274
dd 16394
dd 13322
dd 9226
dd 5130
dd 7178
dd 12298
dd 17418
dd 4106
dd 18442
dd 58378
dd 2058
dd 19466
dd 6154
dd 15370
dd 10250
dd 20490
dd 21514
dd 14346
dd 8202
dd 1072
dd 1089
dd 1053
dd 2077
dd 1114
dd 1064 ; Tajik
      dd 1119
dd 2143
dd 1097
dd 1092
dd 1098 ; Telugu
dd 1054
dd 2129
dd 1105
dd 2163
dd 1139
dd 1073
dd 1074
dd 1055
dd 1090
dd 1152
dd 1058
dd 1056
dd 2080
dd 2115
dd 1091
dd 1075
dd 1066
dd 1106 ; Welsh
dd 1076
dd 1144 ; Yi
dd 1085
dd 1130
dd 1077 ; Zulu (223)
dd 0
location db "Afrikaans - South Africa",0
db "Albania",0
db "Amharic - Ethiopia",0
db "Arabic - Saudi Arabia",0
db "Arabic - Algeria",0
db "Arabic - Bahrain",0
db "Arabic - Egypt",0
db "Arabic - Iraq",0
db "Arabic - Jordan",0
db "Arabic - Kuwait",0
db "Arabic - Lebanon",0
db "Arabic - Libya",0
db "Arabic - Morocco",0
db "Arabic - Oman",0
db "Arabic - Qatar",0
db "Arabic - Syria",0
db "Arabic - Tunisia",0
db "Arabic - U.A.E.",0
db "Arabic - Yemen",0
db "Armenia",0
db "Assamese",0
db "Azeri (Cyrillic)",0
db "Azeri (Latin)",0
db "Basque",0 ; (24)
db "Belarusian",0
db "Bengali (India)",0
db "Bengali (Bangladesh)",0
db "Bosnian (Bosnia/Herzegovina)",0
db "Bulgarian",0
db "Burmese",0
db "Catalan",0 ; (31)
db "Cherokee - United States",0
db "Chinese - People's Republic of China",0
db "Chinese - Singapore",0
db "Chinese - Taiwan",0
db "Chinese - Hong Kong SAR",0
db "Chinese - Macao SAR",0
db "Croatian",0
db "Croatian (Bosnia/Herzegovina)",0
db "Czech",0
db "Danish",0 ; (41)
db "Divehi",0
db "Dutch - Netherlands",0
db "Dutch - Belgium",0
db "Edo",0  ; (45)
db "English - United States",0
db "English - United Kingdom",0
db "English - Australia",0
db "English - Belize",0
db "English - Canada",0
db "English - Caribbean",0
db "English - Hong Kong SAR",0
db "English - India",0
db "English - Indonesia",0
db "English - Ireland",0
db "English - Jamaica",0
db "English - Malaysia",0
db "English - New Zealand",0
db "English - Philippines",0
db "English - Singapore",0
db "English - South Africa",0
db "English - Trinidad",0
db "English - Zimbabwe",0
db "Estonian",0
db "Faroese",0 ; (65)
db "Farsi",0
db "Filipino",0
db "Finnish",0
db "French - France",0
db "French - Belgium",0 ;(70)
db "French - Cameroon",0
db "French - Quebec",0
db "French - Democratic Rep. of Congo",0
db "French - Cote d'Ivoire",0
db "French - Haiti",0
db "French - Luxembourg",0
db "French - Mali",0
db "French - Monaco",0
db "French - Morocco",0
db "French - North Africa",0
db "French - Reunion",0
db "French - Senegal",0
db "French - Swiss",0
db "French - West Indies",0
db "Frisian - Netherlands",0
db "Fulfulde - Nigeria",0
db "FYRO Macedonian",0
db "Gaelic (Ireland)",0 ; (88)
db "Gaelic (Scotland)",0
db "Galician",0
db "Georgian",0
db "German - Germany",0
db "German - Austria",0
db "German - Liechtenstein",0
db "German - Luxembourg",0
db "German - Swiss",0
db "Greek",0
db "Guarani - Paraguay",0
db "Gujarati",0
db "Hausa - Nigeria",0 ; (100)
db "Hawaiian - United States",0
db "Hebrew",0
db "Hindi",0
db "Hungarian",0
db "Ibibio - Nigeria",0 ; (105)
db "Icelandic",0
db "Igbo - Nigeria",0
db "Indonesian",0
db "Inuktitut",0
db "Italian - Italy",0
db "Italian - Swiss",0
db "Japanese",0
db "Kannada",0 ; (113)
db "Kanuri - Nigeria",0
db "Kashmiri",0
db "Kashmiri (Arabic)",0
db "Kazakh",0
db "Khmer",0
db "Konkani",0
db "Korean",0
db "Kyrgyz (Cyrillic)",0
db "Lao",0 ; (122)
db "Latin",0
db "Latvian",0
db "Lithuanian",0
db "Malay - Malaysia",0 ; (126)
db "Malay - Brunei Darussalam",0
db "Malayalam",0
db "Maltese",0
db "Manipuri",0 ; (130)
db "Maori - New Zealand",0
db "Marathi",0
db "Mongolian (Cyrillic)",0
db "Mongolian (Mongolian)",0
db "Nepali",0 ; (135)
db "Nepali - India",0
db "Norwegian (Bokmål)",0
db "Norwegian (Nynorsk)",0
db "Oriya",0
db "Oromo",0 ; (140)
db "Papiamentu",0 ; (141)
db "Pashto",0
db "Polish",0
db "Portuguese - Brazil",0
db "Portuguese - Portugal",0
db "Punjabi",0
db "Punjabi (Pakistan)",0
db "Quecha - Bolivia",0
db "Quecha - Ecuador",0
db "Quecha - Peru",0 ; (150)
db "Rhaeto-Romanic",0
db "Romanian",0
db "Romanian - Moldava",0
db "Russian",0
db "Russian - Moldava",0
db "Sami (Lappish)",0 ; (156)
db "Sanskrit",0
db "Sepedi",0
db "Serbian (Cyrillic)",0
db "Serbian (Latin)",0 ; (160)
db "Sindhi - India",0
db "Sindhi - Pakistan",0
db "Sinhalese - Sri Lanka",0
db "Slovak",0
db "Slovenian",0
db "Somali",0
db "Sorbian",0
db "Spanish - Spain (Modern Sort)",0
db "Spanish - Spain (Traditional Sort)",0
db "Spanish - Argentina",0
db "Spanish - Bolivia",0
db "Spanish - Chile",0
db "Spanish - Colombia",0
db "Spanish - Costa Rica",0
db "Spanish - Dominican Republic",0
db "Spanish - Ecuador",0
db "Spanish - El Salvador",0
db "Spanish - Guatemala",0
db "Spanish - Honduras",0
db "Spanish - Latin America",0 ; (180)
db "Spanish - Mexico",0
db "Spanish - Nicaragua",0
db "Spanish - Panama",0
db "Spanish - Paraguay",0
db "Spanish - Peru",0
db "Spanish - Puerto Rico",0
db "Spanish - United States",0
db "Spanish - Uruguay",0
db "Spanish - Venezuela",0
db "Sutu",0
db "Swahili",0
db "Swedish",0
db "Swedish - Finland",0
db "Syriac",0
db "Tajik",0 ; (195)
db "Tamazight (Arabic)",0
db "Tamazight (Latin)",0
db "Tamil",0
db "Tatar",0
db "Telugu",0
db "Thai",0
db "Tibetan - Bhutan",0
db "Tibetan - People's Republic of China",0
db "Tigrigna - Eritrea",0
db "Tigrigna - Ethiopia",0
db "Tsonga",0
db "Tswana",0
db "Turkish",0
db "Turkmen",0
db "Uighur - China",0 ; (210)
db "Ukrainian",0
db "Urdu",0
db "Urdu - India",0
db "Uzbek (Cyrillic)",0
db "Uzbek (Latin)",0
db "Venda",0
db "Vietnamese",0
db "Welsh",0
db "Xhosa",0
db "Yi",0 ; (220)
db "Yiddish",0
db "Yoruba",0
db "Zulu",0 ; (223)
db 0

AppName db "Date and Time "
AppNameI db 20 dup(32)
db 32
AppCountryI db 20 dup(32)
db 0
Count db "Index Count "
CountI db 20 dup (32)
db 0
crlf db 13, 10, 0
dfo db "dddd',' MMMM dd yyyy", 0 
tf db "hh':'mm':'ss tt", 0
.code
InsertEntry proc
; EDI > Print Buffer
; ECX = len
; ESI > Table Buffer
      mov   ecx,0
@@:
mov al,[esi]
mov [edi],al
inc esi
inc edi
inc   ecx
and al,al
jnz @b
      mov   word ptr [edi-1], 0A0Dh
inc edi
      inc   ecx
ret
InsertEntry endp
MoveEntry proc
; EDI > Out Print Buffer
; ESI > In Table Buffer
push  ebx
      push  esi
mov   ebx, 0
mov   ecx, 20
@@:
mov   al,[esi]
mov   [edi],al
inc   esi
inc   edi
inc   ebx
and   al,al
jz    @f
dec   ecx
jnz   @b
@@:
mov   ecx, ebx
      pop   esi
pop   ebx
ret
MoveEntry endp
clearbuf proc
push ecx
mov ecx, 512
push edi
@@:
mov word ptr [edi], 0
add edi, 2
sub cx, 2
jc @F
jnz   @B
@@:
pop edi
pop ecx
ret
clearbuf endp
PrintBar proc
push ebx
push ecx
push esi
lea  esi, location
lea  edi, AppCountryI
call CX_TH_Entry
call MoveEntry
pop  esi
      pop  ecx
pop  ebx
ret
PrintBar endp
PrintRegion proc
push ebx
push ecx
push esi
lea  esi, location
lea  edi, dtbuf
call clearbuf
call CX_TH_Entry
call InsertEntry
      lea  eax, dtbuf
      push edi
      sub  edi, eax
      mov  eax, edi
      pop  edi
pop  esi
      pop  ecx
pop  ebx
ret
PrintRegion endp
CX_TH proc
; ESI > Table
; ECX is entry in table we
; want.
; find cx_th entry in table
jcxz cx_th_exit
dec ecx ; is it first entry
jcxz cx_th_exit; is first then exit
@@:
mov al,[esi] ; get a byte
inc esi ; point to next byte
and al,al ; is byte equal zero
jnz @B; search for zero
dec ecx
jnz @B; find cx_th zero
cx_th_exit:
; cx_th zero found exit
ret
CX_TH endp
CX_TH_Entry proc
push ecx
call CX_TH
pop ecx
ret
CX_TH_Entry endp
main proc
Start::
      mov   ecx, 0 
      lea   esi, country
Next:
      mov   ebx,[esi]
      and   ebx, ebx
      jz    Exit
      inc   ecx
      mov   [index], ecx
      push  ecx
      push  esi
      push  ecx
      invoke GetDateFormat, ebx, 0, 0, addr dfo, addr dtbuf, 260
      pop   ecx
      and  eax, eax
      jz    Skip
      call PrintBar
      call PrintRegion
      invoke GetDateFormat, ebx, 0, 0, addr dfo, edi, 260
      add   edi, eax
      mov   byte ptr [edi-1], " "    
      invoke GetTimeFormat, ebx, 0, 0, addr tf, edi, 40
      add   edi, eax
      mov   word ptr [edi-1], 0A0Dh
      inc   edi
      invoke dwtoa, ebx, edi ; Convert locale to ASCII
      invoke dwtoa, index,  addr AppNameI ; convert index to ASCII 
      lea   edi, AppNameI
      mov   ecx, 20
@@:
      mov   al, [edi]
      inc   edi
      and   al, al
      jz    @F
      dec   ecx
      jnz   @B
      jmp   too_long
@@:
      mov   byte ptr [edi-1], 32
too_long:

      invoke MessageBox, NULL, addr dtbuf, addr AppName, MB_OK
Skip:     
      pop   esi
      add   esi, 4
      pop   ecx
      jmp   Next

Exit:
      invoke dwtoa, ecx, addr CountI; convert prime to ASCII
      invoke MessageBox, NULL, addr Count, addr Count, MB_OK
      invoke ExitProcess, NULL
      ret
main endp
end Start



Regards herge
Title: Re: Japanese text
Post by: herge on October 17, 2008, 11:18:29 AM

Hi All:

Code to get Cancel(X) button to work.


too_long:

      invoke MessageBox, NULL, addr dtbuf, addr AppName, MB_OKCANCEL
      cmp  eax, IDCANCEL
      jz    Cancel
Skip:     
      pop   esi
      add   esi, 4
      pop   ecx
      jmp   Next

Cancel:
      pop   esi ; balance stack
      pop   ecx

Exit:
      invoke dwtoa, ecx, addr CountI; ecx to ASCII
      invoke MessageBox, NULL, addr Count, addr Count, MB_OK
      invoke ExitProcess, NULL
      ret


Regards herge