All pastes #241811 Raw Edit

Blair

public text v1 · immutable
·published 2006-11-06 17:33 UTC
rendered paste body
#include <dos.h>
#include <string.h>

unsigned short __callint( void *inout );
#pragma aux __callint =             \
    "push bp"       /*1*/           \
    "push es"       /*2*/           \
    "push bx"       /*3*/           \
    "push ds"       /*4*/           \
    "push di"       /*5*/           \
    "mov ax,  [di]"                 \
    "mov bx, 2[di]"                 \
    "mov cx, 4[di]"                 \
    "mov dx, 6[di]"                 \
    "mov si, 8[di]"                 \
    "mov es,12[di]"                 \
    "mov bp,18[di]"                 \
    "mov di,10[di]"                 \
    "mov ds, bp"                    \
    "stc"                           \
    "int 0x21"                      \
    "push ds"       /*6*/           \
    "push di"       /*7*/           \
    "mov bp, sp"                    \
    "mov di, 4[bp]"                 \
    "mov ds, 6[bp]"                 \
    "mov   [di], ax"                \
    "pushf"         /*8*/           \
    "pop ax" /* flags(7) */         \
    "mov 20[di], ax"                \
    "mov  2[di], bx"                \
    "mov  4[di], cx"                \
    "mov  6[di], dx"                \
    "mov  8[di], si"                \
    "pop 10[di]"    /*6*/           \
    "pop ax"        /*5*/           \
    "pop bx"        /*4*/           \
    "pop ds"        /*3*/           \
    "pop bx"        /*2*/           \
    "mov 18[di], ax"                \
    "mov 12[di], es"                \
    "sbb ax, ax" /* ax=<0 if cf */  \
    "pop es"        /*1*/           \
    "pop bp"                        \
    parm caller     [di]            \
    value           [ax]            \
    modify          [bx cx dx si di];

int _callint( union INTR *regs )
{
    register short retval;

    retval = __callint( regs );
    if( regs->flags & 1 ) regs->cflag = 1;

    return( regs->ax );
}