2 TITLE MODELENG
.ASM
- VARIOUS SERVICE ROUTINES
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
13 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P R O L O G ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
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.
20 ; AX002 - P4543: Add VAIL and SNOWMASS to legal choices for 19200 baud
23 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P R O L O G ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
27 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P U B L I C S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
30 PUBLIC get_machine_type
34 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ P U B L I C S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
36 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ M A C R O S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
39 BREAK MACRO destination
;AN001;
41 JMP ENDCASE_
&destination
;AN001;
46 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ M A C R O S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
49 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E Q U A T E S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
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
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
64 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E Q U A T E S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
67 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ S T R U C T U R E S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
70 BIOS_date_struc
STRUC ;in form mm/dd/yy ;AN001;
76 BIOS_date_struc ENDS
;AN001;
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
86 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ S T R U C T U R E S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
91 ORG 0FFF5H ;location of date ROM BIOS for the release was written ;AN001;
92 date_location
LABEL WORD ;AN001;
101 PRINTF_CODE
SEGMENT PUBLIC
102 ASSUME
CS:PRINTF_CODE
,DS:PRINTF_CODE
106 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ D A T A ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
114 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ D A T A ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
117 ;ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E X T R N S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
120 EXTRN machine_type
:BYTE ;see 'rescode.sal'
121 EXTRN submodel_byte
:BYTE ;see 'rescode.sal'
124 ;ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ E X T R N S ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
129 ;INPUT:BP HAS ADDR OF PARM FIELD IN DATA SPACE (DS:)
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
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
138 MOV AL,DS:[BP] ;GET FIRST DIGIT
139 SUB AL,INTCONV
;CONVERT TO INT
140 MUL HUNDRED
;HUNDREDTHS PLACE
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
147 MOV BL,0FFH ;encountered an error so put a bogus number in the sum
151 INC BP ;GO TO NEXT DIGIT
152 MOV AL,DS:[BP] ;GET NEXT DIGIT
153 SUB AL,INTCONV
;CONVERT TO INT
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;
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;
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;
173 ascii_to_int ENDP
;AN001;
176 ;------------------------------------------------------------------------------
178 ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
183 ;³ Get the machine type and store for future reference.
189 ;³ RETURN: A scalar value indicating the type of machine is stored in
199 ;³ COMVENTIONS: AX - general usage
200 ;³ BX - used to address the system descriptor table
206 ;³ ASSUMPTIONS: DS has segment of MODE's data area
209 ;³ SIDE EFFECT: ES is changed.
212 ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
215 get_machine_type PROC
NEAR
220 PUSH BX ;will be used to point to 'system descriptor table'
221 MOV AH,return_system_configuration
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
228 MOV AX,ROM
;get addressability to the model byte
233 .IF <model_byte_AH
EQ AT_or_XT286_or_PS2_50_or_PS2_60
> THEN
;AN000;may have a submodel byte, check it
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;
242 .ELSEIF
<submodel_byte
EQ AT3
> THEN
;AN000;
243 MOV DI,OFFSET date_location
;ES:DI=>BIOS date (BIOS_date EQU ES:[DI]) ;AN001;
245 ; CASE BIOS_date= ;AN001;
247 ; later than 1985: ;AN001;
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;
258 ; 1985, on 11/15: ;BL already has year from above check ;AN001;
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;
269 ; otherwise: ;internal release of third version of AT ;AN001;
276 .ELSEIF
<submodel_byte
EQ AT2
> THEN
;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
283 MOV DS:machine_type
,AH ;AH was set as result of getting the system configuration or during the IF.
287 RET ;RETURN TO MODE MAIN ROUTINE
288 get_machine_type ENDP