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

📄 cw.inc

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 INC
📖 第 1 页 / 共 3 页
字号:
;-------------------------------------------------------------------------------
;
;Call a CauseWay system function. Operand supplied is the function number. Use
;of this macro is not obligatory, use your own version if you want. These are
;the low level functions. Other API emulations come later.
;
Sys	macro p1
	mov	ax,p1
	int	31h
	endm


;-------------------------------------------------------------------------------
;
;Get system selectors/flags.
;
;On Exit:
;
;AX	- Selector for real mode segment address of 00000h, 4G limit.
;BX	- Selector for current PSP segment. 100h limit.
;[E]CX	- Dos transfer buffer size. Always <64k.
;DX	- Dos transfer buffer real mode segment address.
;ES:[E]SI	- Dos transfer buffer protected mode address. ESI+ECX ALWAYS <64k.
;EDI	- System flags. Bits significant if set.
;
;	0 - 32 bit code default.
;
;	1 - Virtual memory manager functional.
;
;	2 \ Mode, 0 - raw, 1 - VCPI, 2 - DPMI.
;	3 /
;
;	4 - DPMI available.
;	5 - VCPI available.
;	6 - No memory managers.
;
;	7 - Descriptor table type. 0 - GDT, 1 - LDT.
;
;NOTES:
;
;Bits 1-2 of DI indicate the interface type being used by CauseWay. Bits 4-5
;indicate the interface types that are available.
;
;Bit 7 indicates the descriptor table being used to allocate selectors to the
;application when on a raw/vcpi system.
;
;The Dos transfer buffer is the area CauseWay uses to transfer data between
;conventional and extended memory during DOS interupts. This memory can be used
;as temporary work space for your own access to real mode code as long as you
;remember it may be over written the next time you issue an INT in protected
;mode that requires segment&|offset pointers.
;
Info	equ	0ff00h		;Get general purpose segment selectors.


;-------------------------------------------------------------------------------
;
;Simulate real mode interupt.
;
;On Entry:
;
;BL	- Interupt number.
;ES:[E]DI	- Parameter block.
;
;On Exit:
;
;Parameter block updated.
;
;NOTES:
;
;The parameter block referanced by ES:[E]DI should contain the register values
;you want passing to the real mode interupt handler. The SS:SP & Flags entries
;are currently filled in by CauseWay to ensure legal values are used and the
;CS:IP entries are ignored. This function bypasses protected mode interupt
;handlers and provides access to INT API's that would not otherwise be available
;using CauseWay.
;
IntXX	equ	0ff01h


;-------------------------------------------------------------------------------
;
;Simulate real mode far call.
;
;On Entry:
;
;ES:[E]DI	- Parameter block.
;
;On Exit:
;
;Parameter block updated.
;
;NOTES:
;
;This function works much the same as IntXX but provides a 16 bit FAR stack
;frame and the CS:IP values used to pass control to the real mode code.
;
FarCallReal	equ	0ff02h


;-------------------------------------------------------------------------------
;
;Allocate real mode call back address.
;
;On Entry:
;
;DS:[E]SI	- Call address.
;ES:[E]DI	- Real mode register structure.
;
;On Exit:
;
;Carry set on error, else,
;
;CX:DX	- Real mode address to trigger mode switch.
;
;NOTES:
;
;Real mode CallBack's provide a means of switching from real mode to protected
;mode. The address returned by this function is a unique real mode address that
;when given control in real mode will switch to protected mode and pass control
;to the protected mode routine supplied at entry to this function.
;
GetCallBack	equ	0303h


;-------------------------------------------------------------------------------
;
;Release a real mode call back entry.
;
;On Entry:
;
;CX:DX	- Real mode address returned by GetCallBack
;
RelCallBack	equ	0304h


;-------------------------------------------------------------------------------
;
;Get Protected mode interupt handler address.
;
;On Entry:
;
;BL	- Interupt vector number.
;
;On Exit:
;
;CF set on error else:-
;
;CX:[E]DX	- selector:offset of handler.
;
GetVect	equ	0204h


;-------------------------------------------------------------------------------
;
;Set Protected mode interupt handler address.
;
;On Entry:
;
;BL	- Interupt vector number.
;CX:[E]DX	- selector:offset of new handler.
;
;On Exit:
;
;CF set on error.
;
SetVect	equ	0205h


;-------------------------------------------------------------------------------
;
;Get real mode interupt handler address.
;
;On Entry:
;
;BL	- Interupt vector number.
;
;On Exit:
;
;CF set on error else:-
;
;CX:DX	- selector:offset of handler.
;
GetRVect	equ	0200h


