tinyio.h

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 1,980 行 · 第 1/5 页

H
1,980
字号
        "sbb    eax,eax",  /* eax=-1 if alloc failed */ \
        "inc    eax",      /* eax=0  if alloc failed */ \
        "je     short L1",\
        "mov    ax,bx",    /* linear address returned in BX:CX */ \
        "shl    eax,16",\
        "mov    ax,cx", \
        "mov    [eax],di", /* store new handle in block */ \
        "mov    2[eax],si",/* ... */ \
        "L1:"           \
        parm caller     [eax] [bx] [cx] \
        value           [eax] \
        modify exact    [eax ebx ecx esi edi];

#pragma aux             _TinyDPMIFree = \
        "mov ah,5"      \
        "mov al,2"      \
        "int 31h"       \
        parm caller     [si] [di] \
        modify exact    [eax esi edi];

#pragma aux             _TinyDPMIBase = \
        "mov ah,0"      \
        "mov al,6"      \
        "int 31h"       \
        "mov eax,ecx"   \
        "shl eax,16"    \
        "mov ax,dx"     \
        parm caller     [bx] \
        value           [eax] \
        modify exact    [eax ebx ecx edx];

#pragma aux             _TinyDPMIDOSAlloc = \
        "mov ah,1"      \
        "mov al,0"      \
        "int 31h"       \
        "sbb ebx,ebx"   \
        "not ebx"       \
        "shl eax,16"    \
        "mov ax,dx"     \
        "and eax,ebx"   \
        parm caller     [bx] \
        value           [eax] \
        modify exact    [eax ebx edx];

#pragma aux             _TinyDPMIDOSFree = \
        "mov ah,1"      \
        "mov al,1"      \
        "int 31h"       \
        parm caller     [dx] \
        modify exact    [eax edx];

#pragma aux             _TinyDPMIGetRealVect = \
        "mov ah,2"      \
        "mov al,0"      \
        "int 31h"       \
        "shl ecx,16"    \
        "mov cx,dx"     \
        parm caller     [bl] \
        value           [ecx] \
        modify exact    [eax ebx ecx edx];

#pragma aux             _TinyDPMISetRealVect = \
        "mov ah,2"      \
        "mov al,1"      \
        "int 31h"       \
        "sbb eax,eax"   \
        parm caller     [bl] [cx] [dx] \
        value           [eax] \
        modify exact    [eax ebx ecx edx];

#pragma aux             _nTinyAccess = \
        _XOR_AX_AX      \
        _MOV_AH DOS_CHMOD    \
        _INT_21         \
        _JC 0x0f       /* -> L1 */ \
        _TEST_BL 0x02  \
        _JZ 0x0a       /* -> L1 */ \
        _TEST_CL 0x01  \
        _JZ 0x05       /* -> L1 */ \
        _MOV_AL 0x00    \
        _MOV_AH EACCES  \
        _STC            \
        _SBB_CX_CX      /* L1: */ \
        _USE16 _MOV_CX_AX   /* Even though we are in 32-bit mode, */    \
        _MOV_AX_CX      /* ^ Use 16-bit registers */ \
        parm caller     [edx] [bx] \
        value           [eax] \
        modify exact    [eax ecx];

#pragma aux             _nTinyOpen = \
        "mov ah,3Dh"    \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [edx] [al] \
        value           [eax];

#pragma aux             _nTinyCreate = \
        "mov ah,3Ch"    \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [edx] [ecx] \
        value           [eax];

#ifdef __WATCOM_LFN__
#pragma aux             _nTinyCreateEx = \
        "mov ax,716Ch"  \
        "push ecx"      \
        _INT_21         \
        "pop ecx"       \
        "jc old"        \
        "cmp ax,7100h"  \
        "jnz finish"    \
        "old:"          \
        "mov ax,6C00h"  \
        _INT_21         \
        "finish:"       \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [esi] [ebx] [ecx] [edx]\
        value           [eax];
#else
#pragma aux             _nTinyCreateEx = \
        "mov ax,6C00h"  \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [esi] [ebx] [ecx] [edx]\
        value           [eax];
#endif

#pragma aux             _nTinyCreateNew = \
        "mov ah,5Bh"    \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [edx] [ecx] \
        value           [eax];

#ifdef __WATCOM_LFN__
#pragma aux             _nTinyCreateTemp = \
        "push ecx"      \
        "mov esi,edx"   \
        "mov cl,1"      \
        "mov ch,0"      \
        "mov ax,7160h"  \
        _INT_21         \
        "pop ecx"       \
        "jc callfunc"   \
        "cmp ax,7100h"  \
        "jz callfunc"   \
        "mov edx,edi"   \
        "callfunc:"     \
        "mov ah,5Ah"    \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [edx] [ecx] \
        value           [eax];
#else
#pragma aux             _nTinyCreateTemp = \
        "mov ah,5Ah"    \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [edx] [ecx] \
        value           [eax];
#endif

#pragma aux             _TinyClose = \
        "mov ah,3Eh"    \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [bx] \
        value           [eax];

