init.asm
来自「Dos6.0」· 汇编 代码 · 共 2,531 行 · 第 1/5 页
ASM
2,531 行
.386p
page 58,132
;******************************************************************************
TITLE INIT - initialization code for CEMM
;******************************************************************************
;
; (C) Copyright MICROSOFT Corp. 1986-1991
; (C) Copyright COMPAQ Computer Corp. 1986-1991
;
; Title: EMM386.EXE - MICROSOFT Expanded Memory Manager 386 Driver
;
; Module: INIT - initialization code for CEMM
;
; Version: 2.02
;
; Date: May 24,1986
;
; Author: Steve Preston,Brad Tate
;
;******************************************************************************
;
; Change Log:
;
; DATE REVISION Description
; -------- -------- --------------------------------------------
; 05/24/86 Original
; 06/18/86 0.01 Added AUTO as a valid config line parameter.
; 06/25/86 0.02 Added call to debug init.
; 06/27/86 0.02 Check for Mx length = 2 and only 2 (SBP).
; 06/28/86 0.02 Change name from CEMM386 to CEMM (SBP).
; 06/29/86 0.02 Size > 8192 were used instead of converted
; to 256 (SBP).
; 07/03/86 0.04 Added TEXT_Seg (SBP).
; 07/06/86 0.04 changed assume to _DATA (SBP).
; 07/06/86 0.04 moved init messages to LAST (SBP).
; 07/10/86 0.05 added int15 patch and int67 patch here (SBP).
; 07/11/86 0.06 check processor type before checking for
; install (SBP).
; 01/09/87 0.10 (*A) GE Set flag to disable RAM search if M1-M5 is specified
; 05/18/87 2.00 New state variables for CEMM state/modes and
; reworked AUTO/ON/OFF init code.
; 05/29/87 2.00 Reworked Page Frame selection logic (SBP).
; 06/07/87 2.00 Add Weitek detection & arguments WON/WOFF (SBP).
; 02/20/88 3.30 (*B) Init check for P9 processor (RDV)
; 07/14/88 3.31 (*C) Init check for Taurus and Horizon (RDV)
; Add WAIT (pause routine) for init errors (RDV).
; Move DOS version chk to cemm386.asm (stratini).
; 01/12/89 4.00 (*D) User aborted install added (RDV)
; Generic 8042 detect and flag
; 08/07/89 4.10 Add DEB386 support (LC).
; 08/07/89 4.10 Add CEMM to the int 2Fh chain (HKN&LC)
; 08/23/89 4.10 New memory allocation (INT15h,BIM,XMS) (LC)
;
; 02/13/91 M008 Detect a Compaq Deskpro 386/16 or a Compaq
; portable 386.
;
; 02/14/91 M010 Added support for Y path parameter for
; load hi Vxd.
;
;******************************************************************************
; Functional Description:
; This module allocates the pool of extended memory to be used for
; expanded memory, then call routines to initialize the data structures
; for EMM and VDM.
;
;******************************************************************************
.lfcond
page
;******************************************************************************
; P U B L I C D E C L A R A T I O N S
;******************************************************************************
;
public Init_CEMM386
public EndDriver
public parser
public Pn
public PnSet
public EstWorkSpace
public eXcSet
public IncSet
public DfltSet
public VGAROM
public E000ROM
public ROMparm
public RAMSet
public ROMSet
public EMSSet
public WINset
public HighSet
public max_pool_size
public min_pool_size
public high_memory_address
public ext_memory_address
public ext_size
public hi_size
public ext_mem
public UMBset
public HMAonSet
public Highscan
public NoTR
public pCOMPAQ
public szCOMPAQ
public CDPSCSI
public XmmControlBase
public XmmControlJmpVal
public DOS_version
public XMMHookAddr
page
;******************************************************************************
; L O C A L C O N S T A N T S
;******************************************************************************
include vdmseg.inc
include emm386.inc
include driver.equ
include driver.inc
include ascii_sm.equ
include emmfunct.inc
include emmdata.inc
include winemm.inc
include allocmem.inc
include dma.inc
include vdmsel.inc
;******************************************************************************
; E X T E R N A L R E F E R E N C E S
;******************************************************************************
R_CODE segment
EXTRN DDT: WORD
EXTRN ttl_hndls: WORD
extrn DEVHEAD:word
extrn DEVHEAD2:word
extrn rINT13hHandler:near ; int13h patch code
extrn rINT15hHandler:near ; int15h patch code
extrn rINT19hHandler:near ; int19h patch code
;; extrn rINT4BhHandler:near ; int4Bh patch code
extrn EMM_rEntry:near ; int67h patch code
extrn FarGoVirtual:far ; go to virtual mode
extrn Devname:byte
extrn MasterPICVec:word
extrn SlavePICVec:word
;; extrn b2asc10_far:far
;; extrn b2ascHEX_far:far
;; extrn I_Message_Display:far
;; extrn E_XStatus_Display:far
extrn rINT2FhHandler:near
;; extrn XMMAllocateHMA:far
;; extrn check_XMM:far
;; extrn chk_machine_state:far
extrn EMM_rFarEntry:word
extrn end_of_R1_CODE:byte
extrn UMBFARTABLE:word
extrn UMBADDRLEN:abs
extrn checkXMMFar:dword
extrn chkMcStateFar:dword
CDPSCSI db 0 ; A CDP (Columbia Data Products) SCSI fixed drive is detected.
R_CODE ends
R1_CODE segment
extrn rINT4BhHandler:near ; int4Bh patch code
extrn OldInt13:dword
extrn PrevInt4B:dword
extrn rXMMentry:far
extrn PrevInt10:dword
extrn PrevInt11:dword
R1_CODE ends
_DATA segment
extrn HMAmin:word
_DATA ends
GDT segment
extrn GDTLEN:abs
GDT ends
IDT segment
extrn IDTLEN:abs
IDT ends
ifdef TSSQLEO
TSS segment
extrn TSSLEN:abs
TSS ends
endif
LAST segment
extrn Inst_chk:near ; check for CEMM already installed
extrn r_cmos:near
extrn InstallMess:byte
extrn ISizeMess:byte
extrn ActiveMess:byte
extrn InactiveMess:byte
extrn OFFMess:byte
extrn AutoMess:byte
extrn InvParm:byte
extrn InvPFBA:byte
extrn InvMRA:byte
extrn Adj_Size:byte
extrn InsfMem:byte
extrn Incorrect_DOS:byte
extrn Incorrect_PRT:byte
extrn Already_Inst:byte
extrn No_PF_Avail:byte
extrn PFWarning:byte
extrn NoWeitek:byte
EXTRN PF_not_3_2: BYTE
extrn HMAonMsg:byte
extrn NumOfUMBwindows:byte
extrn UMBmemMsg:byte
extrn OverlapWarn:byte
extrn WeitekONMess:byte
extrn WeitekOFFMess:byte
extrn WeitekNAMess:byte
extrn UserAbortMsg:byte
extrn OF_won_err:byte
extrn PFB_warning:word
extrn bad_mc_state:near
extrn Inv_DOS_msg:near
extrn Is386:far ; check for 386
extrn Is386s:far ;
extrn IsP8042:far ; generic check for password 8042
extrn EMM_Init:near ; initialization for EMM data structs
extrn DMAInit:near
extrn PICVecInit:near
extrn VDM_Init:near ; initialize VDM
extrn WSInit:near
extrn WSMove:near
extrn FindWindowLocations:near ; look for option roms in PF area
extrn InitDeb:near
extrn MemInit:near
extrn MemGet:near
extrn MemExit:near
extrn GetPathName:near
extrn StorePath:near ; M010
extrn NoXMM:byte
extrn OtherEMM:byte
extrn BadXMM:byte
extrn XMMcheck:near
extrn get_XMM_ver:near
extrn XMMQueryExtended:near
extrn IsCompaq:near
extrn segfixup:near
extrn UMBlink:near
extrn NoResetRoutine:near
extrn Page4K:byte
extrn handle0_PTEs:word
extrn DoMoveBlock:near
ifdef ROMcomp
extrn FixROMptrs:near
extrn FixIVTptrs:near
endif
extrn b2asc10:near
extrn b2ascHEX:near
extrn I_Message_Display:near
extrn E_XStatus_Display:near
extrn wait_key:near
ifdef DEBUG
extrn DebDefineSeg:near
endif
LAST ends
TB EQU 09h
MIN_SIZE EQU 64
MAX_ALT_REG_SETS EQU 254
LAST SEGMENT ; (PIW)
switch DD Invalid_Parameter ; 0
DD Get_P_Handle_Page_Frame ; / 1
DD Get_Size ; 0 2
DD Get_Size ; 1 3
DD Get_Size ; 2 4
DD Get_Size ; 3 5
DD Get_Size ; 4 6
DD Get_Size ; 5 7
DD Get_Size ; 6 8
DD Get_Size ; 7 9
DD Get_Size ; 8 10
DD Get_Size ; 9 1
DD Get_Mode_Alt_Reg_Sets ; A 2
DD Get_Lowest_Frame ; B 3
DD Get_DMA_Buffer_Size ; D 4
DD Get_Page_Frame ; F 5
DD Get_H ; H 6
DD Get_Left_Alone_Size ; L 7
DD Get_M ; M 8
DD Get_On_Off_Mode ; O 9
DD Get_I_Page_Frame ; P 20
DD Get_Wetek_Mode ; W 1
DD GetExcludeRange ; X 2
DD GetRAM ; R 3
DD NoMoveXBDA ; N 4
DD GetIncludeRange ; I 5
DD EMSInts ; E 6
DD GetFullPath ; Y 7 (M010)
DD Vir8042Parm ; V 8 (LC910611)
case DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01 ; /
DB 02,03,04,05,06,07,08,09,10,11,00,00,00,00,00,00 ; 0123456789
DB 00,12,13,00,14,26,15,00,16,25,00,00,17,18,24,19 ; ABDEFHILMNO
DB 20,00,23,00,00,00,28,21,22,27,00,00,00,00,00,00 ; PQRVWXY
DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
DB 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
$Hset DB 0
altRset DB 0
baseset DB 0
bDMAset DB 0
;------------------------------------------------------------------------
; Keep all parameter ranges together here so they can be saved/restored
; together.
public RangeSets, RANGESIZE, RangeSave
RangeSets label byte
eXcSet dw EXCLUDE shl 8 + 2, 24 dup (0) ; eXclude range specified by user
IncSet dw RAM shl 8 + 2, 24 dup (0) ; Include range specified by user
RAMSet dw RAM shl 8 + 2, 24 dup (0) ; RAM range specified by user
EMSSet dw EMS shl 8 + 2, 24 dup (0) ; EMS range specified by user
ROMSet dw ROM shl 8 + 2+4*1
dw 0FF00h,0FF00h,24 dup (0) ; ROM range specified by user
WINset dw WIN shl 8 + 2, 24 dup (0) ; Win range specified by user
HighSet dw 2, 24 dup (0) ; Highscan detected ranges
DfltSet dw INUSE shl 8 + 2+3*4
dw 00001h ; from 1
Bparm dw 03FFFh ; to 3fffh
dw 0A000h ; from a000
VGAROM dw 0BFFFh ; to bfffh
E000ROM dw 0F000h, 0FFFFh ; exc f000h - ffffh
dw 0,0 ; Terminating zeroes
RANGESIZE equ $-RangeSets
RangeSave db RANGESIZE dup (?)
;------------------------------------------------------------------------
frames DW 0C000h ; M1
DW 0C400h ; M2
DW 0C800h ; M3
DW 0CC00h ; M4
DW 0D000h ; M5
DW 0D400h ; M6
DW 0D800h ; M7
DW 0DC00h ; M8
DW 0E000h ; M9
DW 08000h ; M10
DW 08400h ; M11
DW 08800h ; M12
DW 08C00h ; M13
DW 09000h ; M14
numFram EQU ($-frames) SHR 1
DW 09400h ; Pddd
DW 09800h ; Pddd
DW 09C00h ; Pddd
DW 0E400h ; Pddd
DW 0E800h ; Pddd
DW 0EC00h ; Pddd
numPFrm EQU ($-frames) SHR 1
framadr DD frames
tknBuf DB 128 DUP (0)
op_on DB "ON", 0
ONLEN EQU $-op_on
op_off DB "OFF", 0
OFFLEN EQU $-op_off
op_auto DB "AUTO", 0
AUTOLEN EQU $-op_auto
frame$ DB "FRAME="
framLen EQU $-frame$
ROMCompParm db "ROMCOMPRESS"
ROMCompLen equ $-ROMCompParm
verbose$ db "VERBOSE", 0
verboseLen equ $-verbose$
ext_mem dd FREE
Pn DB 6 DUP (FREE)
PnSet DW FALSE
UMBset dw FALSE
UMBman dw FALSE
HMAonSet db FALSE
ROMparm db FALSE
NoPFCset db FALSE
NoHigh db FALSE
Highscan db FALSE
Verbose db FALSE
NoVCPI db FALSE
NoTR db FALSE
smartdrv_status status <>
smartdrv_name db 'SMARTAAR',0
CACHEname db 'CACHCMPQ',0
CACHEIOCTL dw 1
dd 0
dd 0
min_pool_set db FALSE
max_pool_set db FALSE
min_pool_size dw 256
max_pool_size dw 0
high_memory_address dd 0
ext_memory_address dd 0
ext_size dw 0
hi_size dw 0
set_int13 label byte
dw 000dh ; cmd byte for setting Smartdrv's old int 13
dd ? ; address to which Smartdrv's old int 13 s
; should be set
EndDriver dw 0 ; last segment of driver to load
XmmControlBase label dword ; base address of XMM control headers
dw -1
dw -1
XmmControlJmpVal db ? ; offset byte of short jmp instruction
SYSSS dw ?
SYSSP dw ?
DOS_version dw 0
XMMHookAddr dd 0
; Toshiba specific data items
public HRAMSet
public BRAMSet
public ToshSet
public toshiba_machine
public TOSHbeg
public TOSHend
HRAMSet dw INUSE shl 8 + 2+1*4 ; Toshiba Hard Ram exclusions
HRAMbeg dw 0h ; HardRAM Win begin (e000 dflt)
HRAMend dw 0h ; HardRAM Win end (e800 dflt)
dw 0,0 ; Terminating zeroes
BRAMSet dw INUSE shl 8 + 2+1*4 ; Toshiba Backup Ram exclusions
BRAMbeg dw 0h ; Bkup RAM begin (e800 dflt)
BRAMend dw 0h ; Bkup RAM end (efff dflt)
dw 0,0 ; Terminating zeroes
ToshSet dw INUSE shl 8 + 2+1*4 ; Toshiba Misc. exclusions
TOSHbeg dw 0h ; Misc. Toshiba resrvd area begin (e000 dflt)
TOSHend dw 0h ; Misc. Toshiba resrvd area end (efff dflt)
dw 0,0 ; Terminating zeroes
pTOSHIBA label dword ; Pointer to TOSHIBA signature
dw 0E010h
dw 0F000h
szTOSHIBA db 'TOSHIBA ' ; TOSHIBA signature
toshiba_machine db 0 ; NZ if on a Toshiba machine
LAST ENDS
LAST segment
assume cs:LAST
pCOMPAQ label dword ; Pointer to COMPAQ signature
dw 0FFE8h
dw 0F000h
szCOMPAQ db '03COMPAQ' ; COMPAQ signature
pZENITH label dword ; Pointer to ZENITH signature
dw 0800Ch
dw 0F000h
szZENITH db 'ZDS' ; ZENITH signature
; local data
;
pEISAROM label dword
dw 0FFD9h ; "EISA" in ROM
dw 0F000h
AUTO_parm db "auto"
AUTO_LEN equ $-AUTO_parm
msg_tbl label word
dw offset LAST:OverlapWarn ; User specified ranges overlap
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?