;-------------------------------------------------------------------------------
;
;Set real mode interupt handler address.
;
;On Entry:
;
;BL	- Interupt vector number.
;CX:DX	- selector:offset of new handler.
;
;On Exit:
;
;CF set on error.
;
SetRVect	equ	0201h


;-------------------------------------------------------------------------------
;
;Get Protected mode exception handler address.
;
;On Entry:
;
;BL	- Exception vector number.
;
;On Exit:
;
;CF set on error else:-
;
;CX:[E]DX	- selector:offset of handler.
;
GetEVect	equ	0202h


;-------------------------------------------------------------------------------
;
;Set Protected mode exception handler address.
;
;On Entry:
;
;BL	- Exception vector number.
;CX:[E]DX	- selector:offset of new handler.
;
;On Exit:
;
;CF set on error.
;
SetEVect	equ	0203h


;-------------------------------------------------------------------------------
;
;Allocate a new selector.
;
;On Exit:
;
;BX	- Selector.
;
;NOTES:
;
;A selector is allocated and initialised with a base of 0, a limit of 0 and as
;read/write expand up data. Use SetSelDet to make the selector useful.
;
GetSel	equ	0ff03h


;-------------------------------------------------------------------------------
;
;Allocate multiple selectors.
;
;On Entry:
;
;CX	- Number of selectors.
;
;On Exit:
;
;BX	- Base selector.
;
;NOTES:
;
;The selectors are allocated and initialised with a base of 0, a limit of 0 and
;as read/write expand up data. Use SetSelDet to make the selectors useful.
;
GetSels	equ	0ff29h


;-------------------------------------------------------------------------------
;
;Release a selector.
;
;On Entry:
;
;BX	- Selector.
;
RelSel	equ	0ff04h


;-------------------------------------------------------------------------------
;
;Make a selector execute/read type.
;
;On Entry:
;
;BX	- Selector.
;CL	- Default operation size. (0=16 bit,1=32 bit)
;
;NOTES:
;
;Allows a selector to be converted to a type suitable for execution.
;
CodeSel	equ	0ff05h


;-------------------------------------------------------------------------------
;
;Create a read/write data selector with same base and limit as selector
;supplied.
;
;On Entry:
;
;BX	- Source selector
;
;On Exit:
;
;If function was successful:
;Carry flag is clear.
;AX	- New data selector
;
;If function was not successful:
;Carry flag is set.
;
;NOTES:
;
;This function always creates a read/write data selector regardless of the
;source selectors type. Can be used to provide access to variables in a code
;segment etc.
;
AliasSel	equ	0ff06h


;-------------------------------------------------------------------------------
;
;Get selector linear base and limit.
;
;On Entry:
;
;BX	- Selector
;
;On Exit:
;
;CX:DX	- Linear base.
;SI:DI	- Byte granular limit.
;
GetSelDet	equ	0ff07h


;-------------------------------------------------------------------------------
;
;Get selector linear base and limit.
;
;On Entry:
;
;BX	- Selector
;
;On Exit:
;
;EDX	- Linear base.
;ECX	- Byte granular limit.
;
GetSelDet32	equ	0ff08h


;-------------------------------------------------------------------------------
;
;Set selector linear base and limit.
;
;On Entry:
;
;BX	- Selector.
;CX:DX	- Linear base.
;SI:DI	- Byte granular limit.
;
SetSelDet	equ	0ff09h


;-------------------------------------------------------------------------------
;
;Set selector linear base and limit.
;
;On Entry:
;
;BX	- Selector.
;EDX	- Linear base.
;ECX	- Byte granular limit.
;
SetSelDet32	equ	0ff0ah


;-------------------------------------------------------------------------------
;
;Allocate a block of memory.
;
;On Entry:
;
;CX:DX	- Size of block required in bytes. (-1:-1 to get maximum memory size)
;
;On Exit:
;
;Carry clear if OK &
;
;BX	- Selector to access the block with.
;
;Else if CX:DX was -1, CX:DX is size of largest block available.
;
;NOTES:
;
;This function allocates a block of extended (application) memory, and also a
;selector with a suitable base & limit.
;
GetMem	equ	0ff0bh


;-------------------------------------------------------------------------------
;
;Allocate some memory and return selector:offset (16-bit).
;
;On Entry:
;
;CX:DX	- Size of block required in bytes.
;
;On Exit:
;
;Carry set on error else,
;

⌨️ 快捷键说明

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