📄 cw.inc
字号:
;SI:DI - selector:offset of allocated memory.
;
GetMemSO equ 0ff2ch
;-------------------------------------------------------------------------------
;
;Allocate a block of memory.
;
;On Entry:
;
;ECX - Size of block required in bytes. (-1 to get maximum memory size)
;
;On Exit:
;
;Carry clear if OK &
;
;BX - Selector to access the block with.
;
;Else if ECX was -1, ECX 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.
;
GetMem32 equ 0ff0ch
;-------------------------------------------------------------------------------
;
;Re-size a previously allocated block of memory.
;
;On Entry:
;
;BX - Selector for block.
;CX:DX - New size of block required in bytes.
;
;On Exit:
;
;Carry clear if OK.
;
;NOTES:
;
;If the memory block can't be re-sized in its current location, but a free block
;of memory of the new size exists, the memory will be copied to a new block and
;the old one released. This is transparent to the application as long as only
;the selector origionaly allocated with GetMem is being used to access the
;memory.
;
ResMem equ 0ff0dh
;-------------------------------------------------------------------------------
;
;Re-size a block of memory allocated via GetMemSO.
;
;On Entry:
;
;SI:DI - Selector:offset for block.
;CX:DX - New size of block required in bytes.
;
;On Exit:
;
;Carry set on error else,
;
;SI:DI - selector:offset new block address.
;
ResMemSO equ 0ff2dh
;-------------------------------------------------------------------------------
;
;Re-size a previously allocated block of memory.
;
;On Entry:
;
;BX - Selector for block.
;ECX - New size of block required in bytes.
;
;On Exit:
;
;Carry clear if OK.
;
;NOTES:
;
;If the memory block can't be re-sized in its current location, but a free block
;of memory of the new size exists, the memory will be copied to a new block and
;the old one released. This is transparent to the application as long as only
;the selector origionaly allocated with GetMem is being used to access the
;memory.
;
ResMem32 equ 0ff0eh
;-------------------------------------------------------------------------------
;
;Release previously allocated block of memory. Is be used for memory allocated
;by either GetMem or GetMem32.
;
;
;On Entry:
;
;BX - Selector for block to release.
;
RelMem equ 0ff0fh
;-------------------------------------------------------------------------------
;
;Release block of memory allocated via GetMemSO.
;
;On Entry:
;
;SI:DI - Selector:offset for block to release.
;
RelMemSO equ 0ff2eh
;-------------------------------------------------------------------------------
;
;Allocate a block of memory without a selector.
;
;On Entry:
;
;CX:DX - Size of block required in bytes.
;
;On Exit:
;
;Carry clear if OK &,
;
;SI:DI - Linear address of block allocated.
;
;NOTES:
;
;Addresses returned by this function may be >16M
;
GetMemLinear equ 0ff10h
;-------------------------------------------------------------------------------
;
;Allocate a block of memory without a selector.
;
;On Entry:
;
;ECX - Size of block required in bytes.
;
;On Exit:
;
;Carry clear if OK &,
;
;ESI - Linear address of block allocated.
;
;NOTES:
;
;Addresses returned by this function may be >16M
;
GetMemLinear32 equ 0ff11h
;-------------------------------------------------------------------------------
;
;Re-size a previously allocated block of memory without a selector.
;
;On Entry:
;
;SI:DI - Linear address of block to re-size.
;CX:DX - Size of block required in bytes.
;
;On Exit:
;
;Carry clear if OK &,
;
;SI:DI - New linear address of block.
;
;NOTES:
;
;If the memory block cannot be expanded to the desired size, and a free block
;of sufficient size exists, the existing memory will be copied to the free
;block and released, the new block then being alocated in place of the old.
;
ResMemLinear equ 0ff12h
;-------------------------------------------------------------------------------
;
;Re-size a previously allocated block of memory without a selector.
;
;On Entry:
;
;ESI - Linear address of block to re-size.
;ECX - Size of block required in bytes.
;
;On Exit:
;
;Carry clear if OK &,
;
;ESI - New linear address of block.
;
;NOTES:
;
;If the memory block cannot be expanded to the desired size, and a free block
;of sufficient size exists, the existing memory will be copied to the free
;block and released, the new block then being alocated in place of the old.
;
ResMemLinear32 equ 0ff13h
;-------------------------------------------------------------------------------
;
;Release previously allocated block of memory (linear address).
;
;On Entry:
;
;SI:DI - Linear address of block to release.
;
;On Exit:
;
RelMemLinear equ 0ff14h
;-------------------------------------------------------------------------------
;
;Release previously allocated block of memory (linear address).
;
;On Entry:
;
;ESI - Linear address of block to release.
;
;On Exit:
;
RelMemLinear32 equ 0ff15h
;-------------------------------------------------------------------------------
;
;Allocate an application relative block of memory.
;
;On Entry:
;
;EBX - Size of block required in bytes.
;
;On Exit:
;
;Carry clear if OK &,
;
;ESI - Application relative linear address of block allocated.
;
;NOTES:
;
;Addresses returned by this function are as an offset from the application.
;
GetMemNear equ 0ff16h
;-------------------------------------------------------------------------------
;
;Re-size a previously allocated application relative block of memory.
;
;On Entry:
;
;EBX - Size of block required in bytes.
;ESI - application relative linear address of block to re-size.
;
;On Exit:
;
;Carry clear if OK &,
;
;ESI - New application relative linear address of block.
;
;NOTES:
;
;If the memory block cannot be expanded to the desired size, and a free block
;of sufficient size exists, the existing memory will be copied to the free
;block and released, the new block then being allocated in place of the old.
;
ResMemNear equ 0ff17h
;-------------------------------------------------------------------------------
;
;Release previously allocated application relative block of memory.
;
;On Entry:
;
;ESI - Application relative linear address of block to release.
;
;On Exit:
;
RelMemNear equ 0ff18h
;-------------------------------------------------------------------------------
;
;Convert linear address to application relative address.
;
;On Entry:
;
;ESI - Linear address to convert.
;
;On Exit:
;
;ESI - Application relative linear address.
;
Linear2Near equ 0ff19h
;-------------------------------------------------------------------------------
;
;Convert application relative address to linear address.
;
;On Entry:
;
;ESI - Application relative linear address.
;
;On Exit:
;
;ESI - Linear address to convert.
;
Near2Linear equ 0ff1ah
;-------------------------------------------------------------------------------
;
;Lock a region of memory.
;
;On Entry:
;
;BX:CX - Starting linear address of memory to lock.
;SI:DI - Size of region to lock in bytes.
;
;On Exit:
;
;Carry set on error, none of the memory locked, else memory is locked.
;
;NOTES:
;
;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.
;
LockMem equ 0ff1bh
;-------------------------------------------------------------------------------
;
;Lock a region of memory.
;
;On Entry:
;
;ESI - Starting linear address of memory to lock.
;ECX - Size of region to lock in bytes.
;
;On Exit:
;
;Carry set on error, none of the memory locked, else memory is locked.
;
;NOTES:
;
;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.
;
LockMem32 equ 0ff1ch
;-------------------------------------------------------------------------------
;
;Un-lock a region of memory.
;
;On Entry:
;
;BX:CX - Starting linear address of memory to unlock
;SI:DI - 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.
;
UnLockMem equ 0ff1dh
;-------------------------------------------------------------------------------
;
;Un-lock a region of memory.
;
;On Entry:
;
;ESI - Starting linear address of memory to unlock
;ECX - 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.
;
UnLockMem32 equ 0ff1eh
;-------------------------------------------------------------------------------
;
;Lock a region of memory using application relative address.
;
;On Entry:
;
;ESI - Starting linear address of memory to lock.
;EBX - Size of region to lock in bytes.
;
;On Exit:
;
;Carry set on error, none of the memory locked, else memory is locked.
;
;NOTES:-
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -