home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol250 / transfer.txt < prev    next >
Encoding:
Text File  |  1986-02-11  |  20.0 KB  |  839 lines

  1. ; An article relating to the following code appeared in the Vol 1 No 5
  2. ; issue of Micro/Systems Journal and is presented here with the per-
  3. ; mission of the publisher. The code alone should be sufficient to
  4. ; use the program.  However, back copies of the article are available from
  5. ; Micro/Systems Journal, Box 1192, Mountainside, NJ 07092.
  6. \p\#13
  7. program Comm;
  8. {$V-,K-}
  9.  
  10. {Program emulates a Hazeltine 1500 terminal and supports 2 way file}
  11. {transfers between the PC and a Serially-interfaced Computer}
  12. { Host Computer   IBM-PC 256K ram}
  13. { Target Computer IMSAI 8080 56K ram}
  14.  
  15. {Program written By Hank Volpe (c) 1985}
  16. {Program is released to Public Domain use}
  17.  
  18.  
  19. label 1,2,3,4,selection,loop,menu;
  20.  
  21. const
  22.  {The following addresses are Serial-Interface Dependent}
  23.  {They are based on the Port address of the IBM-PC of COM1}
  24.  
  25.              base  : integer = $03f8; {base  port address}
  26.           control  : integer = $03fc; {modem control register port}
  27.           linestat : integer = $03fd; {line status register}
  28.          modemstat : integer =  $03fe; { modem status register}
  29.            rts_dtr :   byte = 3;   {dtr,rts on IBM-PC set on by this command}
  30.               dsr  :   byte = $20; {dsr mask for Modem status register}
  31.                dr  :   byte = 1;   {DR indicates character received by PC}
  32.           imsai_rdy:   byte = $30; {Mask to see if IMSAI has DSR & CTS lines on}
  33.              hold  :   byte = 1;   {turns off rts command & keeps up dtr}
  34.  
  35. type
  36. {this type is used by MS-DOS function calls}
  37.     regpack = record
  38.           ax,bx,cx,dx,si,di,es,cs,ds,flags : integer;
  39.    end;
  40.    scr_buf  = string[80];
  41.  
  42. var
  43.   x,y,z   : integer;
  44.   buffer  : byte;
  45.   ibmdata : char absolute buffer;
  46.   previous: char;
  47.   txrdy   : boolean;
  48.   rxrdy   : boolean;
  49.   change  : boolean;
  50.   transfer: boolean;
  51.   offline : boolean;
  52.   xpos,ypos : byte;
  53.      line : byte;
  54.     modem : byte;
  55.   recpack : regpack;
  56.   screen  : scr_buf;
  57.   answer  : char;
  58.   filename: string[14];
  59.   disk    : file of byte;
  60.   loadstring : string[25];è
  61. {These window procedures can be deleted if your MS-DOS system does not}
  62. {support IBM window function calls. If you delete them, make sure all}
  63. {calls for these procedures are also deleted in the source code}
  64.  
  65. procedure clrwindow;
  66. begin
  67.      window(1,1,80,25);
  68. end;
  69.  
  70. procedure mainwindow;
  71. begin
  72.      clrwindow;
  73.      window(1,1,80,24);
  74. end;
  75.  
  76. procedure ibmbanner;
  77. begin
  78.      window(1,6,80,14);
  79. end;
  80.  
  81. procedure imsaibanner;
  82. begin
  83.      window(1,14,80,23);
  84. end;
  85.  
  86. procedure ibmwindow;
  87. begin
  88.      window(1,7,80,13);
  89. end;
  90.  
  91. procedure imsaiwindow;
  92. begin
  93.      window(1,15,80,23);
  94. end;
  95.  
  96.  
  97. procedure center (holder : scr_buf; ypos : integer);
  98. {This procedure centers a string on the screen}
  99. var
  100.    xpos  : integer;
  101.  
  102. begin
  103.      xpos:=(80-length(holder)) div 2;
  104.      gotoxy(xpos,ypos);
  105.      write(holder);
  106. end;{center}
  107.  
  108. procedure setup;
  109. {procedure programs pc modem for 9600 baud,1 start, 1 stop no parity}
  110. begin
  111.    with recpack do
  112.     begin
  113.        ax:=$00e7;{sets Async Port to 9600 baud, 1 start 8 bits 1 stop bit}
  114.        dx:=$0000;è      end;
  115.       intr($14,recpack);
  116. end;{setup}
  117.  
  118. procedure oncom; {used to print an on-line communications row}
  119. begin
  120.     clrwindow; {clear all windows}
  121.     window(1,25,80,25);
  122.     gotoxy(1,25);
  123.     textbackground(green);textcolor(white);
  124.     clreol;
  125.      if transfer = false then
  126.     write('ON LINE....CNTL-C IS CP/M BOOT  CNTRL-U/CNTR-F IS IBM BREAK ')
  127.     else
  128.     write('ON LINE...       Xfer.com Resident in IMSAI memory');
  129.  
  130. end; {oncom}
  131.  
  132. procedure online;
  133. {procedure determines if DSR & CTS are set indicating IMSAI is ready}
  134. {To receive data..Program loops till IMSAI is ready}
  135.  
  136. begin
  137.   if offline in [true] then
  138.    begin
  139.      window(1,25,80,25); gotoxy(1,25);textbackground(red);
  140.      write('Slave System is not on line.... Check Slave status');
  141.    end;
  142.  
  143.  while offline in [true] do
  144.   begin
  145.        port[control]:=rts_dtr;
  146.        modem:=port[modemstat];
  147.        modem:=modem and dsr;
  148.        textbackground(red);
  149.        clreol;
  150.        if modem <> dsr then offline := true else offline :=false;
  151.  
  152.         setup;
  153.    end;
  154.      begin
  155.           oncom;
  156.           mainwindow;textbackground(black);lowvideo;clrscr;
  157.           gotoxy(1,1);
  158.      end;
  159. end;{online}
  160.  
  161. procedure ibmkey;
  162. {procedure detects if key was struck on PC Console using direct i/o}
  163. {This is necessary in order to use control-c for the cp/m system}
  164. {txrdy returns false if no key was struck. Buffer returns with character}
  165. {code typed if key was struck and txrdy returns true}
  166.  
  167. begin
  168.      txrdy:=false;è     with recpack do
  169.       begin
  170.            ax:=$0600;
  171.            dx:=$00ff;
  172.       end;
  173.       msdos(recpack);
  174.       recpack.ax:=recpack.ax and $00ff;
  175.  
  176.     if recpack.ax <>0 then
  177.      begin
  178.          recpack.ax:=recpack.ax and $00ff;
  179.          buffer:=recpack.ax;
  180.          txrdy:=true;
  181.     end;
  182.  
  183. end;{ibmkey}
  184.  
  185.  
  186. procedure imsai;
  187. {this is a look only once routine}
  188. {get character from imsai 8251 usart and flag caller loop if ready}
  189. {If not ready, rxrdy returns false}
  190.  
  191. begin
  192.      rxrdy:=false;
  193.  
  194.      port[control]:=rts_dtr;{Tell IMSAI to send a character}
  195.      modem:=port[modemstat];
  196.      modem:=modem and dsr;
  197.  
  198.     if modem = dsr then
  199.      begin
  200.           port[control]:=hold; {inhibits IMSAI from tranmitting any more}
  201.           line:=port[linestat]; {till this character is processed}
  202.           line:=line and dr;
  203.              if line = dr then
  204.              begin
  205.                   buffer:=port[base];
  206.                   rxrdy:=true;
  207.              end;
  208.      end;
  209. end;{imsai}
  210.  
  211.  
  212. procedure getchar;
  213. {routine loops waiting until IMSAI is ready to transmit a character}
  214.  
  215. begin
  216.      rxrdy:=false;
  217.      while rxrdy=false do
  218.        begin
  219.             imsai;
  220.        end;
  221. end;{getchar}
  222. è
  223. procedure receive;
  224. {procedure contains only terminal dependent data in system}
  225. {Control codes for Hazeltine 1500 terminal are implemented in }
  226. {routine Controlcode which is called only if character was transmitted}
  227. {by IMSAI that was >=125 (126 is leadin code for control routines}
  228.  
  229. procedure controlcode;{local procedure for receive only}
  230. {process hazeltine 1500 screen codes}
  231.  begin
  232.       getchar;
  233.       {first see if it is a cursor position routine}
  234.       if buffer = 17 then
  235.        begin
  236.            getchar;
  237.            xpos:=buffer;
  238.            if xpos < 1 then xpos:=1;
  239.               getchar;
  240.               ypos:=buffer; ypos:=ypos+1;
  241.               gotoxy(xpos,ypos);
  242.         end
  243.         else { if not,check for other control conditions}
  244.          begin
  245.               case buffer of
  246.               28: clrscr;
  247.               31: textcolor(yellow);
  248.               25: lowvideo;
  249.               15: clreol;
  250.  
  251.               12: begin
  252.                       xpos:=wherex ; ypos:=(wherey)-1;
  253.                       gotoxy(xpos,ypos);
  254.                    end;
  255.  
  256.               11:  begin
  257.                        xpos:=wherex;ypos:=(wherey+1);
  258.                        gotoxy(xpos,ypos);
  259.                    end;
  260.               16:  begin
  261.                        xpos:=(wherex+1);ypos:=wherey;
  262.                        gotoxy(xpos,ypos);
  263.                    end;
  264.               end;
  265.           end;
  266.      end;{controlcode local procedure}
  267.  
  268.  
  269. begin {receive}
  270.  repeat
  271.      imsai;
  272.        if rxrdy=true then
  273.          begin
  274.              if (buffer >125) then  controlcode
  275.              else
  276.               write(char(buffer));è          end;
  277.  
  278.    until rxrdy in [false];
  279. end;{receive}
  280.  
  281.  
  282. procedure send;
  283. {procedure takes character and sends it to IMSAI}
  284.  
  285. begin
  286.  
  287.      port[control]:=hold;
  288.      modem:=port[modemstat];
  289.      modem:=modem and imsai_rdy;
  290.  
  291.      if modem = imsai_rdy then
  292.       begin
  293.           port[control]:=hold;
  294.           line:=port[linestat];
  295.           line:=line and dsr;
  296.           if line = dsr then port[base]:= buffer;
  297.       end;
  298.  
  299. end;{send}
  300.  
  301.  
  302. procedure loadisp;
  303. {procedure loads and communicates with isp module on imsai}
  304. begin
  305.  
  306.   loadstring:=loadstring+char(13);
  307.  
  308.   imsai;
  309.     if rxrdy in [true] then receive;
  310.   for x:=1 to length(loadstring) do
  311.    begin
  312.         ibmdata:=loadstring[x];
  313.         send; delay(10);{ delay so UART can turn around line}
  314.         receive;
  315.    end;
  316. end;{loadisp}
  317.  
  318.  
  319. {Main program loop starts here}
  320. begin
  321.      clrscr;
  322.      transfer:=false;
  323.      offline:=true;
  324.      setup;
  325.      online;
  326.      buffer:=$07;
  327.  
  328. menu:
  329.      mainwindow;
  330.      textbackground(black);è     clrscr;
  331.      online;
  332.      textcolor(lightblue);
  333.      screen:='I N T E R S Y S T E M    P R O C E S S O R    P R O G R A M';
  334.      center(screen,1);
  335.      screen:='Version 1.1 ..from Hank Volpe Computers (c) 1985';
  336.      lowvideo;
  337.      center(screen,2);
  338.      screen:='Select from the following menu';
  339.      center(screen,7);
  340.      gotoxy(20,9);
  341.      write(' 1) Emulate Hazeltine 1500 Terminal');
  342.      gotoxy(20,11);
  343.      write(' 2) Transfer ASCII files from IMSAI to IBM-PC');
  344.      gotoxy(20,13);
  345.      write(' 3) Transfer ASCII files from IBM-PC to IMSAI');
  346.      gotoxy(20,15);
  347.      write(' 4) Transfer CP/M files to the IBM-PC via TYPE Command');
  348.      gotoxy(20,17);
  349.      write(' 5) End Program Loop');
  350.  
  351. selection:
  352.      gotoxy(1,19);clreol;
  353.      write('Enter Selection : ');
  354.      read(answer);
  355.       case answer of
  356.        '1': begin
  357.                 clrscr;
  358.                 goto 1;
  359.             end;
  360.        '2': goto 2;
  361.        '3': goto 3;
  362.        '4': goto 4;
  363.        '5': halt;
  364.        end;
  365.    goto selection;
  366.  
  367.  
  368. {Main program loop for Hazeltine 1500 emulation}
  369. 1:
  370.    buffer:=$03;send;
  371.    delay(10);
  372.    receive;
  373.    transfer:=false;
  374.    online;
  375.  
  376. loop:
  377.   receive;
  378.   ibmkey;
  379.    if txrdy = true then
  380.     begin
  381.       if ibmdata=char(21) then
  382. {procedure breaks link between computers but does not stop}
  383. {any processing being done by slave unit}
  384. {break codes can be modified to any desired by user}è begin
  385.      repeat
  386.          ibmkey;
  387.         until txrdy=true;
  388.  
  389.        if ibmdata = char(6) then
  390.         begin
  391.            clreol;
  392.             xpos:=wherex; ypos:=wherey;
  393.             window(1,25,80,25);
  394.             gotoxy(1,25);
  395.             textbackground(red);textcolor(yellow);
  396.             clreol;
  397.             write('Break code received...Do you wish to break link ? : ');
  398.  
  399.             read(ibmdata);
  400.             ibmdata:=upcase(ibmdata);
  401.               if ibmdata = 'Y' then goto menu else
  402.                  begin
  403.                     oncom;
  404.                     mainwindow;textbackground(black);
  405.                     lowvideo;
  406.                     gotoxy(xpos,ypos);
  407.                  end;
  408.          end;
  409.        end
  410.  
  411.       else
  412.       send;
  413.    end;
  414.   goto loop;
  415.  
  416.  
  417. {routine transfers files from IMSAI to PC.  IMSAI must have}
  418. {disk containing INTERSYSTEM software in default drive. If disk}
  419. {change is necessary, program will prompt user when necessary}
  420.  
  421. {When Xfer.com program is loaded on IMSAI, it will signal}
  422. {PC with an "#".  PC will send filename to IMSAI
  423. {If file is found, IMSAI will transmit "@" }
  424. {indicating it is ready to send file data. When finished, IMSAI will}
  425. {transmit  1AH (Cntl-Z) saying file has been transferred}
  426.  
  427. 2:
  428.   clrscr;
  429.   gotoxy(1,1);textcolor(yellow);
  430.   writeln('INTERSYSTEM XFER PROGRAM');
  431.   writeln('IMSAI to IBM-PC');
  432.   writeln('Version 1.0');
  433.   writeln('Hank Volpe Computers (c) 1985');
  434.   lowvideo;
  435.  
  436.  
  437. {set up the display windows}
  438. è ibmbanner;textbackground(red);
  439.   clrscr;textcolor(yellow);
  440.   textbackground(red);
  441.   writeln('═══════════ I B M - P C    F I L E    S T A T U S  ═════════');
  442.   ibmwindow;
  443.   gotoxy(1,1);
  444.   write('Enter the name of the file : ');
  445.   readln(filename);
  446.   writeln;
  447.   write('Is this file on another disk ? : '); readln (answer);
  448.   answer:=upcase(answer);
  449.    if answer = 'Y' then change:=true else change:=false;
  450.  
  451.   imsaibanner;
  452.   gotoxy(1,1);
  453.   writeln('═══════════ I M S A I   F I L E   S T A T U S  ═════════════');
  454.  
  455. ibmwindow; clrscr;
  456. {load imsai isp}
  457. loadstring:='xfer';
  458. loadisp;
  459.  
  460.  
  461. {PC now waits for '#' to indicate program is running or ? to indicate}
  462.  { program was not found by CP/M}
  463.  
  464. imsaiwindow;
  465. gotoxy(1,1);
  466. if transfer in [false] then
  467. begin
  468.      writeln('Waiting for program to load');
  469.        repeat
  470.              imsai;
  471.        until ibmdata in ['#','?'];
  472.  
  473.       if ibmdata = '?' then
  474.         begin
  475.             writeln('Program not found');
  476.            goto  menu;
  477.        end;
  478. end;
  479.  
  480. {Next, branch into File transfer program on IMSAI}
  481. {If #, then program in loop, if > then back in CP/M}
  482.   delay(10);
  483.   transfer :=true;
  484.   oncom;
  485.   imsaiwindow;
  486.   clrscr;
  487.  
  488.   loadstring:='W'; loadisp; {Send command to send file}
  489.   repeat
  490.         imsai;
  491.         write(char(buffer));
  492.   until ibmdata in ['#','>'];è
  493.    if ibmdata = '>' then
  494.     begin
  495.          writeln('Program loop terminated');
  496.          goto menu;
  497.     end;
  498.  
  499.   writeln;
  500.    if change in [true] then
  501.     begin
  502.          x:=wherex ; y:=wherey;
  503.          imsaiwindow;
  504.          gotoxy(1,2);
  505.          write('Change disk on IMSAI and press return to continue');
  506.          readln(answer);
  507.          imsaiwindow;
  508.          gotoxy(x,y);
  509.     end;
  510.  
  511.  
  512. {Next send filename and wait for acknowledge (@) or no file (!)}
  513. delay(10);
  514. loadstring:=filename;loadisp;
  515.  
  516. delay(10);
  517. repeat
  518.       imsai;
  519. until ibmdata in ['@','!'];
  520.  
  521.  
  522. if ibmdata = '!' then
  523.  begin
  524.       writeln('File not found');
  525.       goto menu;
  526.  end;
  527. writeln;
  528.  
  529. {Now Create file on PC and signal IMSAI when ready to transfer}
  530. assign(disk,filename);
  531. rewrite(disk);
  532. writeln('Transferring file');
  533. ibmwindow;clrscr;
  534. gotoxy(1,1);
  535.  
  536. delay(10);
  537. loadstring:='@'; loadisp; {send ibm ready}
  538. delay(10);
  539.  repeat
  540.        getchar;
  541.        write(ibmdata);
  542.        write(disk,buffer);
  543.  
  544.  until buffer = $1a;
  545.  close(disk);
  546.  writeln('File Has been transferred');è
  547. repeat
  548.       imsai;
  549.       until rxrdy in [false];
  550.       goto menu;
  551.  
  552. 3:
  553. {procedure transfers a file from IBM-PC to IMSAI in similar}
  554. {manner as documented above.}
  555.  
  556.   clrscr;
  557.   gotoxy(1,1);textcolor(yellow);
  558.   writeln('INTERSYSTEM XFER PROGRAM');
  559.   writeln('IBM-PC to IMSAI');
  560.   writeln('Version 1.0');
  561.   writeln('Hank Volpe Computers (c) 1985');
  562.   lowvideo;
  563.  
  564.  
  565. {set up the display windows}
  566.  
  567.  ibmbanner;textbackground(black);
  568.   clrscr;textcolor(yellow);
  569.   writeln('══════════ I B M - P C    F I L E    S T A T U S  ════════════');
  570.  
  571.   imsaibanner;
  572.   gotoxy(1,1);
  573.   writeln('══════════ I M S A I      F I L E    S T A T U S  ════════════');
  574.   imsaiwindow;textbackground(red);clrscr;
  575.   gotoxy(1,1);
  576.   write('Enter the name of the file : ');
  577.   readln(filename);
  578.   writeln;
  579.  
  580. {load imsai isp}
  581. ibmwindow;
  582. clrscr;
  583. loadstring:='xfer';
  584. loadisp;
  585. imsaiwindow;
  586. clrscr;
  587.  
  588.  
  589. { PC now waits for '#' to indicate program is running or ? to indicate}
  590.  { program was not found by CP/M}
  591.  
  592. if transfer in [false] then
  593. begin
  594.      writeln('Waiting for program to load');
  595.        repeat
  596.              imsai;
  597.        until ibmdata in ['#','?'];
  598.  
  599.       if ibmdata = '?' then
  600.         beginè            writeln('Program not found');
  601.            goto  menu;
  602.        end;
  603. end;
  604.  
  605. {Next, branch into File transfer program on IMSAI}
  606. {If #, then program in loop, if > then back in CP/M}
  607.   delay(10);
  608.   transfer :=true;
  609.   oncom;
  610.   imsaiwindow;
  611.   clrscr;
  612.  
  613.   loadstring:='R'; loadisp; {Send command to send file}
  614.   repeat
  615.         imsai;
  616.         write(char(buffer));
  617.   until ibmdata in ['#','>'];
  618.  
  619.    if ibmdata = '>' then
  620.     begin
  621.          writeln('Program loop terminated');
  622.          goto menu;
  623.     end;
  624.  
  625.   writeln;
  626.  
  627.  
  628. {Next send filename and wait for acknowledge (@) or no file (!)}
  629. delay(10);
  630. loadstring:=filename;loadisp;
  631.  
  632. delay(10);
  633. repeat
  634.       imsai;
  635. until ibmdata in ['@','!'];
  636.  
  637.  
  638. if ibmdata = '!' then
  639.  begin
  640.       writeln('ERROR');
  641.       goto menu;
  642.  end;
  643. writeln;
  644.  
  645. {Now Create the file on the IMSAI }
  646. assign(disk,filename);
  647. {$I-}
  648. reset(disk);{$I+}
  649.  if ioresult <> 0 then
  650.    begin
  651.         writeln('File does not exist on PC Default drive');
  652.         delay(50);
  653.         goto menu;
  654.    end;è
  655. ibmwindow;clrscr;
  656. writeln('Transferring file');
  657. imsaiwindow;clrscr;
  658. gotoxy(1,1);
  659.  
  660. delay(10);
  661.    while eof(disk) in [false] do
  662.     begin
  663.          read(disk,buffer);
  664.          send;
  665.          getchar;
  666.          write(ibmdata);
  667.     end;
  668.  
  669.     buffer:=$1a;
  670.     send;
  671.     delay(10);
  672.     imsai;
  673.  
  674.  close(disk);
  675.  writeln('File Has been transferred');
  676.  
  677. repeat
  678.       imsai;
  679.       until rxrdy in [false];
  680.       goto menu;
  681.  
  682.  
  683. { routine transfers files from IMSAI to PC using type cp/m}
  684. {command. This frees user from having to have Xfer.com present on}
  685. {S-100 system computer. This is for one-way transfers only !!!}
  686.  
  687. 4:
  688.   clrscr;
  689.   gotoxy(1,1);textcolor(yellow);
  690.   writeln('INTERSYSTEM XFER PROGRAM');
  691.   writeln('IMSAI to IBM-PC');
  692.   writeln('Version 1.0');
  693.   writeln('Hank Volpe Computers (c) 1985');
  694.   lowvideo;
  695.  
  696.  
  697. {set up the display windows}
  698.  
  699.  ibmbanner;textbackground(red);
  700.   clrscr;textcolor(yellow);
  701.   textbackground(red);
  702.   writeln('═══════════ I B M - P C    F I L E    S T A T U S  ══════════');
  703.   ibmwindow;
  704.   gotoxy(1,1);
  705.   write('Enter the name of the file : ');
  706.   readln(filename);
  707.   writeln;
  708.   imsaibanner;è  gotoxy(1,1);
  709.   writeln('═══════════ I M S A I      F I L E    S T A T U S  ══════════');
  710.  
  711. ibmwindow; clrscr;
  712. {load imsai isp}
  713. loadstring:='type '+filename;
  714. loadisp;
  715.  
  716.  
  717. {PC now waits for '#' to indicate program is running or  ? to indicate}
  718.  {program was not found by CP/M}
  719.  
  720. imsaiwindow;
  721. gotoxy(1,1);
  722.  
  723. {Now Create file on PC and signal IMSAI when ready to transfer}
  724. assign(disk,filename);
  725. rewrite(disk);textbackground(green);clrscr;
  726. writeln('Transferring file');
  727. ibmwindow;textbackground(green);clrscr;
  728. gotoxy(1,1);
  729.  
  730. delay(10);
  731.  repeat
  732.        getchar;
  733.        loadstring:=previous+ibmdata;
  734.        write(ibmdata);
  735.        write(disk,buffer);
  736.        previous:=ibmdata;
  737.  
  738.  until loadstring = 'A>';
  739.  close(disk);
  740.  writeln('File Has been transferred');
  741.  
  742. repeat
  743.       imsai;
  744.       until rxrdy in [false];
  745.       goto menu;
  746.  
  747.  end.
  748.  
  749.  
  750. *************************  LISTING 2 ******************************
  751.  
  752. program intersystem_processor;
  753. {program must be on default drive of S-100 system when}
  754. {Master MS-DOS computer enters file transfer mode}
  755.  
  756. {allows 2 way transfer of ASCII files between systems}
  757. {Program written by Hank Volpe Computers (c) 1085 and released to}
  758. {Public domain use}
  759.  
  760. label 1;
  761.  
  762. varè   x,y,z   : integer;
  763.    disk    : text;
  764.    buffer  : char;
  765.    ibmbyte : byte absolute buffer;
  766.    command : char;
  767.    more    : boolean;
  768.    answer  : char;
  769.    filename: string[12];
  770.  
  771. procedure sendfile;
  772. begin
  773.      write('#'); {signal PC that sendfile is active}
  774.      read(filename);
  775.      bdos(13);
  776.      {$I-} assign(disk,filename);
  777.            reset(disk);{$I+}
  778.        if ioresult <> 0 then
  779.          begin
  780.               write('!');
  781.               halt;
  782.          end;
  783.       write('@');
  784.       repeat
  785.             read(command);
  786.       until command = '@';
  787.       delay(10);
  788.       while eof(disk) in [false] do
  789.        begin
  790.            read(disk,buffer);
  791.            write(buffer);
  792.        end;
  793.        close(disk);
  794.        write(char($1a));
  795.   end;
  796.  
  797. procedure getfile;
  798. begin
  799.      write('#'); {signal PC that sendfile is active}
  800.      read(filename);
  801.      bdos(13);
  802.      {$I-} assign(disk,filename);
  803.            rewrite(disk);{$I+}
  804.        if ioresult <> 0 then
  805.          begin
  806.               write('!');
  807.               halt;
  808.          end;
  809.       write('@');
  810.       repeat
  811.             read(kbd,buffer);
  812.             write(buffer);
  813.             write(disk,buffer);
  814.       until ibmbyte = $1a;
  815.        close(disk);
  816. èend;{getfile}
  817.  
  818. {Main menu starts here...note screen printing is not necessary except}
  819. {when debugging in Emulator mode, however # prompt must be}
  820. {printed if all other messages are not}
  821.  
  822. begin
  823.      clrscr;
  824.      writeln('INTERSYSTEM PROCESSOR');
  825.      writeln('Version 1.0 Imsai/IBM-PC');
  826.      writeln('Hank Volpe Computers (C) 1985');
  827.      writeln; writeln;
  828.  
  829. 1:
  830.     write('Enter Command #');{all above except write ('#') can be deleted}
  831.      read(command); command :=upcase(command);
  832.       case command of
  833.        'W':sendfile;
  834.        'R':getfile;
  835.       end;
  836.      goto 1;
  837.  
  838. end.
  839.