home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 1.ddi / MWHC.001 / Q < prev    next >
Encoding:
Text File  |  1992-12-09  |  4.2 KB  |  193 lines

  1. small_m = 1
  2. mach386 = 1
  3. GOC = 1
  4. ;
  5. ; (C) Copyright 1987-1992;    MetaWare Incorporated
  6. ;
  7.     .287
  8.  
  9.     include init.inc
  10.  
  11. _TEXT    segment dword public 'CODE'
  12. _TEXT    ends
  13.  
  14. _DATA    segment dword public 'DATA'
  15.     extrn    _mw1167:word
  16.     extrn    _mwemc87:word
  17.     extrn    _mwenv:byte
  18.     extrn    _mwoops:byte
  19.     extrn    _mwwind:byte
  20.     extrn    _mwprintnochipmsg:byte
  21.  
  22. used    dw    0    ; set if a '67 chip is used
  23.  
  24. _DATA    ends
  25. DGROUP    group    _DATA
  26.     assume    ds:DGROUP
  27.  
  28. _TEXT    segment dword public 'CODE'
  29. CGROUP  group    _TEXT
  30.         assume cs:CGROUP
  31.  
  32. ;-------------------------------------------------------------------------------
  33. ; _mwinit_67()
  34. ;-------------------------------------------------------------------------------
  35. _mwinit_67 proc
  36.     public    _mwinit_67
  37.     jmp    begin
  38.  
  39. _mwinit_67u:
  40.     public  _mwinit_67u
  41.     mov    used,1
  42.  
  43. begin:
  44.     prolog
  45.     cmp    _mw1167,0
  46.     jne    endall        ; nothing to do
  47.  
  48. SG_ENV = 1
  49. PL_ENV = 2
  50. AI_ENV = 3
  51.  
  52. ifndef  NOWTK
  53. ifdef   DOS
  54.     ; Deal with Weitek 1167
  55.     ; Pharlap uses fs:; IGC uses ffc0_0000.
  56.     ; We don't know yet whether this is AI_ENV and what they do with
  57.     ; the Weitek.
  58.  
  59.         ; Early versions of the emc87 will hang if given weitek code.
  60.     extrnf    _mwinit_87
  61.     call    _mwinit_87
  62.     cmp    byte ptr _mwemc87,1
  63.     je    Skip_all_weitek_processing
  64.  
  65.     ; For windows, we have to look for the chip, and set up fs if
  66.     ; it is there.  A selector value for fs is put at ss:0 by the
  67.     ; windows startup code.  We just move this selector into fs.
  68.     cmp    _mwwind,1
  69.     jne    start_test
  70.     int    11h    ; get bios equipment list
  71.     and    eax,01000000h    ; bit 24 set if weitek exists
  72.     jz    Skip_all_weitek_processing
  73.     mov    fs,ss:0
  74.  
  75. start_test:
  76.  
  77. seg_ldctx macro
  78.     ; pop    fs:[0c000h]
  79.     ; Until the assembler will allow address mode override, inline code a 1-byte-shorter move:
  80.     db      67h,64h,8fh,06h,00,0c0h
  81.     endm
  82. seg_stctx macro
  83.     db      67h,64h,0a1h,00h,0c4h   ; store context to eax.
  84.     endm
  85. flat_ldctx macro
  86.     pop     ds:[0ffc0c000h]
  87.     endm
  88. flat_stctx macro
  89.     pop     ds:[0ffc0c400h]
  90.     endm
  91.  
  92.     push     03ff0000h      ; truncate (1ff = round to nearest).
  93.     push     30000000h      ;
  94.     push    0a0000000h      ; 1165 accum timer
  95.     push     64000000h      ; 1164 accum timer
  96.     push     16000000h      ; 1164/1165 flowthrough timer, 16 mhz
  97.     push     98000000h      ; 20 mhz part init
  98.     push     56000000h      ; 20 mhz part
  99.     push    0b8000000h      ; test speed of chip.
  100.  
  101.     ; ldctx 1600_0000 1164/1165 flowthrough timer.
  102.     ; ldctx 6400_0000 1164 accumulate timer.
  103.     ; ldctx a000_0000 1165 accumulate timer.
  104.     ; ldctx 3000_0000 reserved mode bits.
  105.     ; ldctx 01ff_0000 rounding modes/exception mask.
  106. ifdef   IGC_exists
  107.     cmp     _mwenv,SG_ENV
  108.     je      short SG_weitek
  109. endif
  110. ifdef   PL_exists
  111.     ; Check that fs <> ds.  If so, Weitek installed at fs:.
  112.     mov     ax,fs
  113.     mov     bx,ds
  114.     cmp     ax,bx
  115.     je      No_weitek
  116.     and     ax,ax       ; If fs = 0 (Lahey linker), can't have Weitek.
  117.     je      No_weitek
  118.     mov     _mw1167,1
  119.     ; Until the assembler will allow address mode override, inline code a 1-byte-shorter move:
  120.     seg_ldctx         ; load ctx b8_000_000
  121.     seg_stctx         ; store context to eax.
  122.     and     ah,80h
  123.     jnz     short _20MHZ_part
  124.     pop     eax         ; Delete 20 mhz init stuff.
  125.     pop     eax
  126.     seg_ldctx
  127.     jmp     short common_1167
  128. _20MHZ_part:
  129.     seg_ldctx
  130.     seg_ldctx
  131.     pop     eax         ; Kill the 16 mhz init.
  132. common_1167:
  133.     seg_ldctx
  134.     seg_ldctx
  135.     seg_ldctx
  136.     seg_ldctx
  137.     jmp     short Finish_weitek
  138. endif
  139. SG_weitek:
  140. ifdef   IGC_exists
  141.     cmp     byte ptr _mw1167,1
  142.     jne     short No_weitek
  143.     flat_ldctx         ; for test.
  144.     flat_stctx         ; store context to eax.
  145.     and     ah,80h
  146.     jnz     short _20MHZ_part_flat
  147.     pop     eax         ; Delete 20 mhz init stuff.
  148.     pop     eax
  149.     flat_ldctx
  150.     jmp     short common_1167_flat
  151. _20MHZ_part_flat:
  152.     flat_ldctx
  153.     flat_ldctx
  154.     pop     eax         ; Kill the 16 mhz init.
  155. common_1167_flat:
  156.     flat_ldctx
  157.     flat_ldctx
  158.     flat_ldctx
  159.     flat_ldctx
  160.     flat_ldctx
  161.     jmp     short Finish_weitek
  162. endif
  163. No_weitek:
  164.     add     esp,8*4     ; Get rid of the junk.
  165. Skip_all_weitek_processing:
  166.  
  167.     cmp    used,0
  168.     je    Finish_weitek
  169.     cmp    _mwwind,1
  170.     jne    doserr
  171.     mov    _mwprintnochipmsg,1
  172.     jmp    short Finish_weitek
  173.  
  174. doserr:
  175.     mov    ah,9
  176.     mov    edx,offset ds:_mwoops
  177.     call    _mwint21
  178.     extrnf    exit
  179.     call    exit
  180.  
  181. Finish_weitek:
  182.  
  183.  
  184. endif
  185. endif
  186.  
  187. endall:
  188.     epilog
  189. _mwinit_67 endp
  190.  
  191. _TEXT    ends
  192.     end
  193.