{
   That is my experiences of the interface:
   This Hard&SoftWare Complex is EMULATOR MKE ON LPT.
   But I have 'little' problem - I can't READ byte
   from drive, but I try to do it.
>   Other than reset, I didn't have much luck.
   I didn't have much luck, too.
   But I RESET the drive by COMMAND $0A.
   That's all.
                     Mike 'BIOS' Ohotin

   MailTo: bioser@mail.ru
   Sorry for my english ;)

----------------------------------------------------------
   Connector MKE2LPT:

   1  #STROBE   --------> CD-Write              10
   2  D0        <-------> D0                    40
   3  D1        <-------> D1                    39
   4  D2        <-------> D2                    38
   5  D3        <-------> D3                    36
   6  D4        <-------> D4                    35
   7  D5        <-------> D5                    34
   8  D6        <-------> D6                    32
   9  D7        <-------> D7                    31
   10 #ACK      <-------- Status Bit 3          28
   11 BUSY      <--------
   12 PE        <-------- Status Bit 2          24
   13 SELECT    <-------- Status Bit 1          20
   14 #AUTOLF   --------> CD-Read               12
   15 #ERROR    <-------- Status Bit 0          14
   16 #INIT     --------> CD-Data Enable        22
   17 #SELECTIN --------> CD-Status/Data Enable 26

----------------------------------------------------------
   Source code (Turbo Pascal 7.0) of EMULATOR:

}

{$A+,B-,D+,E+,F+,G+,I+,L+,N+,O-,P+,Q-,R-,S+,T-,V+,X+}
{$M 16384,0,655360}
program MKE2LPT;

uses crt;

const PBase=$378;

      PData=PBase;
      PStatus=PBase+1;
      PControl=PBase+2;

      NA=$04;
      W0=$09;
      R0=$2A;
      R2=$22;

type ASignal=(Active,Passive);
     NSignal=(CD_W,CD_R,CD_DE,CD_SDE);
     PMode=(PWrite,PRead);

     St2=string[2];
     St4=string[4];

function HexByte(B:byte):St2;
var B1,B2:byte;
begin
 B1:=B shr $4;
 B2:=B and $F;
 if B1<10 then inc(B1,48) else inc(B1,55);
 if B2<10 then inc(B2,48) else inc(B2,55);
 HexByte:=Chr(B1)+Chr(B2);
end;

function HexWord(W:word):St4;
begin
 HexWord:=HexByte(Hi(W))+HexByte(Lo(W));
end;

procedure SetSignal(N:NSignal;A:ASignal);
var B:byte;
begin
 B:=port[PBase+2];
 case N of
    CD_W:if A=Active then B:=B or  $01 else B:=B and $FE;
    CD_R:if A=Active then B:=B or  $02 else B:=B and $FD;
   CD_DE:if A=Active then B:=B and $FB else B:=B or  $04;
  CD_SDE:if A=Active then B:=B or  $08 else B:=B and $F7;
 end;
 port[PBase+2]:=B;
end;

function ReadSL:byte;
begin
 ReadSL:=(port[PBase+1] and $78)shr 3;
end;

procedure WriteDL(B:byte);
begin
 port[PBase]:=B;
end;

procedure ResetBus;assembler;
asm
 mov  dx,PControl
 mov  al,NA
 out  dx,al
 mov  dx,PData
 mov  al,0
 out  dx,al
end;

function Bits(B:byte):string;
var S:string[8];
    I:byte;
begin
 S:='00000000';
 for I:=0 to 7 do
  begin
   if B and(1 shl I)<>0 then s[8-I]:='1';
  end;
 Bits:=S;
end;

procedure WritePort(N,B:byte);
begin
 repeat until ReadSL and$08=0;
 case N of
  0:asm
     mov  dx,PData
     mov  al,B
     out  dx,al
     mov  al,W0
     mov  dx,PControl
     out  dx,al
     mov  cx,$2000
  @1:loop @1
     mov  al,NA
     out  dx,al
    end;
 end;
end;

function ReadPort(N:byte):byte;
var B:byte;
begin
 case N of
  0:asm
     mov  dx,PControl
     mov  al,R0
     out  dx,al
     mov  dx,PData
     mov  cx,$1000
  @1:loop @1
     in   al,dx
     mov  B,al
     mov  dx,PControl
     mov  al,NA
     out  dx,al
    end;
  1:B:=ReadSL;
  2:asm
     mov  dx,PControl
     mov  al,R2
     out  dx,al
     mov  dx,PData
     mov  cx,$1000
  @1:loop @1
     in   al,dx
     mov  B,al
     mov  dx,PControl
     mov  al,NA
     out  dx,al
    end;
 end;
 ReadPort:=B;
end;

procedure Command(Code,B1,B2,B3,B4,B5,B6:byte);
begin
 WritePort(0,Code);
 WritePort(0,B1);
 WritePort(0,B2);
 WritePort(0,B3);
 WritePort(0,B4);
 WritePort(0,B5);
 WritePort(0,B6);
end;

var Response:array[0..15]of byte;

procedure GetResponse;
var I:byte;
begin
 fillchar(Response,11,0);
 I:=0;
 repeat
  inc(I);
  Response[I]:=ReadPort(0);
 until ReadSL and$04<>0;
 Response[0]:=I;
end;

procedure ResetDrive;
begin
 Command($0A,0,0,0,0,0,0);
 clrscr;
end;

var A:byte;
    C:char;

begin
 ResetBus;

 ResetDrive;

 repeat
  A:=ReadPort(1);
  gotoxy(1,1);
  writeln(Bits(A));
  if Response[0]<>0 then
   begin
    clreol;
    for A:=1 to Response[0] do
     write(HexByte(Response[A]),' ');
    Response[0]:=0;
   end;

  if keypressed then
   begin
    c:=UpCase(readkey);
    case c of
     'R':ResetDrive;{No Comments}
     'A':begin
          WritePort(0,$08);{Abort}
          GetResponse;
         end;
     'S':begin
          Command($02,0,0,0,0,0,0);{Spin Up}
          GetResponse;
         end;
     'I':begin
          Command($07,0,0,0,0,0,0);{Eject}
          GetResponse;
         end;
     'O':begin
          Command($06,0,0,0,0,0,0);{Close}
          GetResponse;
         end;
     'V':begin
          Command($83,0,0,0,0,0,0);{Version}
          GetResponse;
         end;
     'C':begin
          Command($85,0,0,0,0,0,0);{Capacity}
          GetResponse;
         end;
     'E':begin
          Command($82,0,0,0,0,0,0);{Read Error}
          GetResponse;
         end;

    end;
   end;
 until c=#27;
end.