⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chipstc.lst

📁 测试 CPU和NDP 的型号.zip
💻 LST
📖 第 1 页 / 共 2 页
字号:
    146                              ; OTHERWISE....
    147                              ;   Here's the BIG one.... 'tells the difference between an 80286 and
    148                              ;   an 80386 !!
    149
    150 0026  B8 7000                        mov    AX, 07000h     ; try to set FLAG bits 12 thru 14
    151                                                            ;   - NT, IOPL
    152 0029  50                             push   AX             ; put it onto the stack
    153 002A  9D                             popf                  ;   and try to pump 07000H into Ur flags
    154 002B  9C                             pushf                 ; push Ur flags, again
    155 002C  58                             pop    AX             ;   and bring back AX for a compare
    156 002D  25 7000                        and    AX,07000h      ; if Ur bits 12 thru 14 are set
    157 0030  75 05                          jnz    got386         ;   then Ur workin' with an 80386
    158 0032  BA 0118                        mov    DX, 0280       ; save 280 in DX cuz it's an 80286
    159 0035  EB 23                          jmp    SHORT CPUbye   ;   and bail out
    160
    161 0037  BA 017C                got386: mov    DX, 0380       ; save 380 in DX cuz it's an Intel 80386
    162 003A  EB 1E                          jmp    SHORT CPUbye   ;   and bail out
    163
    164                              ; here's we try to figger out whether it's an 80188/80186, an 8088/8086
    165                              ;   or an NEC V20/V30 - 'couple of slick tricks from Clif Purkiser.....
    166
    167 003C  B8 FFFF                dig:    mov    AX, 0ffffh     ; load up AX
    168 003F  B1 21                          mov    CL, 33         ; HERE's the FIRST TRICK.... this will
Turbo Assembler  Version 1.0        02-09-90 21:24:44         Page 4
CHIPSTC.ASM
chips() - CPU and Math Coprocessor (NDP) Type Check

    169                                                            ;   shift everything 33 times if it's
    170                                                            ;   8088/8086, or once for a 80188/80186!
    171 0041  D3 E0                          shl    AX, CL         ; on a shift of 33, all bits get zeroed
    172 0043  74 05                          jz     digmor         ;   out so if anything is left ON it's
    173                                                            ;   gotta be an 80188/80186
    174 0045  BA 00B4                        mov    DX,0180        ; save 180 in DX cuz it's an 80188/80186
    175 0048  EB 10                          jmp    SHORT CPUbye   ;   and bail out
    176
    177 004A  32 C0                  digmor: xor    AL,AL          ; clean out AL to set ZF
    178 004C  B0 40                          mov    AL,40h         ; ANOTHER TRICK.... mul on an NEC duz NOT
    179 004E  F6 E0                          mul    AL             ;   effect the zero flag BUT on an Intel
    180 0050  74 05                          jz     gotNEC         ;   8088/8086, the zero flag gets thrown
    181 0052  BA 0050                        mov    DX,0080        ; 80 into DX cuz it's an Intel 8088/8086
    182 0055  EB 03                          jmp    SHORT CPUbye   ;   and bail out
    183
    184 0057  BA 00C8                gotNEC: mov    DX,0200        ; it's an NEC V20/V30 so save 200 in DX
    185
    186 005A  9D                     CPUbye: popf                  ; putchur flags back to where they were
    187 005B  C3                             ret                   ;   and go back to where you came from
    188                                                            ;   (i.e., ===>  _chips) with the CPU type
    189                                                            ;   tucked away in DX for future reference
    190 005C                         cpu_type       endp
    191
    192                              ; Check for an NDP.
    193                              ;
    194                              ; >>>>NOTE:  If you are using an MASM version < 5.0, don't forget to
    195                              ; use the /R option or you will bomb cuz of the coprocessor instruc-
    196                              ; tions.  /R is not needed for version 5.0.<<<<<<<<<<<<<<<<<<<<<<<<<
    197
    198 005C                         ndp_type       PROC NEAR
    199
    200 005C  DB E3                  do_we:  fninit                          ; try to initialize the NDP
    201 005E  2E: C6 06 0001r 00             mov    byte ptr control+1,0     ; clear memory byte
    202 0064  2E: D9 3E 0000r                fnstcw control                  ; put control word in memory
    203 0069  2E: 8A 26 0001r                mov    AH,byte ptr control+1    ; iff AH is 03h, you got
    204 006E  80 FC 03                       cmp    AH,03h                   ;   an NDP on board !!
    205 0071  74 04                          je     chk_87                   ; found somethin', keep goin'
    206 0073  33 C0                          xor    AX,AX                    ; clean out AX to show a zero
    207 0075  EB 4F                          jmp    SHORT NDPbye             ;   return (i.e., no NDP)
    208
    209                              ; 'got an 8087 ??
    210
    211 0077  2E: 81 26 0000r FF7F   chk_87: and    control,NOT 0080h        ; turn ON interrupts (IEM = 0)
    212 007E  9B 2E: D9 2E 0000r             fldcw  control                  ; load control word
    213 0084  9B DB E1                       fdisi                           ; turn OFF interrupts (IEM = 1)
    214 0087  9B 2E: D9 3E 0000r             fstcw  control                  ; store control word
    215 008D  2E: F7 06 0000r 0080           test   control,0080h            ; iff IEM=1, 8087
    216 0094  74 05                          jz     chk287                   ; 'guess not!  March on....
    217 0096  B8 0001                        mov    AX,0001                  ; set up for a 1 return to
    218 0099  EB 2B                          jmp    SHORT NDPbye             ;   show an 8087 is on board
    219
    220                              ; if not.... would you believe an 80287 maybe ??
    221
    222 009B  9B DB E3               chk287: finit                 ; set default infinity mode
    223 009E  9B D9 E8                       fld1                  ; make infinity
    224 00A1  9B D9 EE                       fldz                  ;   by dividing