#pragma aux             _TinyCommitFile = \
        "mov ah,68h"    \
        "clc"           \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [bx] \
        value           [eax];

#pragma aux             _nTinyWrite = \
        "mov ah,40h"    \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [bx] [edx] [ecx] \
        value           [eax];

#pragma aux             _nTinyRead = \
        "mov ah,3Fh"    \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [bx] [edx] [ecx] \
        value           [eax];

#pragma aux             _fTinyRead = \
        "push ds"       \
        "xchg edx,eax"  \
        "mov ds,ax"     \
        "mov ah,3Fh"    \
        _INT_21         \
        "pop ds"        \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [bx] [dx eax] [ecx] \
        value           [eax];

#pragma aux             _TinyLSeek = \
        "mov ah,42h"    \
        "mov ecx,edx"   \
        "shr ecx,16"    \
        _INT_21         \
        "mov ss:[edi],ax"   \
        "mov ss:2[edi],dx"  \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [bx] [edx] [al] [edi] \
        value           [eax] \
        modify exact    [eax ebx ecx edx];

#pragma aux             _TinySeek = \
        "mov ah,42h"    \
        "mov ecx,edx"   \
        "shr ecx,16"    \
        _INT_21         \
        "rcl dx,1"      \
        "ror dx,1"      \
        "shl edx,16"    \
        "mov dx,ax"     \
        parm caller     [bx] [edx] [al] \
        value           [edx] \
        modify exact    [eax ebx ecx edx];

#ifdef __WATCOM_LFN__
#pragma aux             _nTinyDelete = \
        "mov si,0"      \
        "mov ax,7141h"  \
        _INT_21         \
        "jc old"        \
        "cmp ax,7100h"  \
        "jnz finish"    \
        "old:"          \
        "mov ah,41h"    \
        _INT_21         \
        "finish:"       \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [edx] \
        value           [eax];
#else
#pragma aux             _nTinyDelete = \
        "mov ah,41h"    \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [edx] \
        value           [eax];
#endif

// 06/22/95 T. Schiller
//
// The only reason we save/restore ebx is that in win386 the high word of
// ebx sometimes (one known cause is that the File Manager is running) gets
// trashed.
#ifdef __WATCOM_LFN__
#pragma aux             _nTinyRename = \
        "push ebx"      \
        "push es"       \
        "mov es,cx"     \
        "mov ax,7156h"  \
        _INT_21         \
        "jc old"        \
        "cmp ax,7100h"  \
        "jnz finish"    \
        "old:"          \
        "mov ah,56h"    \
        _INT_21         \
        "finish:"       \
        "rcl eax,1"     \
        "ror eax,1"     \
        "pop es"        \
        "pop ebx"       \
        parm caller     [edx] [cx edi]\
        value           [eax];
#else
#pragma aux             _nTinyRename = \
        "push ebx"      \
        "push es"       \
        "mov es,cx"     \
        "mov ah,56h"    \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        "pop es"        \
        "pop ebx"       \
        parm caller     [edx] [cx edi]\
        value           [eax];
#endif

#ifdef __WATCOM_LFN__
#pragma aux             _nTinyMakeDir = \
        "mov ax,7139h"  \
        _INT_21         \
        "jc old"        \
        "cmp ax,7100h"  \
        "jnz finish"    \
        "old:"          \
        "mov ah,39h"    \
        _INT_21         \
        "finish:"       \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [edx] \
        value           [eax];
#else
#pragma aux             _nTinyMakeDir = \
        "mov ah,39h"    \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [edx] \
        value           [eax];
#endif

#ifdef __WATCOM_LFN__
#pragma aux             _nTinyRemoveDir = \
        "mov ax,713Ah"  \
        _INT_21         \
        "jc old"        \
        "cmp ax,7100h"  \
        "jnz finish"    \
        "old:"          \
        "mov ah,3Ah"    \
        _INT_21         \
        "finish:"       \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [edx] \
        value           [eax];
#else
#pragma aux             _nTinyRemoveDir = \
        "mov ah,3Ah"    \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [edx] \
        value           [eax];
#endif

#ifdef __WATCOM_LFN__
#pragma aux             _nTinyChangeDir = \
        "mov ax,713Bh"  \
        _INT_21         \
        "jc old"        \
        "cmp ax,7100h"  \
        "jnz finish"    \
        "old:"          \
        "mov ah,3Bh"    \
        _INT_21         \
        "finish:"       \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [edx] \
        value           [eax];
#else
#pragma aux             _nTinyChangeDir = \
        "mov ah,3Bh"    \
        _INT_21         \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [edx] \
        value           [eax];
#endif

#ifdef __WATCOM_LFN__
#pragma aux             _nTinyGetCWDir = \
        "mov ax,7147h"  \
        _INT_21         \
        "jc old"        \
        "cmp ax,7100h"  \
        "jnz finish"    \
        "old:"          \
        "mov ah,47h"    \
        _INT_21         \
        "finish:"       \
        "rcl eax,1"     \
        "ror eax,1"     \
        parm caller     [esi] [dl] \

⌨️ 快捷键说明

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