/*
 * CopyRight 1995. Nicholas Poljakov all rights reserved.
 */
#include <stdio.h>
#include <dos.h>
#include <tps.h>
#include <malloc.h>
#include <state1.h>

 tp_started (lu_id,tp_id,
             rc)

unsigned char lu_id[8];

unsigned char tp_id[8];
unsigned long *rc;


 {
    union REGS inregs,outregs;
    struct SREGS segregs;
       char _near *dp1;
       char _near *dp2;

  struct tp_started *ptr;

  if ((ptr = (char *)calloc(1,sizeof(struct tp_started))) == NULL) {
  *rc = PORT_BUSY; /* нет доступной памяти */
  return(0);
       }
  ptr->verb_cd=TP_STARTED;
  memcpy(ptr->lu_id,lu_id,8);
/*
     inregs.x.dx = FP_OFF(ptr);
     segregs.ds = FP_SEG(ptr);
     inregs.x.ax = ptr->verb_cd;

         int86x(0x68,&inregs,&outregs,&segregs);
 */
     dp1 = FP_OFF( ptr );
     dp2 = FP_SEG( ptr );
     _asm
         {
            push  ds
            mov   dx, word ptr dp1[0]
            mov   ax, word ptr dp2[0]
	    mov   ds, ax
        mov   ax, TP_STARTED
            int   68h
            pop   ds
         }

 memcpy(tp_id,ptr->tp_id,8);
 *rc = ptr->rc;

 free(ptr);

 return(0);
 }
