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

📄 cw.inc

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 INC
📖 第 1 页 / 共 3 页
字号:
;
;Memory that is locked cannot be swapped to disk by the VMM. You should note
;that locking is applied to memory on 4k boundaries, so areas of memory below
;and above the memory being locked will also be locked if the specified region
;is not 4k aligned.
;
LockMemNear	equ	0ff1fh


;-------------------------------------------------------------------------------
;
;Un-lock a region of memory using application relative address.
;
;On Entry:
;
;ESI	- Starting linear address of memory to unlock
;EBX	- Size of region to unlock in bytes
;
;NOTES:
;
;This will allow the memory to be swapped to disk by the VMM if neccessary.
;Areas below and above the specified memory will also be un-locked if the
;specified region is not page aligned.
;
UnLockMemNear equ	0ff20h


;-------------------------------------------------------------------------------
;
;Allocate a region of DOS (conventional) memory.
;
;On Entry:
;
;BX	- Number of paragraphs (16 byte blocks) required.
;
;On Exit:
;
;If function was successful:
;Carry flag is clear.
;
;AX	- Initial real mode segment of allocated block
;DX	- Initial selector for allocated block
;
;If function was not successful:
;Carry flag is set.
;
;AX	- DOS error code.
;BX	- Size of largest available block in paragraphs.
;
;NOTES:
;
;If the size of the block requested is greater than 64K bytes (BX > 1000h) then
;contiguous descriptors will be allocated. If more than one descriptor is
;allocated under 32-bit applications, the limit of the first descriptor will be
;set to the size of the entire block. All subsequent descriptors will have a
;limit of 64K except for the final descriptor which will have a limit of Block
;size MOD 64K. 16-bit applications will always set the limit of the first
;descriptor to 64K.
;
GetMemDOS	equ	0ff21h


;-------------------------------------------------------------------------------
;
;Re-size a block of DOS (conventional) memory previously allocated with
;GetMemDOS.
;
;On Entry:
;
;BX	- New block size in paragraphs
;DX	- Selector of block to modify
;
;On Exit:
;
;If function was successful:
;Carry flag is clear.
;
;If function was not successful:
;Carry flag is set.
;
;AX	- DOS error code:
;BX	- Maximum block size possible in paragraphs
;
;NOTES:
;
;Growing a memory block is often likely to fail since other DOS block
;allocations will prevent increasing the size of the block. Also, if the size of
;a block grows past a 64K boundary then the allocation will fail if the next
;descriptor in the LDT is not free.
;
ResMemDOS	equ	0ff22h


;-------------------------------------------------------------------------------
;
;Release a block of DOS (conventional) memory previously allocated with
;GetMemDOS.
;
;On Entry:
;
;DX	- Selector of block to free.
;
;On Exit:
;
;If function was successful:
;Carry flag is clear.
;
;If function was not successful:
;Carry flag is set.
;
;AX	- DOS error code.
;
;NOTES:
;
;All descriptors allocated for the memory block are automatically freed and
;therefore should not be accessed once the block is freed by this function.
;
RelMemDOS	equ	0ff23h


;-------------------------------------------------------------------------------
;
;Get current address and size of the buffer used for DOS memory transfers.
;
;On Exit:
;
;BX	- Real mode segment of buffer.
;DX	- Protected mode selector for buffer.
;ECX	- Buffer size.
;
;Notes:
;
;This buffer is used by the built in INT ?? API translation services,
;eg, INT 21h, AH=40h (write to file). The default buffer is 8k and uses memory
;that would otherwise be waisted. This default is sufficient for most file I/O
;but if you are writing a program that reads/writes large amounts of data you
;should consider allocateing your own larger buffer and pass the address to
;CauseWay to speed this file I/O.
;
GetDOSTrans	equ	0ff25h


