home *** CD-ROM | disk | FTP | other *** search
- /* TALK.C: To test sending from PC to amiga
- * 1. on your amiga, type: machaddr 5
- * listen 4
- * 2. on the PC, type: talk 5 4
- * (port & destination addresses can ofcourse be changed)
- */
- #include <stdio.h>
- #include <signal.h>
- #include "pardev.h"
-
- Header hdr;
-
- void ParAbort(void)
- {
- par_stop();
- printf("Aborted.\n");
- exit(1);
- }
-
- /* for talking are interrupts not really needed */
- int parint(int dev)
- {
- }
-
- main(int argc,char **argv)
- {
- unsigned int dest,port;
- unsigned long count;
- int length;
- unsigned char buffer[8]="12345678"; /* just something to fill it */
-
- par_init(1,LPTADDR);
- ctrlbrk(ParAbort);
-
- dest=atoi(argv[1]);
- port=atoi(argv[2]);
-
- printf("Sending something to destination %d port %d\n",dest,port);
-
- /* fill the PARnet header */
- put16((char *)&hdr.port,port);
- hdr.chksum = 0;
- put32((char *)&hdr.length,8);
-
- /* writing buffer to line */
- for (count=0;count<65535;count++)
- {
- sprintf(buffer,"%08lu",count);
- length=parwriteV(dest,&hdr,sizeof(hdr),buffer,8,NULL,NULL);
- printf("WROTE %08lu LENGTH %d\n",count,length);
- }
- ParAbort();
- }
-