/* GET.C: Testing receipt of large amount data (without use of interrupts)
 * 1. On the PC,    type: get
 * 2. On the Amiga, type: machaddr 5
 *                        dump 1 4
 *
 * When your interface & cables are ok, you will see dots appearing on the
 * screen, each representing a packet successfully received. After each 15th
 * packet the number of Kbytes received will be printed.
 *
 * Port address can be changed, it won't be interpreted yet.
 */
#include <stdio.h>
#include "pardev.h"

/* hardware address of this machine */
#define MYADDR 1

main(int argc,char **argv)
{
unsigned char buffer[4096+8];
unsigned int Length,count=1;
unsigned long total=0;

 paraddress(MYADDR,LPTADDR);

 printf("My address %d, reading data from 0x%04x \n",MYADDR,LPTADDR);

 while(1)                /* abort this with a CTRL-C */
 if (pardataready())
 {
  Length=parread(buffer,4096+8);  /* max. packetsize to receive is 4104 */
  if (Length >0)
  {
    total += Length;
    if (!(count++ & 15)) printf("Got %d KB\n",total/1024);
    else printf(".");
  }
  else printf("ERROR %d\n",Length);
 }
}
