******************************************* Swallow v1.0 DOS-Extender fr Turbo Pascal und C++ Short description of Assembler-API functions. For further details see also Swallow.Hlp. (c) 1995 by Thomas Kurschel ******************************************* All functions has to be called via Int 32h with function code in ax. If knf_NoCheck is added to the function code, errors will be returned by setting the carry flag and passing the error code in ax, else the program will be aborted with a detailed error message. knf_AllocLD Allocate a local descriptor -> ax - selector knf_FreeLD Free a local descriptor bx - selector knf_Seg2Selector Allocate an alias descriptor of a V86-Mode segment bx - V86-Mode segment -> ax - selector knf_GetSegBase Get the base address of a segment bx - selector of the segment -> edx - linear base address knf_SetSegBase Set the base address of a segment bx - selector of the segment edx - linear base address knf_SetSegSize Set the size of a segment bx - selector edx - segment size knf_SetDesRights Set the access rights of a descriptor bx - selector cx - access rights (cl=standard rights, ch=extended rights) knf_SetWholeDes Set all parameters of a descriptor bx - selector cx - access rights (cl=standard rights, ch=extended rights) edi - linear base address edx - segment size knf_AllocInitLD Allocate a local descriptor and set all parameters of it ebx - linear base address cx - access rights (cl=standard rights, ch=extended rights) edx - segment size -> ax - selector knf_AllocAliasLD Allocate an alias descriptor of a code segment bx - selector (of the code segment) -> ax - selector (of the alias descriptor) knf_AllocDosMem Allocate a DOS memory block bx - size in paragraphs (=16 bytes) -> ax - V86-Move segment dx - selector (corresponding to the V86-Mode segment) knf_FreeDosMem Free a DOS memory block bx - selector knf_ResizeDosMem Resize a DOS memory block bx - selector cx - new size in paragraphs (=16 bytes) knf_GetLinearMemInfo Get information about free memory on the part of the linear memory manager -> eax - free virtual memory ebx - free linear memory ecx - largest free memory block edx - lockable memory knf_AllocLinearMem Allocate linear addresses/memory ebx - size in bytes edx - Bit 0 0=uncommitted 1=committed -> eax - handle ebx - linear base address knf_FreeLinearMem Free linear addresses/memory ebx - handle knf_ResizeLinearMem Resize linear memory block ebx - handle ecx - new size edx - Bit 0 0=uncommitted 1=committed esi - number of selectors to update es:edi - table of selectors to update (each 2 bytes) -> eax - new handle ebx - new linear base address knf_LockLinearMem Lock linear memory ebx - handle ecx - number of bytes edx - start offset relative to base address knf_UnlockLinearMem Unlock linear memory ebx - handle ecx - number of bytes edx - start offset relative to base address esi - number of unlocks knf_DiscardLinearMem Discard linear memory ebx - handle ecx - number of bytes edx - start offset relative to base address knf_CommitLinearMem Commit virtual memory to linear addresses ebx - handle ecx - number of bytes edx - start offset relative to base address knf_UncommitLinearMem Uncommit virtual memory of linear addresses ebx - handle ecx - number of bytes edx - start offset relative to base address knf_GetWatchedMemInfo Get size of free watched memory -> ebx - whole free memory ecx - largest free memory block knf_GetWatchedLockedMemInfo Get size of free watched lockable memory -> ebx - whole free locked allocable memory ecx - largest free locked allocable memory block knf_AllocWatchedMem Allocate a watched memory block ebx - size in bytes cl - attributes Bit 7 = 1-Cleared/0-Not Cleared Bit 6 = Default Operation Size/Big Bit Bit 4 = 1-Locked Mem/0-Unlocked Mem Bit 3 = 1-Code Segment/0-Data Segment Bit 1 = Write Permission/Read Permission Bit 0 = (Accessed) normally 0 -> ax - selector (block begins at offset 0) knf_FreeWatchedMem Free watched memory block bx - selector knf_ResizeWatchedMem Resize a watched memory block bx - selector ecx - new size in bytes knf_LockWatchedMem Lock a watched memory block bx - selector knf_UnlockWatchedMem Unlock a watched memory block bx - selector knf_GetUnwatchedMemInfo Get free memory -> ebx - whole free memory ecx - largest free memory block knf_AllocUnwatchedMem Allocate a memory block ebx - size in bytes -> cx:edx - address of the memory block knf_FreeUnwatchedMem Free a memory block cx:edx - address of the memory block knf_AllocCallBack Allocate a callback cx:edx - address of the procedure to call -> cx:dx - V86-Mode address of callback for Far Call-instruction bx:ax - callback-entry for Int-instructions knf_ReleaseCallBack Free callback-entry cx:dx - V86-Mode callback address for Far Call-instruction knf_GetProtIntVec Get address of a software interrupt handler bl - interrupt number -> cx:edx - address of the handler knf_SetProtIntVec Set address of a software interrupt handler bl - interrupt number cx:dx - address of new handler knf_XchgProtIntVec Exchange address of a software interrupt handler bl - interrupt number cx:dx - address of new handler es:esi - DWord Ptr to store address of previous handler knf_GetUserIRQ Get address of a hardware interrupt handler bl - IRQ number -> cx:dx - address of the handler knf_SetUserIRQ Get address of a hardware interrupt handler bl - IRQ number cx:dx - address of new handler knf_XchgUserIRQ Exchange address of a hardware interrupt handler bl - IRQ number cx:dx - address of new handler es:esi - DWord Ptr to store address of previous handler knf_GetUserExc Get address of an exception handler bl - exception number -> cx:edx - address of the handler knf_SetUserExc Set address of an exception handler bl - exception number cx:edx - address of new handler knf_XchgUserExc Exchange address of an exception handler bl - exception number cx:edx - address of new handler es:esi - PWord Ptr to store address of previous handler knf_CallV86Int Call V86-Mode interrupt handler es:edx - pointer to parameter block _par_v86int 0w - ds ) 2w - es ) V86-Mode segments 4w - fs ) 6w - gs ) 8d - eax 12d - edx 16d - Int (0..255, only lowbyte regarded) -> [es:edx] is filled with return values of the handler eax - return value eax of the handler efl - return value efl of the handler knf_CallV86Proc Call V86-Mode far procedure es:edx - pointer to parameter block _par_v86proc 0w - ds ) 2w - es ) V86-Mode segments 4w - fs ) 6w - gs ) 8d - eax 12d - edx 16d - V86-Mode target address -> [es:edx] is filled with return values of the handler eax - return value eax of the handler efl - return value efl of the handler knf_CallV86IRet Call V86-Mode procedure returning via IRet es:edx - pointer to paramter block _par_v86proc 0w - ds ) 2w - es ) V86-Mode segments 4w - fs ) 6w - gs ) 8d - eax 12d - edx 16d - V86-Mode target address -> [es:edx] is filled with return values of the handler eax - return value eax of the handler efl - return value efl of the handler knf_AllocDMABuffer Allocate a DMA buffer ecx - size in Bytes (<= 16 KByte) -> ebx - physical address of buffer cx:dx - address of buffer knf_ReleaseDMABuffer Release a DMA buffer cx:dx - address of buffer knf_UseBaseMem Enable use of DOS memory bx - size of left free DOS memory in paragraphs (=16 bytes) Attention: - if you install an own Int 24 handler (=Critical Error) a block of 512 will be allocated automatically - if you call knf_InitSwapFile 32 KByte will be needed additionally - cannot be called after knf_ShrinkMem - should be called after knf_UseBaseMem - this function can be called only 1x knf_ShrinkMem (nur 1x nutzbar) Shrink amount of extended memory used by Swallow ebx - size of left free Swallow memory Attention: - cannot be called knf_UseBaseMem - can be called only 1x knf_Terminate Terminate program cl - exit code knf_InitSwapFile (nur 1x nutzbar) Create swap file bl - drive 0 = current directory 3... = C... -1 = "TEMP" directory ecx - size of left free hard disk space (0=the half) Attention: - can be used only 1x - the whole space space will be allocated, not step by step - should be called before knf_UseBaseMem knf_SetBreakCheck Set flag, wether Ctrl-Alt-Numlock should be checked bl - 0 = disable check 1 = enable check -> al - old state knf_GetSelName Get name of a selector bx - selector ecx - size of buffer (up to 14 bytes) es:edx - ASCIIZ buffer (will be filled with space) knf_SetSelName Set name of a selector bx - selector ecx - size of name (incl. zero byte) es:edx - name (ASCZII, up to 14 characters + zero) knf_GetPhysAddr (internal use only) Calculate physical address of linear address cx:edx - Pointer -> ecx - physikalische Adresse (funktioniert nicht bei DPMI-Server) ; ; Fehlercodes: ; 0000h-7FFFh DOS error code 8001h Unsupported function 8002h Object is in wrong state for this function 8003h System integrity would be endangered 8004h Deadlock detected (DPMI only) 8005h Pending serialization request cancelled (DPMI only) 8010h out of internal resources (e.g. DMA buffer) 8011h Out of descriptors 8012h Out of linear memory 8013h Out of physical memory 8014h NEW: Out of virtual memory 8015h Out of call back entries 8016h Out of handles 8017h Maximum count of locks exceeded 8018h Shared memory already serialized exclusively by another (DPMI only) 8019h Shared memory already serialized shared by another client (DPMI only) 801ah NEW: Requested DOS memory not available 801bh NEW: Function not supported by Real Mode emulator 8021h Invalid value of numeric or flag parameter 8022h Invalid segment selector 8023h Invalid handle 8024h Invalid callback address 8025h Invalid linear address 8026h Request not supported by hardware (DPMI only) 8030h NEW: Invalid unwatched address 8040h NEW: Malfunction of external DPMI-server