;-------------------------------------------------------------------------------
;
;Set new address and size of the buffer used for DOS memory transfers.
;
;On Entry:
;
;BX	- Real mode segment of buffer.
;DX	- Protected mode selector for buffer.
;ECX	- Buffer size.
;
;Notes:
;
;This buffer is used by the built in INT ?? API translation services,
;eg, INT 21h, AH=40h (write to file). The default buffer is 8k and uses memory
;that would otherwise be waisted. This default is sufficient for most file I/O
;but if you are writing a program that reads/writes large amounts of data you
;should consider allocateing your own larger buffer and pass the address to
;CauseWay to speed this file I/O.
;
;The buffer must be in conventional memory and only the first 64k will be used
;even if a bigger buffer is specified. CauseWay will automaticaly restore the
;previous buffer setting when the application terminates but GetDOSTrans can
;be used to get the current buffer's settings if you only want the change to
;be temporary.
;
;You can still use the default buffer for your own puposes even after setting a
;new address.
;
SetDOSTrans	equ	0ff26h


;-------------------------------------------------------------------------------
;
;Get current MCB memory allocation block size.
;
;On Exit:
;
;ECX	- Current threshold.
;
GetMCBSize	equ	0ff27h


;-------------------------------------------------------------------------------
;
;Set new MCB memory allocation block size.
;
;On Entry:
;
;ECX	- New value to set.
;
;On Exit:
;
;Carry set on error else new value will be used.
;
;Notes:
;
;The maximum block size that will be allocated from MCB memory is 16 bytes less
;than the value set by this function. The default value is 16384.
;
;65536 is the maximum value this function will accept. Passing a value above
;this will return with the carry set and the origional value still in force.
;
;The CauseWay API memory allocation functions allocate memory from two sources.
;Allocation requests below the value returned by this function are allocated
;from a memory pool controled via conventional style MCB's. Requests above this
;value are allocated via the normal DPMI functions. Because DPMI memory is
;always allocated in multiples of 4k it can become very inificient for any
;program that needs to allocate small blocks of memory. The value set by this
;function controls the size of memory chunks that will be allocated to and
;managed by the MCB system.
;
;A value of zero can be passed to this function to disable the MCB allocation
;system.
;
;The value passed will be rounded up to the nearest 4k.
;
SetMCBMax	equ	0ff28h


;-------------------------------------------------------------------------------
;
;Run another CauseWay program directly.
;
;On Entry:
;
;DS:EDX	- File name.
;ES:ESI	- Command line. First byte is length, then real data.
;CX	- Environment selector, 0 to use existing copy.
;
;On Exit:
;
;Carry set on error and AX = error code else AL=ErrorLevel
;
;Error codes:
;
;1	- DOS file access error.
;2	- Not a 3P file.
;3	- Not enough memory.
;
;NOTES:
;
;Only the first byte of the command line (length) has any significance to
;CauseWay so you are not restricted to ASCII values. It is still stored in the
;PSP at 80h though so the length is still limited to 127 bytes.
;
cwExec	equ	0ff24h


;-------------------------------------------------------------------------------
;
;Load another CauseWay program as an overlay, ie, do relocations etc but don't
;actually execute it.
;
;On Entry:
;
;DS:EDX	- File name.
;
;On Exit:
;
;Carry set on error and AX = error code else,
;
;CX:EDX	- Entry CS:EIP
;BX:EAX	- Entry SS:ESP
;SI	- PSP.
;
;Error codes:
;
;1	- DOS file access error.
;2	- Not a 3P file.
;3	- Not enough memory.
;
;NOTES:
;
;The PSP returned in SI can be passed to RelMem to release the loaded programs
;memory and selectors. Only the memory and selectors allocated during loading
;will be released, it is the programs responsability to release any additional
;memory etc allocated while the program is running. Alternatively, if you pass
;the PSP value to INT 21h, AH=50h before makeing additional memory requests
;and then reset to the origional PSP the memory allocated will be released
;when the PSP is released.
;
cwLoad	equ	0ff2ah


;-------------------------------------------------------------------------------
;
;Validate and get expanded length of a CWC'd file.
;
;On Entry:
;
;BX	- File handle.
;
;On Exit:
;
;Carry set if not a CWC'd file else,
;
;ECX	- Expanded data size.
;
;NOTES:
;
;The file pointer is not altered by this function.
;
cwcInfo	equ	0ff2bh


;-------------------------------------------------------------------------------
;
;Load/Expand a CWC'd data file into memory.
;
;On Entry:
;
;BX	- Source file handle.
;ES:EDI	- Destination memory.
;
;On Exit:
;
;Carry set on error and EAX is error code else,
;
;ECX	- Expanded data length.
;
;Error codes:
;
;	1 = Error during file access.
;	2 = Bad data.
;	3 = Not a CWC'd file.
;
;NOTES:
;
;The source file's file pointer doesn't have to be at zero. A single file might
;be several CWC'd files lumped together and as long as the file pointer is moved
;to the right place before calling this function.
;
;If error codes 1 or 2 are reported then the file pointer will be where ever it
;was last moved to by this function. For error code 3 the file pointer will be
;back at its origional position on entry to this function. If no error occures
;then the file pointer will be moved to whatever comes after the compressed
;data.
;
cwcLoad	equ	0fffbh


;-------------------------------------------------------------------------------
;
;Structure of parameter table for real mode interupt and procedure calling.
;
;NOTE:- For interupts, CS:IP,SS:SP & Flags are filled in by the extender.
;       For far calls, SS:SP & Flags are filled in by the extender.
;
RealRegsStruc struc
Real_EDI	dd ?	;EDI
Real_ESI	dd ?	;ESI
Real_EBP	dd ?	;EBP
	dd ?	;Reserved.
Real_EBX	dd ?	;EBX
Real_EDX	dd ?	;EDX
Real_ECX	dd ?	;ECX
Real_EAX	dd ?	;EAX
Real_Flags	dw ?	;FLAGS
Real_ES	dw ?	;ES
Real_DS	dw ?	;DS
Real_FS	dw ?	;FS
Real_GS	dw ?	;GS
Real_IP	dw ?	;IP
Real_CS	dw ?	;CS
Real_SP	dw ?	;SP
Real_SS	dw ?	;SS
RealRegsStruc ends


;-------------------------------------------------------------------------------
;
;Now the extended PSP structure.
;
EPSP_Struc		struc
		db 256 dup (?)
 EPSP_Parent		dw ?		;Selector of parent/previous PSP, 0 for none.
 EPSP_Next		dw ?		;Next PSP.
 EPSP_Resource	dd ?		;Linear address of resource tracking table. 0
				;for none.
 EPSP_mcbHead	dd ?		;Linear address of MCB memory head. 0 for none.
 EPSP_mcbMaxAlloc	dd ?		;Size of MCB chunks.
 EPSP_DTA		df ?		;DTA address.
 EPSP_TransProt	dw ?		;Transfer buffer address.
 EPSP_TransReal	dw ?		;Transfer buffer real mode segment value.
 EPSP_TransSize	dd ?		;Transfer buffer size.
 EPSP_SSESP		df ?		;Return SS:ESP to use.
 EPSP_INTMem		dd ?		;linear address of interrupt/exception vector
				;save buffer. 0 for none.
 EPSP_DPMIMem	dw ?		;selector for DPMI state save buffer. 0 for
				;none.
 EPSP_MemBase	dd ?		;Program linear load address.
 EPSP_MemSize	dd ?		;Program memory size.
 EPSP_SegBase	dw ?		;Base program selector.
 EPSP_SegSize	dw ?		;Number of program selectors.

 EPSP_NearBase	dd ?		;NEAR function address translation base.

 EPSP_RealENV	dw ?		;Origional real mode environment SEGMENT.

 EPSP_NextPSP	dd ?		;Pointer to next PSP
 EPSP_LastPSP	dd ?		;Pointer to last PSP

 EPSP_Exports	dd ?		;Pointer to export list.
 EPSP_Imports	dd ?		;Pointer to import list.

 EPSP_Links		dd ?		;Count of linked modules.

 EPSP_ExecCount	dd ?		;PMode pointer to exec counter.

 EPSP_EntryCSEIP	df ?		;Entry CS:EIP for DLL's

 EPSP_PSPSel		dw ?		;This PSP's selector.

EPSP_Struc		ends


⌨️ 快捷键说明

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