1 /* This program sends an rx01 image out the serial port to the PDP8 restore
2 program. It will prompt for the file to send or use first command
3 line argument. It needs a config file dumprest.cfg or $HOME/.dumprest.cfg
4 with the format defined in config.c
6 The PDP8 end should be running before this program is started
8 On the PC ctrl-break will terminate the program
25 #define ARRAYSIZE(a) (sizeof(a) / sizeof(a[0]))
43 unsigned char temp
[256];
45 unsigned int chksum
= 0;
51 setup_config(&baud
,&two_stop
,serial_dev
);
54 strcpy(filename
,argv
[1]);
56 printf("Enter file name to send\n");
62 in
= fopen(filename
,"rb");
64 in
= fopen(filename
,"r");
67 fprintf(stderr
,"On file %s ",filename
);
68 perror("open failed");
72 fseek(in
, 512511L, SEEK_SET
);
73 if (fread(temp
,1,1,in
) == 1) {
75 printf("Sending double density disk image (RX02)\n");
80 printf("Sending single density disk image (RX01)\n");
87 /* For testing write to file, only works in unix version */
88 fd
= open("dat",O_RDWR
| O_CREAT
| O_TRUNC
,0666);
90 perror("Open failed on dat");
94 fd
= init_comm(serial_dev
,baud
,two_stop
);
98 ser_write(fd
,(char *)buf
,1);
110 ser_write(fd
,(char *)buf
,2);
116 ser_write(fd
,(char *)buf
,1);
118 fseek(in
, (track
*26L + sect
- 1) * sector_size
, SEEK_SET
);
119 if (fread(temp
,sector_size
,1,in
) != 1) {
120 perror("Fread failed");
123 for (cntr
= 0; cntr
< sector_size
; cntr
++)
124 chksum
+= temp
[cntr
];
129 ser_write(fd
,(char *)buf
,2);
130 ser_write(fd
,(char *)temp
,sector_size
);
140 printf("Track %d\r",track
);