Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

872 lines
20 KiB

  1. ;** SYSTEM.ASM **********************************************************
  2. ; *
  3. ; Copyright (C) 1983,1984,1985,1986,1987,1988 by Microsoft Inc. *
  4. ; *
  5. ;************************************************************************
  6. ; History
  7. ; 18 oct 88 peterbe Added fBootDrive and test for it,
  8. ; for diskless workstations.
  9. ;************************************************************************
  10. TITLE SYSTEM - InquireSystem procedure to return info about devices
  11. include system.inc
  12. ;; AT&T Machines running DOS 3.10, revisions 1.0 and 1.01 place
  13. ;; this value into SingleDriveLoc
  14. ATT31Loc EQU 10d0h
  15. ifdef NEC_98
  16. IOSYSSEG EQU 0060H
  17. LPTABLEOFF EQU 006CH
  18. EXLPTABLE EQU 2C86H ;EXPANDED LPTABLEOFF
  19. SNGDRV_FLG EQU 0038H
  20. BIOS_FLAG EQU ES:BYTE PTR[0100H] ; offset by seg 40h
  21. BIOS_FLAG1 EQU ES:BYTE PTR[0080H] ; "
  22. EX_CPU_TYPE EQU 00001000B
  23. V30_BIT EQU 01000000B
  24. BIT286 EQU 00000001B
  25. endif ; NEC_98
  26. MultHIMEM EQU 43h ; HIMEM.SYS int 2fh multiplex
  27. MHM_ReqInstall EQU 00h ; Installation check
  28. MHM_ReqInstall_Ret EQU 0FFh ; I'm here Return
  29. ifndef NEC_98
  30. externA __ROMBIOS
  31. endif ; NEC_98
  32. externA __0040h
  33. externFP NoHookDOSCall
  34. ifdef NEC_98
  35. externFP GetPrivateProfileInt ; 930206
  36. endif ; NEC_98
  37. ifdef HPSYSTEM
  38. ExternNP <EnableVectra, DisableVectra> ;~~vvr 091989
  39. endif
  40. assumes CS,CODE
  41. sBegin DATA
  42. externB timerTable
  43. ;
  44. ; InquireSystem(what,which) - returns oem specific information
  45. ; what is the code for the device
  46. ; which specifies which one of those devices
  47. ;
  48. ; WHAT = 0 Timer resolution
  49. ; Return the resolution of the timer specified by the which
  50. ; parameter in DX:AX. Windows always uses which == 0
  51. ;
  52. ; WHAT = 1 Disk Drive Information (Drive A = 0)
  53. ; which is the disk drive (A = 0)
  54. ; Returns:
  55. ; ax = 0 means the drive does not exist. if dx != 0 then the drive
  56. ; maps to the drive in dx instead (A = 1) AND the drive is
  57. ; REMOVEABLE.
  58. ; ax = 1 means the drive does not exist. if dx != 0 then the drive
  59. ; maps to the drive in dx instead (A = 1) AND the drive is
  60. ; FIXED.
  61. ; ax = 2 means the drive is removable media
  62. ; ax = 3 means the drive is fixed media
  63. ; ax = 4 means the drive is fixed media and remote
  64. ;
  65. ; WHAT = 2 Enable/Disable one drive logic
  66. ; which = 0 means disable, which <> 0 means enable
  67. ; This code enables/disables the RAM BIOS message:
  68. ; "Please insert disk for drive B:"
  69. ;
  70. ifdef NEC_98
  71. ; WHAT = 3 Coprocessor exception vector information
  72. ; which is unused.
  73. ; Returns:
  74. ; ax = 1 means we must save & restore coprocessor error vector
  75. ; ( really,always return 1 )
  76. ; dx : coprocessor exception interrrupt vector number
  77. ;
  78. endif ; NEC_98
  79. ;
  80. ; The following flag deals with some unpleasantness in the fast boot code.
  81. ; The fast boot code delays our INIT call till to late because some code
  82. ; in KERNEL which uses InquireSystem is called first. We fix this problem
  83. ; with this flag......
  84. ;
  85. globalB SystemIsInited,0
  86. ; Following from RAMDRIVE
  87. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  88. ; Unfortunately the code in ramdrive is very machine dependent
  89. ; necessitating the use of a system flag to store the machine
  90. ; configuration. The system flag is initialised during init time
  91. ; and used when the caching services are requested. One bit which
  92. ; is set and tested during caching is the state of the a20 line
  93. ; when the cache code is entered. This is used because there are
  94. ; applications which enable the a20 line and leave it enabled
  95. ; throughout the duration of execution. Since ramdrive is a device
  96. ; driver it shouldn't change the state of the environment.
  97. ;
  98. ; The system flag bit assignments are:
  99. ;
  100. ; -------------------------------------------------
  101. ; | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
  102. ; -------------------------------------------------
  103. ; |-----| | | | | | |
  104. ; | | | | | | -----286 (and AT)
  105. ; | | | | | -----------386 (later than B0)
  106. ; not | | | -----------------PS/2 machine
  107. ; used | | -----------------------Olivetti (not used)
  108. ; | -----------------------------A20 state (enabled ?)
  109. ; -----------------------------------DOS 3.x >= 3.3
  110. ; The Olivetti guys have defined a flag of their own. This should be removed
  111. ; and the bit assigned out here for them should be used.
  112. ;
  113. sys_flg db 0
  114. ;
  115. ; equates used for the system flag
  116. ;
  117. M_286 equ 00000001B
  118. M_386 equ 00000010B
  119. M_PS2 equ 00000100B
  120. M_OLI equ 00001000B
  121. A20_ST equ 00010000B
  122. DOS_33 equ 00100000B
  123. HAVE_FFFE equ 01000000B
  124. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  125. ; A20 address line state determination addresses
  126. ;
  127. low_mem label dword
  128. dw 20h*4
  129. dw 0
  130. high_mem label dword
  131. dw 20h*4 + 10h
  132. dw 0ffffh
  133. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  134. ; A20 PS2 equates
  135. ;
  136. PS2_PORTA equ 0092h
  137. GATE_A20 equ 010b
  138. ; End RAMDRIVE stuff
  139. globalB numFloppies,0
  140. globalB fBootDrive,0
  141. globalB oneDriveFlag,0
  142. globalW coProcFlag,0
  143. globalD HiMem,0
  144. globalW DosVer,0
  145. ifdef NEC_98
  146. savelptable db 0
  147. NDP_CONTROL DW 0
  148. EMM_DEVICE_NAME DB "EMMXXXX0"
  149. PUBLIC EMM_FLAG
  150. EMM_FLAG DB 0
  151. DRVCNT DB 10H ;16 DRIVE
  152. PUBLIC reflected
  153. reflected DB 0 ; 0 not reflected 930206
  154. profinit DB 0 ; 0 is no initalized 930206
  155. endif ; NEC_98
  156. ;; SingleDriveLoc defaults to the value of SingleDrive (104h) on other
  157. ;; than AT&T machines. Otherwise the value is changed during
  158. ;; the execution of single drive enable/disable.
  159. SingleDriveLoc dw SingleDrive
  160. sEnd
  161. sBegin CODE
  162. GlobalW MyCSDS, _DATA
  163. ;-----------------------------------------------------------------------;
  164. ; InquireSystem
  165. ;
  166. ;
  167. ; Entry:
  168. ;
  169. ; Returns:
  170. ;
  171. ; Registers Destroyed:
  172. ;
  173. ; History:
  174. ; Mon 21-Nov-1988 14:57:21 -by- David N. Weise [davidw]
  175. ;
  176. ;-----------------------------------------------------------------------;
  177. assumes ds,nothing
  178. assumes es,nothing
  179. cProc InquireSystem,<FAR,PUBLIC,NODATA>
  180. parmW what
  181. parmW which
  182. cBegin
  183. push ds
  184. mov ds, MyCSDS
  185. assumes ds,DATA
  186. cmp SystemIsInited,0 ; Are we ready for this call?
  187. jnz DoInq ; Yes
  188. call far ptr InitSystem ; No, Set up
  189. DoInq:
  190. mov ax,what
  191. ;---------------------------------------
  192. ;
  193. ; Timer information
  194. ;
  195. or ax,ax
  196. jnz is1
  197. mov dx,res_high
  198. mov ax,res_low
  199. jmp ISDone
  200. ;---------------------------------------
  201. ;
  202. ; Drive information
  203. ;
  204. is1: dec ax ; ax = 1?
  205. jz DriveInfo
  206. jmp is5
  207. DriveInfo:
  208. mov ah,19h ; get the current disk
  209. cCall NoHookDOSCall
  210. mov bx,Which ; try to set to this disk
  211. cmp al,bl ; already there?
  212. jz DriveData ; yes, drive is good
  213. push ax
  214. mov dx,bx
  215. mov ah,0Eh ; set to new disk
  216. cCall NoHookDOSCall
  217. mov ah,19h ; get the current disk
  218. cCall NoHookDOSCall
  219. mov bh,al
  220. pop dx
  221. mov ah,0Eh ; restore current disk
  222. cCall NoHookDOSCall
  223. cmp bh,bl ; Drive good?
  224. jz DriveData ; yes
  225. jmp is9 ; no, this drive totally bad
  226. ; First check if this is network. We must do this first because
  227. ; the removeable and phantom IOCTL calls return errors if you feed
  228. ; them network drives. If it is network then we know it is non-removable
  229. ; and not phantom.
  230. DriveData:
  231. cmp DosVer,0400h
  232. jb no_4
  233. cmp DosVer,0401h
  234. ja no_4
  235. cCall Dos4IsRemote,<Which>
  236. or ax,ax
  237. jmp short well_is_it
  238. no_4: mov ax,4409h ; IOCTL is Remote
  239. mov bx,Which
  240. inc bx ; A = 1
  241. cCall NoHookDOSCall
  242. jc DoRem ; Call didn't work, go ahead
  243. test dx,0001000000000000B
  244. well_is_it:
  245. jz DoRem ; Drive is local
  246. mov cx,REMOTE ; Drive is not removeable
  247. jmp short NoRemap ; Drive is not phantom
  248. ; Now Check "removeability"
  249. DoRem:
  250. mov ax,4408h ; IOCTL is removeable
  251. mov bx,Which
  252. inc bx ; A = 1
  253. cCall NoHookDOSCall
  254. jc OLDRemove ; Call didn't work, use old method
  255. mov cx,FIXED
  256. test ax,1
  257. jnz DrivePhantom
  258. mov cx,REMOVEABLE
  259. ; The drive is removable ...
  260. ; This code accounts for the fact that the code above on a PS/2
  261. ; Mod 50 diskless workstation reports the existence of a floppy
  262. ; drive on A: or B: even if it's unplugged. If this is drive A:
  263. ; or B:, we need to test fBootDrive to see if this drive REALLY
  264. ; exists.
  265. ifdef NEC_98
  266. push es ; ins <91.01.14> Y.Ueno
  267. mov ax, 40h ; "
  268. mov es, ax ; "
  269. push si ; "
  270. mov si, Which ;
  271. mov al, byte ptr es:[si+26ch]
  272. and al, 0f0h
  273. cmp al, 0a0h
  274. pop si ;
  275. pop es ;
  276. jne DrivePhantom ;
  277. mov cx,FIXED ;
  278. else ; NEC_98
  279. cmp Which, 2 ; this isn't likely, but..
  280. jae DrivePhantom ; there ARE removable hard drives.
  281. test fBootDrive,1 ; Must be a floppy, does this system have any?
  282. jnz DrivePhantom ; if 0,
  283. jmp Is9 ; we assume there are none
  284. endif ; NEC_98
  285. ; Now check for phantom drives
  286. DrivePhantom:
  287. mov ax,440EH ; IOCTL get logical map
  288. mov bx,Which
  289. inc bx ; A = 1
  290. cCall NoHookDOSCall
  291. jc OLDPhantom ; Call didn't work, use old method
  292. or al,al ; If AL=0, drive is NOT phantom
  293. jz NoRemap
  294. cmp bl,al ; Drive maps to self?
  295. jz NoRemap ; Yes, drive is not phantom
  296. xor ah,ah
  297. mov dx,ax ; DX is real drive
  298. SetPhantomRet:
  299. xor ax,ax ; Set removeable return
  300. cmp cx,REMOVEABLE
  301. jz IsDoneV
  302. inc ax ; Set fixed return
  303. jmp short IsDoneV
  304. NoRemap:
  305. xchg ax,cx ; AX = type of drive
  306. xor dx,dx ; Indicate no remapping
  307. IsDoneV:
  308. jmp ISDone
  309. ; Check removeability with equipment word
  310. OLDRemove:
  311. ifdef NEC_98
  312. mov cx,FIXED
  313. else ; NEC_98
  314. xor ax,ax
  315. or al,numFloppies ; just one floppy on system?
  316. jnz OLDR1 ; no, continue
  317. inc ax ; pretend we have two floppies...
  318. OLDR1:
  319. cmp ax,which
  320. mov cx,FIXED
  321. jb DrivePhantom
  322. mov cx,REMOVEABLE
  323. endif ; NEC_98
  324. jmp short DrivePhantom
  325. ; Check phantomness with equipment word
  326. OLDPhantom:
  327. ifdef NEC_98
  328. jmp short NoRemap ; No, drive B is real
  329. else ; NEC_98
  330. cmp Which,1 ; Drive B is only phantom
  331. jnz NoRemap ; Not drive B, so not phantom
  332. cmp numFloppies,0 ; Single floppy system?
  333. jnz NoRemap ; No, drive B is real
  334. mov dx,1 ; Drive B is really drive A
  335. jmp short SetPhantomRet
  336. endif ; NEC_98
  337. ;---------------------------------------------------
  338. ;
  339. ; Single Floppy enable/disable
  340. ;
  341. is5: dec ax ; floppy enable disable?
  342. ifdef NEC_98
  343. jnz is9a ; "
  344. else ; NEC_98
  345. jnz is9
  346. endif ; NEC_98
  347. is5b: cmp which,0 ; 0=disable
  348. jnz is6
  349. ; Disable various OEM things
  350. cmp DosVer,0314h ; Below DOS 3.20?
  351. jae nosingdrv1 ; No, no ROM area diddle
  352. ;;
  353. ;; AT&T MS-DOS 3.10 does not keep information on the last floppy
  354. ;; drive accessed at 504h. The purpose of this section
  355. ;; of code is to locate the bytes and patch them accordingly.
  356. ;;
  357. ifndef NEC_98
  358. mov ax,__ROMBIOS ;; is this an AT&T machine ?
  359. mov es,ax ;; look for start of 'OLIVETTI'
  360. cmp es:[0C050h],'LO'
  361. jnz ATTCheckDone ;; No, continue
  362. mov SingleDriveLoc,ATT31Loc
  363. ATTCheckDone:
  364. mov ax,__0040h
  365. mov es,ax
  366. mov bx,SingleDriveLoc ;; set to drive A
  367. xor ah, ah ; set to drive A: also! (A=0)
  368. xchg ah,es:[bx]
  369. mov oneDriveFlag,ah ; remember previous setting
  370. endif ; NEC_98
  371. nosingdrv1:
  372. jmp short is9
  373. ; Enable various OEM things
  374. is6: cmp DosVer,0314h ; Below DOS 3.20?
  375. jae nosingdrv2 ; No, no ROM diddle
  376. ifndef NEC_98
  377. mov ax,__0040h
  378. mov es,ax
  379. mov bx,SingleDriveLoc ;; pointer to value
  380. mov ah,oneDriveFlag
  381. mov es:[bx],ah ;; restore to correct drive
  382. endif ; NEC_98
  383. nosingdrv2:
  384. ifdef NEC_98
  385. is9a:
  386. dec ax
  387. jz is9b ; what == 3 ?
  388. jmp is9
  389. is9b:
  390. push es
  391. mov ax,40h ; get ROM BIOS segment
  392. mov es,ax
  393. test BIOS_FLAG1,BIT286
  394. mov ax,1
  395. jz I_V30
  396. mov dx,10h ;80286/80386 coprocess error vector
  397. jmp short IOK
  398. I_V30:
  399. mov dx,16h ;8086/V30 coprocess error vector
  400. IOK:
  401. pop es
  402. jmp ISDone
  403. endif
  404. is9: xor dx,dx
  405. xor ax,ax
  406. ISDone:
  407. pop ds
  408. cEnd Inquire
  409. ;-----------------------------------------------------------------------;
  410. ; Get80x87SaveSize ;
  411. ; ;
  412. ; ;
  413. ; Arguments: ;
  414. ; ;
  415. ; Returns: ;
  416. ; ;
  417. ; Error Returns: ;
  418. ; ;
  419. ; Registers Preserved: ;
  420. ; ;
  421. ; Registers Destroyed: ;
  422. ; ;
  423. ; Calls: ;
  424. ; ;
  425. ; History: ;
  426. ; ;
  427. ; Thu Feb 05, 1987 10:15:13p -by- David N. Weise [davidw] ;
  428. ; Wrote it. ;
  429. ;-----------------------------------------------------------------------;
  430. assumes ds,nothing
  431. assumes es,nothing
  432. cProc Get80x87SaveSize,<PUBLIC,FAR>
  433. cBegin nogen
  434. push ds
  435. mov ds, MyCSDS
  436. assumes ds, DATA
  437. mov ax,CoProcFlag
  438. pop ds
  439. ret
  440. cEnd nogen
  441. ;-----------------------------------------------------------------------;
  442. ; Save80x87State ;
  443. ; ;
  444. ; ;
  445. ; Arguments: ;
  446. ; ;
  447. ; Returns: ;
  448. ; ;
  449. ; Error Returns: ;
  450. ; ;
  451. ; Registers Preserved: ;
  452. ; ;
  453. ; Registers Destroyed: ;
  454. ; ;
  455. ; Calls: ;
  456. ; ;
  457. ; History: ;
  458. ; ;
  459. ; Thu Feb 05, 1987 10:15:17p -by- David N. Weise [davidw] ;
  460. ; Wrote it. ;
  461. ;-----------------------------------------------------------------------;
  462. assumes ds,nothing
  463. assumes es,nothing
  464. cProc Save80x87State,<PUBLIC,FAR>
  465. ; parmD savearea
  466. cBegin nogen
  467. mov bx,sp
  468. les bx,[bx][4]
  469. fsave es:[bx]
  470. ret 4
  471. cEnd nogen
  472. ;-----------------------------------------------------------------------;
  473. ; Restore80x87State ;
  474. ; ;
  475. ; ;
  476. ; Arguments: ;
  477. ; ;
  478. ; Returns: ;
  479. ; ;
  480. ; Error Returns: ;
  481. ; ;
  482. ; Registers Preserved: ;
  483. ; ;
  484. ; Registers Destroyed: ;
  485. ; ;
  486. ; Calls: ;
  487. ; ;
  488. ; History: ;
  489. ; ;
  490. ; Thu Feb 05, 1987 10:15:23p -by- David N. Weise [davidw] ;
  491. ; Wrote it. ;
  492. ;-----------------------------------------------------------------------;
  493. assumes ds,nothing
  494. assumes es,nothing
  495. cProc Restore80x87State,<PUBLIC,FAR>
  496. ; parmD savearea
  497. cBegin nogen
  498. mov bx,sp
  499. les bx,[bx][4]
  500. frstor es:[bx]
  501. ret 4
  502. cEnd nogen
  503. if2
  504. %out Dummy A20 handler still here
  505. endif
  506. assumes ds,nothing
  507. assumes es,nothing
  508. cProc A20_Proc,<PUBLIC,FAR>
  509. ; parmW enable
  510. cBegin nogen
  511. mov ax, 2 ; No himem area error code
  512. ret 2
  513. cEnd nogen
  514. ; the following routine is added per DavidW's suggestion that the disable
  515. ; calls be made through WEP routine and this WEP will call any clean-up
  516. ; to be done by the driver.
  517. ifdef HPSYSTEM
  518. cProc WEP, <PUBLIC, FAR>
  519. parmW dummy
  520. cBegin
  521. call DisableVectra ;~~vvr 091989
  522. mov ax, 1 ; by convention
  523. cEnd
  524. else
  525. cProc WEP,<PUBLIC,FAR>
  526. ; parmW dummy
  527. cBegin nogen
  528. mov ax,1
  529. ret 2
  530. cEnd nogen
  531. endif ;HPSYSTEM
  532. ;-----------------------------------------------------------------------;
  533. ; ;
  534. ; BOOL Dos4IsRemote(int); ;
  535. ; ;
  536. ; ENTRY: Word, iPDrive: must be of the form ( logical volume A = 0 ) ;
  537. ; Physical Drive Spec. B = 1 ;
  538. ; C = 2 ;
  539. ; ect. ;
  540. ; EXIT: BOOL returned in AX True = Remote ;
  541. ; False = Local ;
  542. ; ;
  543. ; DESTROYS: AX. (preserves all registers except AX for return value) ;
  544. ; ;
  545. ; Wed 27-Sep-1989 20:08:18 -by- David N. Weise [davidw] ;
  546. ; Stole this from setup, made it smaller. ;
  547. ; ;
  548. ; AUTHOR: MC ;
  549. ;-----------------------------------------------------------------------;
  550. cProc Dos4IsRemote,<NEAR,PUBLIC.ATOMIC,NODATA>, <si,di,ds,es>
  551. ParmW iPDrive ; Int Physical drive spec 0 - 25
  552. localV local_name,16 ; Buffer to hold redirected local name.
  553. localV net_name,128 ; Buffer to hold remote device name.
  554. ; redirected local device names.
  555. cBegin
  556. ; We have to use DOS call int 21h/5f02h because DOS call int 21h/4409h
  557. ; is not reliable under DOS versions 4.00 and 4.01.
  558. xor cx,cx
  559. mov ax,ss ; Load segs for stack vars.
  560. mov es,ax
  561. mov ds,ax
  562. next_entry:
  563. mov bx,cx ; CX = redirection list index.
  564. lea si,local_name ; ds:si = local_name
  565. lea di,net_name ; es:di = net_name
  566. push cx ; save CX
  567. mov ax,5F02h ; func 5f/02 Get redirection list.
  568. call NoHookDOSCall
  569. pop cx ; restore CX
  570. mov ax,0 ; don't change flags
  571. jc IsRemoteDone ; error, not supported or end of list.
  572. cmp bl,04h ; Is redirected device a drive ?
  573. jne not_a_drive ; If not, we don't care !
  574. mov al,ds:[si] ; Grab volume name.
  575. sub al,41h ; Convert to volume number A=0 ect.
  576. cmp ax,iPDrive
  577. jz remote_found
  578. not_a_drive:
  579. inc cx ; CX = redirection list index.
  580. jmp short next_entry
  581. remote_found:
  582. mov ax,1 ; Indicate Volume is remote !
  583. IsRemoteDone:
  584. cEnd
  585. ;-----------------------------------------------------------------------;
  586. ; InitSystem
  587. ;
  588. ;
  589. ; Entry:
  590. ;
  591. ; Returns:
  592. ;
  593. ; Registers Destroyed:
  594. ;
  595. ; History:
  596. ; Mon 21-Nov-1988 14:57:21 -by- David N. Weise [davidw]
  597. ;
  598. ;-----------------------------------------------------------------------;
  599. assumes ds,nothing
  600. assumes es,nothing
  601. ifdef NEC_98
  602. sSysIni db "system.ini",0 ; name of file. 930206
  603. sSystem db "system",0 ; [system] section.930206
  604. sTimer db "reflecttimer", 0 ; 0 : no 1:yes 930206
  605. endif ; NEC_98
  606. cProc InitSystem,<PUBLIC,FAR>
  607. cBegin nogen
  608. push ds
  609. mov ds, MyCSDS
  610. assumes ds, DATA
  611. ifdef NEC_98
  612. ;930206
  613. cmp [profinit],0
  614. jnz profinitdone
  615. inc [profinit]
  616. push es
  617. ; Get keyboard table type from WIN.INI.
  618. lea si, sSystem
  619. lea di, sTimer
  620. lea bx, sSysIni
  621. regptr cssi,cs,si ; lpAppName = "keyboard"
  622. regptr csdi,cs,di ; lpKeyName = "type"
  623. regptr csbx,cs,bx ; lpFile = "SYSTEM.INI"
  624. mov ax, 0 ; defualt is not reflect
  625. cCall GetPrivateProfileInt,<cssi, csdi, ax, csbx>
  626. mov byte ptr [reflected], al
  627. pop es
  628. profinitdone:
  629. ;930206
  630. endif ; NEC_98
  631. cmp SystemIsInited,0 ; Have we already done this?
  632. jnz no_80x87 ; Yes
  633. inc SystemIsInited ; We will now init
  634. mov ah,30h ; Get DOS version
  635. int 21h
  636. xchg ah,al ; major <-> minor
  637. mov DosVer,ax
  638. ifdef HPSYSTEM
  639. call EnableVectra ;~~vvr 091889
  640. endif
  641. ifndef NEC_98
  642. int 11h ; get equipment word
  643. push ax
  644. mov cl,6
  645. shr ax,cl
  646. and al,00000011b ; isolate drive count
  647. mov numFloppies,al
  648. pop ax
  649. ; Set fBootDrive
  650. mov fBootDrive,al ; bit 0 has boot volume installed flag
  651. endif ; NEC_98
  652. ; Set CoProcFlag
  653. mov CoProcFlag,0
  654. ifdef NEC_98
  655. FINIT
  656. FINIT
  657. delay2 14
  658. xor ax, ax
  659. mov NDP_CONTROL, ax ; clear temp
  660. FSTCW NDP_CONTROL
  661. delay2 14
  662. and NDP_CONTROL, 0f3fh ;
  663. cmp NDP_CONTROL, 033fh ;
  664. jne no_80X87
  665. FSTSW NDP_CONTROL
  666. delay2 14
  667. inc ax
  668. test NDP_CONTROL, 0b8bfh
  669. jnz no_80X87
  670. else ; NEC_98
  671. test al,2 ; this is the IBM approved method
  672. jz no_80x87 ; to check for an 8087
  673. endif ; NEC_98
  674. mov CoProcFlag,94 ; size of save area
  675. FNINIT
  676. no_80x87:
  677. mov ax,1
  678. pop ds
  679. ret
  680. cEnd nogen
  681. ifdef JAPAN
  682. ;-----------------------------------------------------------------------;
  683. ; JapanInquireSystem( what, which )
  684. ; Get system information - Japanese specific.
  685. ;
  686. ; Entry:
  687. ; what - function code as;
  688. ; 0 - Inquire interrupt vector modification
  689. ; 'which' contains interrupt vector number (0-FF)
  690. ; to get it is can be changed. Returns zero if a
  691. ; vector cannot be changed
  692. ; 1 - Get Boot drive
  693. ; Returns boot drive. 0=A,1=B...etc.
  694. ;
  695. ;-----------------------------------------------------------------------;
  696. assumes ds,nothing
  697. assumes es,nothing
  698. cProc JapanInquireSystem,<PUBLIC,FAR>
  699. parmW what
  700. parmW which
  701. ifdef NEC_98
  702. localW WKDRV ; 92.11.17 Win31 NEC
  703. endif ; NEC_98
  704. cBegin
  705. mov ax,what
  706. test ax,ax ; what=1?
  707. jnz jis2 ; jump if not
  708. ifndef NEC_98
  709. mov ax,which ; get vector number to examine
  710. cmp al,1bh ; try to change 1b?
  711. jz jis1 ; jump if so - cannot modify
  712. cmp al,1ch ; try to change 1c?
  713. jz jis1 ; jump if so - channot modify
  714. endif ; NEC_98
  715. mov ax,1 ; OK to modify
  716. jmp jisx
  717. jis1:
  718. xor ax,ax ; cannot modify
  719. jmp jisx
  720. jis2:
  721. dec ax ; what=2?
  722. jnz jis3 ; jump if not
  723. ifdef NEC_98
  724. mov ax,3000H ; Get DOS Version
  725. int 21H ;
  726. cmp al,05H
  727. jb jis3
  728. mov ah,33H ; Get Boot Drive DOS5
  729. mov al,05H
  730. int 21H
  731. mov dh,00h
  732. mov WKDRV,dx
  733. mov ax,WKDRV
  734. dec ax
  735. else ; NEC_98
  736. mov ax,2 ; drive 'C:' is a default boot drive for
  737. ; industrial standard PC
  738. endif ; NEC_98
  739. jmp jisx
  740. jis3:
  741. mov ax,-1 ; error!
  742. jisx:
  743. cEnd
  744. endif ;JAPAN
  745. sEnd CODE ; End of code segment
  746. END InitSystem