]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/CMD/MODE/MODELENG.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / CMD / MODE / MODELENG.ASM
1 PAGE ,132 ;\ f
2 TITLE MODELENG.ASM - VARIOUS SERVICE ROUTINES
3
4 ;This module contains procedures:
5 ;MODELENG - convert 3 digit or less ASCII string to binary number
6 ;GET_MACHINE_TYPE - determine the machine type based on model byte and sub model byte
7
8 .XLIST
9 INCLUDE STRUC.INC
10 .LIST
11 ;.SALL
12
13 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P R O L O G ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
14 ;º º
15
16 ; AX001 - P4031: Was allowing rate and delay settings on ATs that did not have
17 ; the functionality in the BIOS. Have to check specifically for
18 ; a date of 11/15/85 or later.
19
20 ; AX002 - P4543: Add VAIL and SNOWMASS to legal choices for 19200 baud
21
22 ;º º
23 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P R O L O G ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
24
25
26
27 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P U B L I C S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
28 ;º º
29
30 PUBLIC get_machine_type
31 PUBLIC MODELENG
32
33 ;º º
34 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P U B L I C S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
35
36 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ M A C R O S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
37 ;º º
38
39 BREAK MACRO destination ;AN001;
40
41 JMP ENDCASE_&destination ;AN001;
42
43 ENDM ;AN001;
44
45 ;º º
46 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ M A C R O S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
47
48
49 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E Q U A T E S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
50 ;º º
51
52 AT_or_XT286_or_PS2_50_or_PS2_60 EQU 0FCH ;AN000;primary model byte for all 286 based machines
53 BIOS_date EQU ES:[DI] ;used for accessing parts of the BIOS date ;AN001;
54 INTCONV EQU 48 ;CONVERT ASCII TO NUMERIC
55 model_byte_AH EQU AH
56 return_system_configuration EQU 0C0H ;INT 15H subfunction
57 system_descriptor_table EQU ES:[BX]
58 system_services EQU 15H ;ROM BIOS call
59 XT2 EQU 0FBH ;AN000;model byte for 2nd release of XT
60
61 INCLUDE modequat.inc
62
63 ;º º
64 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E Q U A T E S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
65
66
67 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ S T R U C T U R E S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
68 ;º º
69
70 BIOS_date_struc STRUC ;in form mm/dd/yy ;AN001;
71 month DW ? ;AN001;
72 slash1 DB ? ;AN001;
73 day DW ? ;AN001;
74 slash2 DB ? ;AN001;
75 year DW ? ;AN001;
76 BIOS_date_struc ENDS ;AN001;
77
78
79 system_descriptor STRUC
80 length_of_descriptor DW bogus ;number of bytes in the descriptor table
81 primary_model_byte DB bogus
82 secondary_model_byte DB bogus
83 system_descriptor ENDS
84
85 ;º º
86 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ S T R U C T U R E S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
87
88
89 ROM SEGMENT AT 0F000H
90
91 ORG 0FFF5H ;location of date ROM BIOS for the release was written ;AN001;
92 date_location LABEL WORD ;AN001;
93
94 ORG 0FFFEH
95 model_byte LABEL BYTE
96
97 ROM ENDS
98
99
100
101 PRINTF_CODE SEGMENT PUBLIC
102 ASSUME CS:PRINTF_CODE,DS:PRINTF_CODE
103
104
105
106 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ D A T A ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
107 ;º º
108
109 HUNDRED DB 100
110 TEN DB 10
111
112
113 ;º º
114 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ D A T A ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
115
116
117 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E X T R N S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
118 ;º º
119
120 EXTRN machine_type:BYTE ;see 'rescode.sal'
121 EXTRN submodel_byte:BYTE ;see 'rescode.sal'
122
123 ;º º
124 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E X T R N S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
125
126
127 MODELENG PROC NEAR
128 ;
129 ;INPUT:BP HAS ADDR OF PARM FIELD IN DATA SPACE (DS:)
130 ;
131 MOV BL,0 ;INIT BL TO 0
132 ; IF THIS PARAMETER IS A THREE DIGIT NUMBER,
133 CMP BYTE PTR DS:[BP]+2,0 ;LOOK AT THIRD DIGIT
134 JE ENDIF01
135 CMP BYTE PTR DS:[BP]+2,20H ;see if third char is a blank
136 JE ENDIF01 ;IF there is a third digit THEN
137 ;
138 MOV AL,DS:[BP] ;GET FIRST DIGIT
139 SUB AL,INTCONV ;CONVERT TO INT
140 MUL HUNDRED ;HUNDREDTHS PLACE
141 ADD BL,AL ;ADD TO BL
142 INC BP ;BUMP TO NEXT DIGIT
143 ENDIF01: ;ENDIF THIS PARAMETER IS A THREE DIGIT NUMBER
144 MOV AL,DS:[BP] ;GET NEXT DIGIT
145 SUB AL,INTCONV ;CONVERT TO INT
146 JNC ENDIF02
147 MOV BL,0FFH ;encountered an error so put a bogus number in the sum
148 ENDIF02:
149 MUL TEN ;TENS PLACE
150 ADD BL,AL ;ADD TO BL
151 INC BP ;GO TO NEXT DIGIT
152 MOV AL,DS:[BP] ;GET NEXT DIGIT
153 SUB AL,INTCONV ;CONVERT TO INT
154 ADD BL,AL ;ADD TO BL
155 RET
156 MODELENG ENDP
157
158
159 ascii_to_int PROC NEAR ;input: AX=2 digit ascii number ;AN001;
160 ;output: BL has binary value ;AN001;
161 ;assume: no overflow or underflow ;AN001;
162
163 PUSH AX ;the MUL destroys AH ;AN001;
164 SUB AL,INTCONV ;CONVERT high order digit to binary ;AN001;
165 MUL TEN ;TENS PLACE ;AN001;
166 MOV BL,AL ;ADD TO BL ;AN001;
167 POP AX ;AN001;
168 MOV AL,AH ;AL=low order digit ;AN001;
169 SUB AL,INTCONV ;CONVERT TO binary ;AN001;
170 ADD BL,AL ;ADD TO BL ;AN001;
171 RET ;AN001;
172
173 ascii_to_int ENDP ;AN001;
174
175
176 ;------------------------------------------------------------------------------
177
178 ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
179
180 ;³ GET_MACHINE_TYPE
181 ;³ ----------------
182
183 ;³ Get the machine type and store for future reference.
184
185
186 ;³ INPUT: none
187
188
189 ;³ RETURN: A scalar value indicating the type of machine is stored in
190 ;³ 'machine_type'.
191
192
193 ;³ MESSAGES: none
194
195
196
197 ;³ REGISTER
198 ;³ USAGE AND
199 ;³ COMVENTIONS: AX - general usage
200 ;³ BX - used to address the system descriptor table
201
202
203
204
205
206 ;³ ASSUMPTIONS: DS has segment of MODE's data area
207
208
209 ;³ SIDE EFFECT: ES is changed.
210
211
212 ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
213
214
215 get_machine_type PROC NEAR
216
217
218
219 PUSH ES
220 PUSH BX ;will be used to point to 'system descriptor table'
221 MOV AH,return_system_configuration
222 INT 15H
223 .IF NC ;IF the call was handled successfully
224 MOV AH,system_descriptor_table.secondary_model_byte
225 MOV submodel_byte,AH ;save submodel byte
226 MOV AH,system_descriptor_table.primary_model_byte
227 .ELSE
228 MOV AX,ROM ;get addressability to the model byte
229 MOV ES,AX
230 MOV AH,ES:model_byte
231 .ENDIF
232
233 .IF <model_byte_AH EQ AT_or_XT286_or_PS2_50_or_PS2_60> THEN ;AN000;may have a submodel byte, check it
234
235 .IF <submodel_byte EQ PS2Model60> THEN ;AN000;
236 MOV AH,PS2Model60 ;AN000;
237 .ELSEIF <submodel_byte EQ VAIL> OR ;AN000;
238 .IF <submodel_byte EQ PS2Model50> THEN ;AN000;
239 MOV AH,PS2Model50 ;AN000;
240 .ELSEIF <submodel_byte EQ XT286> THEN ;AN000;
241 MOV AH,XT286 ;AN000;
242 .ELSEIF <submodel_byte EQ AT3> THEN ;AN000;
243 MOV DI,OFFSET date_location ;ES:DI=>BIOS date (BIOS_date EQU ES:[DI]) ;AN001;
244
245 ; CASE BIOS_date= ;AN001;
246
247 ; later than 1985: ;AN001;
248
249 MOV AX,BIOS_date.year ;AX=ASCII form of BIOS date year ;AN001;
250 CALL ascii_to_int ;BL=binary form of BIOS date year ;AN001;
251 .IF <BL GT 85> THEN ;IF AT built in 86 or later ;AN001;
252
253 MOV AH,AT4 ;AN001;
254 BREAK 0 ;AN001;
255
256 .ENDIF ;AN001;
257
258 ; 1985, on 11/15: ;BL already has year from above check ;AN001;
259
260 .IF <BL EQ 85> AND ;AN001;
261 .IF <BIOS_date.month EQ "11"> AND ;AN001;
262 .IF <BIOS_date.day EQ "51"> THEN ;"51" is the word form of "15" ;AN001;
263
264 MOV AH,AT4 ;AN001;
265 BREAK 0 ;AN001;
266
267 .ENDIF ;AN001;
268
269 ; otherwise: ;internal release of third version of AT ;AN001;
270
271 MOV AH,AT3 ;AN001;
272
273
274 ENDCASE_0: ;AN001;
275
276 .ELSEIF <submodel_byte EQ AT2> THEN ;AN000;
277 MOV AH,AT2 ;AN000;
278 .ENDIF ;AN000;IF none of the above AH has correct value for AT1 (FC)
279 .ELSEIF <model_byte_AH EQ XT2> THEN ;AN000;
280 MOV AH,PCXT ;AN000;no difference from XT1
281 .ENDIF ;AN000;
282
283 MOV DS:machine_type,AH ;AH was set as result of getting the system configuration or during the IF.
284 POP BX
285 POP ES
286
287 RET ;RETURN TO MODE MAIN ROUTINE
288 get_machine_type ENDP
289 PRINTF_CODE ENDS
290 END