Subversion Repositories SvarDOS

Rev

Rev 1485 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1485 Rev 1486
Line 89... Line 89...
89
 
89
 
90
SKIP_ROWS_DETECTION:
90
SKIP_ROWS_DETECTION:
91
 
91
 
92
 
92
 
93
; ****************************************************************************
93
; ****************************************************************************
-
 
94
; * preset lang to EN                                                        *
-
 
95
; ****************************************************************************
-
 
96
mov     bp, LANGLIST+2
-
 
97
 
-
 
98
 
-
 
99
; ****************************************************************************
94
; * Scan the environement block looking for the LANG variable                *
100
; * Scan the environement block looking for the LANG variable                *
95
; ****************************************************************************
101
; ****************************************************************************
96
 
102
 
97
; set ES to point at the environment segment (PSP's offset 2Ch)
103
; set ES to point at the environment segment (PSP's offset 2Ch)
98
mov     es, [2Ch]
104
mov     es, [2Ch]
Line 103... Line 109...
103
CMP_NEXT_VAR:
109
CMP_NEXT_VAR:
104
 
110
 
105
; if it points at a nul already then it's the end of the env block
111
; if it points at a nul already then it's the end of the env block
106
mov     al, [es:di]
112
mov     al, [es:di]
107
test    al, al
113
test    al, al
108
jz      ENDOFENV
114
jz      LANG_DONE
109
 
115
 
110
mov     si, LANG
116
mov     si, LANG
111
mov     cx, 5
117
mov     cx, 5
112
repe    cmpsb
118
repe    cmpsb
113
 
119
 
Line 116... Line 122...
116
 
122
 
117
; otherwise jump to next var (look for nearest nul terminator)
123
; otherwise jump to next var (look for nearest nul terminator)
118
xor     al, al
124
xor     al, al
119
mov     cx, 0ffffh
125
mov     cx, 0ffffh
120
repne   scasb                          ; compare AL with [ES:DI++]
126
repne   scasb                          ; compare AL with [ES:DI++]
121
jmp     CMP_NEXT_VAR
127
jmp     short CMP_NEXT_VAR
122
 
128
 
123
; FOUND THE LANG VARIABLE (at ES:DI)
129
; FOUND THE LANG VARIABLE (at ES:DI)
124
FOUND_LANG:
130
FOUND_LANG:
125
 
131
 
126
mov     ax, [es:di]                    ; load the LANG ID to AX and make
132
mov     bx, [es:di]                    ; load the LANG ID to BX and make
127
and     ax, 0DFDFh                     ; sure it is always upper case
133
and     bx, 0DFDFh                     ; sure it is always upper case
128
 
134
 
129
 
135
 
130
; ****************************************************************************
136
; ****************************************************************************
131
; * Now I have a LANG ID in AX and I have to match it for something I know.  *
137
; * Now I have a LANG ID in BX and I have to match it for something I know.  *
132
; * The LANG ID is simply the value for the two uppercase LANG letters, for  *
-
 
133
; * example the LANG ID for "PL" is 4C50h (50h = 'P', 4Ch = 'L').            *
-
 
134
; ****************************************************************************
138
; ****************************************************************************
135
 
139
 
136
; DE [44h 45h]
-
 
137
mov     bp, TEXT_DE
-
 
138
cmp     ax, 4544h
-
 
139
je      LANGOK
-
 
140
 
-
 
141
; DK [44h 4Bh]
-
 
142
mov     bp, TEXT_DK
-
 
143
cmp     ax, 4B44h
-
 
144
je      LANGOK
-
 
145
 
-
 
146
; ES [45h 53h]
-
 
147
mov     bp, TEXT_ES
140
mov     di, LANGLIST
148
cmp     ax, 5345h
141
mov     ax, ds
149
je      LANGOK
-
 
150
 
-
 
151
; FI [46h 49h]
-
 
152
mov     bp, TEXT_FI
142
mov     es, ax
153
cmp     ax, 4946h
-
 
154
je      LANGOK
-
 
155
 
143
 
156
; FR [46h 52h]
-
 
157
mov     bp, TEXT_FR
-
 
158
cmp     ax, 5246h
-
 
159
je      LANGOK
144
NEXTLANG:
160
 
-
 
161
; IT [49h 54h]
-
 
162
mov     bp, TEXT_IT
-
 
163
cmp     ax, 5449h
145
cmp     byte ptr [di], 0               ; look for the end of list terminator
164
je      LANGOK
146
je      LANG_DONE
165
 
-
 
166
; NL [4Eh 4Ch]
-
 
167
mov     bp, TEXT_NL
-
 
168
cmp     ax, 4C4Eh
147
cmp     [di], bx                       ; look for a LANG ID match
169
je      LANGOK
148
je      LANGIDOK
170
 
149
 
171
; PL [50h 4Ch]
-
 
172
mov     bp, TEXT_PL
-
 
173
cmp     ax, 4C50h
150
; skip string (look for its $ terminator) and repeat
174
je      LANGOK
151
SKIPLANG:
175
 
-
 
176
; RU [52h 55h]
-
 
177
mov     bp, TEXT_RU
152
mov     al, '$'
178
cmp     ax, 5552h
-
 
179
je      LANGOK
-
 
180
 
-
 
181
; SL [53h 4Ch]
-
 
182
mov     bp, TEXT_SL
153
mov     cx, 0ffffh
183
cmp     ax, 4C53h
-
 
184
je      LANGOK
-
 
185
 
-
 
186
; SV [53h 56h]
-
 
187
mov     bp, TEXT_SV
154
repne   scasb                          ; compare AL with [ES:DI++]
188
cmp     ax, 5653h
-
 
189
je      LANGOK
-
 
190
 
-
 
191
; TR [54h 52h]
-
 
192
mov     bp, TEXT_TR
155
jmp     short NEXTLANG
193
cmp     ax, 5254h
-
 
194
je      LANGOK
-
 
195
 
-
 
196
 
156
 
-
 
157
LANGIDOK:
197
; *** LANG NOT FOUND OR LANG ID MATCH FAILED: FALL BACK TO EN ****************
158
mov     bp, di                         ; ptr to localized msg is always in BP
-
 
159
inc     bp
-
 
160
inc     bp
198
 
161
 
199
ENDOFENV:
-
 
200
mov     bp, TEXT_EN
-
 
201
 
162
 
202
LANGOK:
163
LANG_DONE:
203
 
164
 
204
 
165
 
205
; ****************************************************************************
166
; ****************************************************************************
206
; * DUPLICATING HANDLES: here I duplicate stdin into a new handle so I can   *
167
; * DUPLICATING HANDLES: here I duplicate stdin into a new handle so I can   *
207
; * safely close original stdin (file handle 0) and then duplicate stderr    *
168
; * safely close original stdin (file handle 0) and then duplicate stderr    *
Line 365... Line 326...
365
CRLF DB 13, 10, '$'
326
CRLF DB 13, 10, '$'
366
LANG DB "LANG="
327
LANG DB "LANG="
367
SEPAR1 DB "--- $"
328
SEPAR1 DB "--- $"
368
SEPAR2 DB " ---$"
329
SEPAR2 DB " ---$"
369
 
330
 
-
 
331
LANGLIST:
-
 
332
DB "EN",  "MORE$"                      ; EN must be 1st to be used as default
370
TEXT_DE DB "WEITER$"
333
DB "DE",  "WEITER$"
371
TEXT_DK DB "MERE$"
334
DB "DK",  "MERE$"
372
TEXT_ES DB "M", 0B5h, "S$"              ; "MAS" with an A-acute (CP 850)
335
DB "ES",  "M", 0B5h, "S$"              ; "MAS" with an A-acute (CP 850)
373
TEXT_EN DB "MORE$"
-
 
374
TEXT_FI DB "LIS", 8Eh, 8Eh, "$"         ; "LISAA" - AA with diaeresis (CP 850)
336
DB "FI",  "LIS", 8Eh, 8Eh, "$"         ; "LISAA" - AA with diaeresis (CP 850)
375
TEXT_FR DB "PLUS$"
337
DB "FR",  "PLUS$"
376
TEXT_IT DB "PI", 0EBh, "$"              ; "PIU" with U-acute (CP 850)
338
DB "IT",  "PI", 0EBh, "$"              ; "PIU" with U-acute (CP 850)
377
TEXT_NL DB "MEER$"
339
DB "NL",  "MEER$"
378
TEXT_PL DB "DALEJ$"
340
DB "PL",  "DALEJ$"
379
TEXT_RU DB 84h,80h,8Bh,85h,85h,'$'     ; "DALEE" (CP 866)
341
DB "RU",  84h,80h,8Bh,85h,85h,'$'      ; "DALEE" (CP 866)
380
TEXT_SL DB "VE", 0ACh, "$"             ; "VEC" with C-caron (CP 852)
342
DB "SL",  "VE", 0ACh, "$"              ; "VEC" with C-caron (CP 852)
381
TEXT_SV DB "MERA$"
343
DB "SV",  "MERA$"
382
TEXT_TR DB "DAHA FAZLA$"
344
DB "TR",  "DAHA FAZLA$"
-
 
345
DB, 0                                  ; LANGLIST terminator
383
 
346
 
384
; uninitialized area (must be defined last)
347
; uninitialized area (must be defined last)
385
 
348
 
386
FHANDLE dw      ?                      ; file handle I read from (DUPed stdin)
349
FHANDLE dw      ?                      ; file handle I read from (DUPed stdin)
387
 
350