News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Japanese text

Started by herge, September 18, 2008, 11:14:29 AM

Previous topic - Next topic

herge


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
// Herge born  Brussels, Belgium May 22, 1907
// Died March 3, 1983
// Cartoonist of Tintin and Snowy

herge


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
// Herge born  Brussels, Belgium May 22, 1907
// Died March 3, 1983
// Cartoonist of Tintin and Snowy