📄 woarlm.asm
字号:
;/*
; * Microsoft Confidential
; * Copyright (C) Microsoft Corporation 1985-1991
; * All Rights Reserved.
; */
;----------------------------------------------------------------------------;
; This file has the functions performaed by the real mode routine. ;
; ;
; History: ;
; ;
; Fri June-15-1990. -by- Amit Chatterjee [amitc] ;
; Adapted for the Dos Task Switcher. ;
; ;
; Tue May-08-1990. -by- Amit Chatterjee [amitc] ;
; Till now if 'fNoSwitch' was set all the hot keys would be disabled ;
; and the hot keys would be chained down the INT 9 interrupt. This ;
; was not the right behaviour. The hot keys should only be chained ;
; down if the hot key is specifically disabled in the PIF. The INT9 ;
; ISR has now been modified to take care of this. (Fix for bug #2190) ;
; ;
; Tue June-20-1989. -by- Amit Chatterjee [amitc] ;
; Created for Windows. (Added the History legend) ;
;----------------------------------------------------------------------------;
?win = 0
?DF = 1
.xlist
include cmacros.inc
include woasegs.inc
include macros.mac
include woakeys.inc
include woaerr.inc
include woapif.inc
include pdb.inc
include njmp.mac
include woaswch.inc
include woaswapi.inc
.list
.286
;----------------------------------------------------------------------------;
; define the equates to access the users registers off the stack. ;
;----------------------------------------------------------------------------;
USER_FLAGS equ wptr [bp+6] ;the flag word
USER_FLAGLOW equ bptr [bp+6] ;low byte of flags
USER_CS equ wptr [bp+4] ;users return segment
USER_IP equ wptr [bp+2] ;users return address
USER_BP equ wptr [bp] ;bp saved here
USER_DS equ wptr [bp-2] ;ds saved here
USER_DX equ wptr [bp-4] ;dx saved here
USER_ES equ wptr [bp-6] ;es saved here
USER_BX equ wptr [bp-8] ;bx saved here
USER_AX equ wptr [bp-10] ;ax saved here
USER_AL equ bptr [bp-10] ;al saved here
USER_CX equ wptr [bp-12] ;cx saved here
USER_SI equ wptr [bp-14] ;si saved here
USER_DI equ wptr [bp-16] ;di saved here
;----------------------------------------------------------------------------;
; define any public labels or eqautes here. ;
;----------------------------------------------------------------------------;
public WoaPath
public WoaParams
public WoaFcb1
public WoaFcb2
public WoaParamBlock
public WoaStubSize
public WoaPSP
public WoaAppNumber
public WoaBehavior
public WoaHotkeys
public WoaEmsFlag
public WoafBreak
public WoaStartScreenLines
public Woa6fValue
public WoaIrq9Global
public WoaNetAsyncSwitching
public AsyncNetPending
public WoaInt15UsershApp
public WoahApp
public WoafXmsInstalled
public WoaGrabberName
public WoaSegResizeBlock
public WoaSizeReservedArea
public WoaCpuType
public WoaGrabberSwapPath
public WoaSwapDrive
public WoaFileEntrySize
public RealModeWoa
public BackFromContextSwitch
public SwitchIfPossible
public WaitForKeyFromInt16
public WaitForKeyFromDosCalls
public DosCall
public ActualInt21
public ActualInt16
public ActualInt09
public Int16ISR
public Int09ISR
public TestWoaInt16InChain
public ConsoleRawMode
public GrabberParaSize
public WOAsInt16
public ActualXMS
public GetXmsHandler
public DoInt28
public WoaHotKeyState
public WoaNodeToSwitchTo
public WoaALtTabDisabled
public WoaShftALtTabDisabled
public WoaALtEscDisabled
public WoaShftALtEscDisabled
public WoaCtrlEscDisabled
public DisableInt15Mouse
public EnableInt15Mouse
public SwitcherDisabled
public WoaSwitcherID
public HInt09ChainAddr
public WoaSwapAreaParaSize
;----------------------------------------------------------------------------;
; define some local data structures. ;
;----------------------------------------------------------------------------;
ScanCodeStruc STRUC
SCS_ScanCode db ? ;main scan code
SCS_ShiftState db ? ;the shift state
ScanCodeStruc ENDS
HotKeyInfoStruc STRUC
HKIS_State db ? ;enabled if 0, else disabled
HKIS_PrefixScanCode db ? ;a prefix for the scan code
HKIS_Type db ? ;type of switch
HKIS_NodeNum db ? ;logical node number
HotKeyInfoStruc ENDS
; at this moment, the code assumes that the size of the 'HotKeyInfoStruc'
; structure is double the size of 'ScanCodeStruc' structure. There are
; 'errnzs' to assert this.
;----------------------------------------------------------------------------;
;----------------------------------------------------------------------------;
; define two macros for doing near and far returns and one for swapping words;
;----------------------------------------------------------------------------;
near_ret macro
local dummy
dummy proc near
ret
dummy endp
endm
far_ret macro
local dummy
dummy proc far
ret
dummy endp
endm
swap_a_word macro
mov ax,[si] ;;get word from source
xchg es:[di],ax ;;swap it with destination
mov [si],ax ;;save word in source
add si,2 ;;next word
add di,2 ;;next word
endm
;----------------------------------------------------------------------------;
createSeg _WOARLMSEG,StubSeg,word,public,code
sBegin StubSeg
assumes cs,StubSeg
assumes ds,StubSeg
;----------------------------------------------------------------------------;
; declare external functions here. ;
;----------------------------------------------------------------------------;
externNP XenixRead ;(WOADOS.ASM)
externNP ReadConsoleBuffer ;(WOADOS.ASM)
externNP LoadGrabberAndInit ;(WOAGRB.ASM)
externNP GrabberSaveScreen ;(WOAGRB.ASM)
externNP GrabberRestoreScreen ;(WOAGRB.ASM)
externNP GrabberEnableSave ;(WOAGRB.ASM)
externNP GrabberDisableSave ;(WOAGRB.ASM)
externNP GrabberInitScreen ;(WOAGRB.ASM)
externNP SaveWindowsHPState ;(WOAHP.ASM)
externNP RestoreWindowsHPState ;(WOAHP.ASM)
externNP SaveDosAppHPState ;(WOAHP.ASM)
externNP RestoreDosAppHPState ;(WOAHP.ASM)
externNP CheckWithApp ;(WOAHP.ASM)
externNP NotifyApp ;(WOAHP.ASM)
externNP ProcessTsr ;(WOATSR.ASM)
externNP XmsInit ;(WOAXMS.ASM)
externNP HookOurXMSCode ;(WOAXMS.ASM)
externNP UnHookOurXMSCode ;(WOAXMS.ASM)
externNP SWAPICreateSession ;(WOASWAPI.ASM)
externNP SWAPIResumeSession ;(WOASWAPI.ASM)
externNP SWAPISessionActive ;(WOASWAPI.ASM)
externNP SWAPIDestroySession ;(WOASWAPI.ASM)
externNP OkToSuspend? ;(WOASWAPI.ASM)
externNP SwitchAPICallIn ;(WOASWAPI.ASM)
externNP DoDosWait ;(WOADOS.ASM)
externNP SwapInstanceDataBlocks ;(WOAINSTD.ASM)
externNP InitSwitcherAPI ;(WOASWAPI.ASM)
ifdef JAPAN
externFP KkcBusyCheck ;(WOAKKC.ASM)
endif
;----------------------------------------------------------------------------;
; declare variables defined in other files. ;
;----------------------------------------------------------------------------;
externB PromptString ;(WOAMSG2.INC,WOATSR.ASM)
externB WoaAppUsesXMS ;(WOAXMS.ASM)
externW RCB_FileHandle ;(WOADOS.ASM)
externD lp3fMode ;(WOADOS.ASM)
externB b3fRCB ;(WOADOS.ASM)
ifdef JAPAN
externW KkcBufferSize ;(WOAKKC.ASM)
externW KkcBufferSeg ;(WOAKKC.ASM)
endif
;----------------------------------------------------------------------------;
; define a 256 byte of stack frame for the real mode stack ;
;----------------------------------------------------------------------------;
WoaGrabberName db 80 dup (?) ;load name of grabber
WoaGrabberSwapPath db 80 dup (?) ;grabber swap path
WoaPath db 80 dup (?) ;file to execute
WoaParams db 130 dup (?) ;parameters to it
WoaFcb1 db 32 dup (?) ;first FCB
WoaFcb2 db 32 dup (?) ;second FCB
Woa6fValue db ? ;int 6f to be done or not
WoaIrq9Global db ? ;IRQ 9 to be global or not
WoaNetAsyncSwitching db ? ;Network to be monitored or not
WoaCpuType dw ? ;copy of __WINFLAGS
WoaFileEntrySize dw ? ;size of SFT fcb
;----------------------------------------------------------------------------;
; now define some data variables that will be passed in from protected mode ;
; ;
; ********************************CAUTION********************************** ;
; THE DEFINITION AND ORDERING OF VARIABLES IN THE FOLLOWING BLOCK MUST BE ;
; EXACTLY IDENTICAL TO THE DEFINITION AND ORDERING OF VARIABLES IN THE ;
; CORRESPONDING BLOCK NAMED 'STUBDATA' IN (WOAMGR.ASM) ;
; ************************************************************************** ;
;----------------------------------------------------------------------------;
public WoaStubData
public WoaStubDataLength
WoaStubData label byte
WoafBreak db ? ;startup state of CTRL+C flag
WoaSwapDrive db ? ;swap drive to use
WoaPSP dw ? ;WOA PDB seg
WoaEmsFlag db ? ;EMS present or not
WoaInt15UsershApp dw ? ;ID of INT 15 user.
WoaSegResizeBlock dw ? ;block to resize
WoaSizeReservedArea dw ? ;size of reserved area
WoaStubDataLength equ $ - WoaStubData
;----------------------------------------------------------------------------;
; Define the rest of the variables that are obtained from the main code seg. ;
;----------------------------------------------------------------------------;
WoaStartScreenLines dw ? ;start up no of screen lines
WoahApp dw ? ;handle of window
WoafXmsInstalled db 0 ;NZ if XMS code installed
WoaAppNumber dw ? ;serial number of app
WoaParamBlock dw 7 dup (?) ;parameters for EXEC
WoaBehavior db ? ;the behaviour bits
WoaHotkeys db ? ;the hot key disable flags
WoaStubSize dw ? ;stub code size
WoaSwitcherID db ? ;ID of the switcher
;----------------------------------------------------------------------------;
; next have any variables needed by real mode code. ;
;----------------------------------------------------------------------------;
SwitcherDisabled dw 0 ;following reasons to disable
SD_LOCAL_DISABLE equ 001h ;local critical sections
SD_PMODE_WINDOWS equ 002h ;pmode windows being run
; SD_SWAPI_DISABLE equ 004h ;defined in WOASWAPI.ASM
HardwareIntCount db 0 ;number of hw ints being serviced
LocalInt15MouseHandler db 0 ;mouse handler local or not
Int16GetStatusType db 01h ;Int 16h get status call to use
WoaSwapAreaParaSize dw ? ;size of swap area
OriginalDosBlockSize dw ? ;size of LOW heap block
OriginalBlockType db ? ;type of the arena
WoaRlmEntrySS dw ? ;stack seg at entry
WoaRlmEntrySP dw ? ;stck pointer at entry
WoaSwitchOutSS dw ? ;value of ss at switch out time
WoaSwitchOutSP dw ? ;value of sp at switch out time
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -