summaryrefslogtreecommitdiff
path: root/v4.0/src/MAPPER/OLDGETCN.ASM
blob: f3dd5a78eb6a7a47ffa11e0cf247893332f7d36c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
;
page 60,132
;
title CP/DOS DosGetCtryInfo mapper

Buffer  segment word public 'buffer'
CountryInfo     db      64
Buffer  ends

dosxxx  segment byte public 'dos'
        assume  cs:dosxxx,ds:nothing,es:nothing,ss:nothing
;
;**********************************************************************
;*
;*   MODULE:   dosgetctryinfo
;*
;*   FILE NAME: dos024.asm
;*
;*   CALLING SEQUENCE:
;*
;*       push      word   data area length
;*       push      word   country code
;*       push@     struc  data area
;*       call      dosgetctryinfo
;*
;*   MODULES CALLED:  PC-DOS Int 21h, ah=38h, get cntry info
;*
;*********************************************************************
;
            public   dosgetctryinfo
            .sall
            include  macros.inc

;
str         struc
old_bp          dw      ?
return          dd      ?
ReturnLength    dd      ?
BufferPtr       dd      ?
CountryCodePtr  dd      ?
BufferLength    dw      ?
str         ends
;

cntry       struc                       ;country info. sturctrue
ctry_code       dw      ?
code_page       dw      ?
dformat         dw      ?
curr_sym        db      5  dup(?)
thous_sep       db      2  dup(?)
decimal_sep     db      2  dup(?)
date_sep        db      2  dup(?)
time_sep        db      2  dup(?)
bit_field       dw      ?
curr_cents      dw      ?
tformat         dw      ?
map_call        dd      ?
data_sep        dw      ?
ra                      5  dup(?)
cntry       ends
;

Doscntry       struc                       ;country info. sturctrue
 Ddformat         dw      ?
 Dcurr_sym        db      5  dup(?)
 Dthous_sep       db      2  dup(?)
 Ddecimal_sep     db      2  dup(?)
 Ddate_sep        db      2  dup(?)
 Dtime_sep        db      2  dup(?)
 Dbit_field       db      ?
 Dsig_digit       db      ?
 Dtformat         db      ?
 Dmap_call        dd      ?
 Ddata_sep        dw      ?
 DResv                    5  dup(?)
Doscntry       ends


dosgetctryinfo  proc far

        Enter   Dosgetcntryinfo

        lds     si,[bp].CountryCodePtr
        mov     ax,ds:[si]

        cmp     ax,256                ;16 bit country code
        jc      getinfo

        mov     bx,ax                 ;if so, load into bx
        mov     al,0ffH               ;and tell DOS

getinfo:
        mov     dx,seg buffer
        mov     ds,dx
        assume  ds:buffer
        mov     dx,offset buffer:CountryInfo

        mov     ah,38h          ; remember: the al value was set above!!!
        int     21h
        jc      ErrorExit
;
        mov     si,offset buffer:CountryInfo
        les     di,[bp].BufferPtr
        cld                            ;string move op.

        mov     cx,[bp].BufferLength  ;length to move

        rep     movsb                 ;copy all to output area

        mov     cx,[bp].BufferLength  ;was buffer larger than pc-dos gave us?
        sub     cx,34
        jc      NoFillNecessary

        les     di,[bp].BufferPtr
        add     di,34

        mov     al,0                  ;fill with zeroes
        rep     stosb
;
NoFillNecessary:
        sub     ax,ax

ErrorExit:
        Mexit

        ret     size str - 6
;
dosgetctryinfo endp

dosxxx      ends

            end