Turbo Assembler  Version 1.0        02-09-90 21:24:44         Page 5
CHIPSTC.ASM
chips() - CPU and Math Coprocessor (NDP) Type Check

    225 00A4  9B DE F9                       fdiv                  ;   1 by zero !!
    226 00A7  9B D9 C0                       fld    st             ; now make a
    227 00AA  9B D9 E0                       fchs                  ;   negative infinity
    228 00AD  9B DE D9                       fcompp                ; compare Ur two infinities
    229 00B0  9B 2E: DD 3E 0000r             fstsw  control        ; iff, for 8087 or 80287
    230 00B6  9B                             fwait                 ; sit tight 'til status word is put away
    231 00B7  2E: A1 0000r                   mov    AX,control     ; getchur control word
    232 00BB  9E                             sahf                  ; putchur AH into flags
    233 00BC  75 05                          jnz    got387         ; NO GOOD.... march on !!
    234 00BE  B8 0002                        mov    AX,0002        ; gotta be a 80287 cuz we already tested
    235 00C1  EB 03                          jmp    SHORT NDPbye   ;   for an 8087
    236
    237                              ; We KNOW that there is an NDP on board otherwise we would have bailed
    238                              ; out after 'do_we'.  It isn't an 8087 or an 80287 or we wouldn't have
    239                              ; gotten this far.  It's gotta be an 80387 !!
    240
    241 00C3  B8 0003                got387: mov    AX,0003        ; call it an 80387 and return 3
    242
    243 00C6  C3                     NDPbye: ret                   ; and go back where you came from
    244                                                            ;   (i.e., ===>  _chips) carrying the NDP
    245                                                            ;   type in Ur AX register
    246 00C7                         ndp_type       endp
    247
    248 00C7                         _TEXT   ENDS
    249
    250                              ;
    251                              ; The following lines are required for TurboC 2.0:
    252                              ;
    253
    254                              DGROUP  GROUP _DATA
    255
    256 0000                         _DATA   SEGMENT WORD PUBLIC 'DATA'
    257 0000                         _DATA   ENDS
    258
    259                                      END
Turbo Assembler  Version 1.0        02-09-90 21:24:44         Page 6
Symbol Table


Symbol Name                       Type   Value

??date                            Text   "02-09-90"
??filename                        Text   "CHIPSTC "
??time                            Text   "21:24:43"
??version                         Number 0100
@Cpu                              Text   0101H
@FileName                         Text   CHIPSTC
@WordSize                         Text   2
@curseg                           Text   _DATA
CPUbye                            Near   _TEXT:005A
NDPbye                            Near   _TEXT:00C6
_chips                            Near   _TEXT:0000
chk287                            Near   _TEXT:009B
chk_87                            Near   _TEXT:0077
control                           Word   _TEXT:0000
cpu_type                          Near   _TEXT:0015
dig                               Near   _TEXT:003C
digmor                            Near   _TEXT:004A
do_we                             Near   _TEXT:005C
got386                            Near   _TEXT:0037
got387                            Near   _TEXT:00C3
gotNEC                            Near   _TEXT:0057
ndp_type                          Near   _TEXT:005C

Groups & Segments                 Bit Size Align  Combine Class

DGROUP                            Group
  _DATA                           16  0000 Word   Public  DATA
_TEXT                             16  00C7 Byte   Public  CODE


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -