Changeset c6fb8e90 in rtems for c/src/lib/libbsp/m68k/mvme162/tools
- Timestamp:
- 08/01/95 15:33:39 (28 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 4f90134
- Parents:
- 4a6e64d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/m68k/mvme162/tools/sload.c
r4a6e64d rc6fb8e90 54 54 55 55 unsigned int ahdtoi(unsigned char digit) 56 /* 57 * 58 * 59 * : 0..15 = result60 * : -1 = char is not a digit56 /* converts a hexadecimal char to an integer 57 * 58 * entry : digit = character to convert 59 * : 0..15 = result 60 * : -1 = char is not a digit 61 61 */ 62 62 { 63 63 /* check digit */ 64 65 66 67 68 69 70 71 72 73 74 75 64 if (!isxdigit(digit)) 65 return(-1); 66 67 switch (toupper(digit)) { 68 case 'A' : return(0xA); 69 case 'B' : return(0xB); 70 case 'C' : return(0xC); 71 case 'D' : return(0xD); 72 case 'E' : return(0xE); 73 case 'F' : return(0xF); 74 default : return(digit - 0x30); 75 } 76 76 } 77 77 78 78 int issrec(char *str) 79 /* 80 * 81 * 82 * 83 * 84 * 79 /* attempts to identify the type of Srecord string passed 80 * 81 * entry : str = pointer to null terminated string 82 * returns : 0,1,2,3,5,7,8,9 for S0..S9 except S6 & S4 83 * : -1 = invalid header or header not found 84 * : -2 = invalid header number 85 85 */ 86 86 { 87 87 /* Check first character for S */ 88 if ((isupper(str[0]) && (str[0] == 'S')) || 89 (islower(str[0]) && (str[0] == 's'))) 90 { 91 /* check for valid header number */ 92 switch (str[1]) { 93 case '0' : return 0; /* header record */ 94 case '1' : return 1; /* data record, 2byte addr */ 95 case '2' : return 2; /* " " , 3byte addr */ 96 case '3' : return 3; /* " " , 4byte addr */ 97 case '5' : return 5; /* number of S1,S2,S3 blocks */ 98 case '7' : return 7; /* S3 terminator */ 99 case '8' : return 8; /* S2 terminator */ 100 case '9' : return 9; /* S1 terminator */ 101 default : return -2; /* all others are invalid */ 102 } 103 } 104 return(-1); 88 if ((isupper(str[0]) && (str[0] == 'S')) || (islower(str[0]) && (str[0] == 's'))) 89 { 90 /* check for valid header number */ 91 switch (str[1]) { 92 case '0' : return 0; /* header record */ 93 case '1' : return 1; /* data record, 2byte addr */ 94 case '2' : return 2; /* " " , 3byte addr */ 95 case '3' : return 3; /* " " , 4byte addr */ 96 case '5' : return 5; /* number of S1,S2,S3 blocks */ 97 case '7' : return 7; /* S3 terminator */ 98 case '8' : return 8; /* S2 terminator */ 99 case '9' : return 9; /* S1 terminator */ 100 default : return -2; /* all others are invalid */ 101 } 102 } 103 return(-1); 105 104 } 106 105 107 106 int validrec(char *str) 108 /* 109 * 110 * 111 * 112 * 113 * 114 * 115 * 116 */ 117 { 118 intcn = 1, rlen=0;119 intmchksum=0, rchksum=0;107 /* Tests for a valid srecord. tests checksum & for nondigit characters 108 * doesn't rely on any other srecord routines. 109 * 110 * entry : str = pointer to null terminated string 111 * returns : -1 = srecord contains invalid characters 112 * : -2 = srecord checksum is invalid 113 * : -3 = srecord record length is invalid 114 * : 0 = srecord is valid 115 */ 116 { 117 int cn = 1, rlen=0; 118 int mchksum=0, rchksum=0; 120 119 121 120 /* first check if there are any non-digit characters except S */ 122 123 124 121 while (str[cn]!=0) 122 if (!isxdigit(str[cn++])) 123 return(-1); 125 124 126 125 /* test number of data bytes */ 127 128 126 rlen = ahdtoi(str[2])* 0x10 + ahdtoi(str[3]); 127 if (((strlen(str)-4)/2U) != rlen) return(-3); 129 128 130 129 /* get checksum from string */ 131 rchksum = ahdtoi(str[rlen*2+2])*0x10 + ahdtoi(str[rlen*2+3]); 132 /* string chksum */ 130 rchksum = ahdtoi(str[rlen*2+2])*0x10 + ahdtoi(str[rlen*2+3]); /* string chksum */ 133 131 134 132 /* now calculate my own checksum */ 135 136 137 138 133 for (cn=2; cn <= rlen*2; ) 134 mchksum += ahdtoi(str[cn++])*0x10 + ahdtoi(str[cn++]); 135 mchksum = ~mchksum & 0xFF; 136 if (mchksum != rchksum) return(-2); /* return -2 in not equal */ 139 137 140 138 /* return OK if we didn't fail any of these tests */ 141 139 return(0); 142 140 } 143 141 144 142 void hdr2str(char *sstr, char *pstr) 145 /* 146 * 147 * 148 * 149 * (caller must allocate enough space for string)150 */ 151 { 152 intrlen, cn, pn=0;153 154 155 156 157 143 /* converts header record (S0) string into a plain string 144 * 145 * entry : sstr = pointer to S0 string record 146 * exit : pstr = pointer to string long enough to hold string 147 * (caller must allocate enough space for string) 148 */ 149 { 150 int rlen, cn, pn=0; 151 152 rlen = ahdtoi(sstr[2])*0x10 + ahdtoi(sstr[3]); 153 for (cn=8; cn <= rlen*2; ) 154 pstr[pn++] = ahdtoi(sstr[cn++])*0x10 + ahdtoi(sstr[cn++]); 155 pstr[pn]=0; 158 156 } 159 157 160 158 unsigned long getaddr(char *str) 161 /* returns the address of the srecord in str. assumes record is valid. 162 * 163 * entry : str = pointer to srecord string 164 * exit : address of data, word or long. 165 */ 166 { 167 unsigned long addr=0; 168 169 switch (issrec(str)) { 170 case 0 : 171 case 1 : 172 case 5 : 173 case 9 : 174 addr = ahdtoi(str[4])*0x1000 + ahdtoi(str[5])*0x100 175 + ahdtoi(str[6])*0x10 + ahdtoi(str[7]); 176 return(addr); 177 case 2 : 178 case 8 : 179 addr = ahdtoi(str[4])*0x100000 + ahdtoi(str[5])*0x10000 180 + ahdtoi(str[6])*0x1000 + ahdtoi(str[7])*0x100 181 + ahdtoi(str[8])*0x10 + ahdtoi(str[9]); 182 return(addr); 183 case 3 : 184 case 7 : 185 addr = ahdtoi(str[4])*0x10000000 + ahdtoi(str[5])*0x1000000 186 + ahdtoi(str[6])*0x100000 + ahdtoi(str[7])*0x10000 187 + ahdtoi(str[8])*0x1000 + ahdtoi(str[9])*0x100 188 + ahdtoi(str[10])*0x10 + ahdtoi(str[11]); 189 return(addr); 190 default : return(-1); 191 } 159 /* returns the address of the srecord in str. assumes record is valid. 160 * 161 * entry : str = pointer to srecord string 162 * exit : address of data, word or long. 163 */ 164 { 165 unsigned long addr=0; 166 167 switch (issrec(str)) { 168 case 0 : 169 case 1 : 170 case 5 : 171 case 9 : addr = ahdtoi(str[4])*0x1000 + ahdtoi(str[5])*0x100 172 + ahdtoi(str[6])*0x10 + ahdtoi(str[7]); 173 return(addr); 174 case 2 : 175 case 8 : addr = ahdtoi(str[4])*0x100000 + ahdtoi(str[5])*0x10000 176 + ahdtoi(str[6])*0x1000 + ahdtoi(str[7])*0x100 177 + ahdtoi(str[8])*0x10 + ahdtoi(str[9]); 178 return(addr); 179 case 3 : 180 case 7 : addr = ahdtoi(str[4])*0x10000000 + ahdtoi(str[5])*0x1000000 181 + ahdtoi(str[6])*0x100000 + ahdtoi(str[7])*0x10000 182 + ahdtoi(str[8])*0x1000 + ahdtoi(str[9])*0x100 183 + ahdtoi(str[10])*0x10 + ahdtoi(str[11]); 184 return(addr); 185 default : return(-1); 186 } 192 187 } 193 188 194 189 unsigned int datasize(char *str) 195 190 /* 196 * 197 * 198 * 199 * 200 */ 201 { 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 191 * returns the number of data bytes in the srecord. assumes record is valid. 192 * 193 * entry : str = pointer to srecord string 194 * exit : number of bytes of data in the data field. 195 */ 196 { 197 unsigned int size=0; 198 199 switch (issrec(str)) { 200 case 0 : 201 case 1 : 202 case 5 : 203 case 7 : 204 case 8 : 205 case 9 : size = ahdtoi(str[2])*0x10 + ahdtoi(str[3]); 206 return(size-3); 207 case 2 : size = ahdtoi(str[2])*0x10 + ahdtoi(str[3]); 208 return(size-4); 209 case 3 : size = ahdtoi(str[2])*0x10 + ahdtoi(str[3]); 210 return(size-5); 211 default : return(-1); 212 } 218 213 } 219 214 220 215 void usage (void) 221 216 /* 222 * 223 */ 224 { 225 226 227 228 229 217 * prints correct usage on stdout 218 */ 219 { 220 printf("\nUSAGE : sload [-v][-g][-r] [file]\n"); 221 printf(" file is an s-record file\n"); 222 printf(" -v for verbose summary of s-records loaded\n"); 223 printf(" -g to start execution\n"); 224 printf(" -r to reset MVME162\n\n"); 230 225 } 231 226 232 227 int MVMEControl(u_long entry, int reset, int go) 233 /* 228 /* Controls MVME-162 from other VME master: 234 229 * if entry != 0, loads it as start address 235 * if go != 0, starts program execution from entry236 * if reset != 0, resets mvme162's local bus230 * if go != 0, starts program execution from entry 231 * if reset != 0, resets mvme162's local bus 237 232 * Depends upon #define'ed GROUP_BASE_ADDRESS and BOARD_BASE_ADDRESS 238 * 239 */ 240 { 241 intvme;242 char vmedev[32] = "/dev/vme16d32";/* d32 is important !!! */243 u_longpagesize;244 245 246 pagesize = sysconf(_SC_PAGESIZE);/* mmap likes to be page-aligned */247 248 249 250 251 252 233 * which in turn are set by the 162-BUG's ENV command. 234 */ 235 { 236 int vme; 237 char vmedev[32] = "/dev/vme16d32"; /* d32 is important !!! */ 238 u_long pagesize; 239 struct gcsr *gcsr_map; 240 241 pagesize = sysconf(_SC_PAGESIZE); /* mmap likes to be page-aligned */ 242 243 if ((vme = open(vmedev, O_RDWR)) == -1) { 244 perror("open"); 245 fprintf(stderr, "Cannot open vme as %s to access GCSR\n", vmedev); 246 return 1; 247 } 253 248 254 249 /* "MAP_SHARED" is important here */ 255 gcsr_map = (struct gcsr *) 256 mmap(0, 0x1000, PROT_WRITE|PROT_READ, MAP_SHARED, 257 vme, (u_long)gcsr_vme / pagesize * pagesize); 258 if (gcsr_map == (struct gcsr *) - 1) { 259 perror("mmap"); 260 fprintf(stderr, "Cannot mmap() to remote bus address 0x%08X\n", 261 (u_long)gcsr_vme / pagesize * pagesize); 262 return 1; 263 } 250 gcsr_map = (struct gcsr *) mmap(0, 0x1000, PROT_WRITE|PROT_READ, MAP_SHARED, 251 vme, (u_long)gcsr_vme / pagesize * pagesize); 252 if (gcsr_map == (struct gcsr *) - 1) { 253 perror("mmap"); 254 fprintf(stderr, "Cannot mmap() to remote bus address 0x%08X\n", 255 (u_long)gcsr_vme / pagesize * pagesize); 256 return 1; 257 } 264 258 265 259 /* 266 260 * use GCSR to start execution in MVME162 267 * adjust pointer to compensate for page alignement 268 */ 269 gcsr_map = (struct gcsr *)((u_long)gcsr_map + 270 (u_long)gcsr_vme % pagesize); 271 272 if (reset) { /* reset the local bus... */ 273 gcsr_map->board_scr |= 0x80; 274 } 275 if (entry) { /* ...load start address... */ 276 gcsr_map->gpr[0] = entry >> 16U; 277 gcsr_map->gpr[1] = entry & 0x0000FFFF; 278 } 279 if (go) { /* ... and kick it in the ass! */ 280 gcsr_map->lmsig = 0x1; 281 } 261 * adjust pointer to compensate for page alignement 262 */ 263 gcsr_map = (struct gcsr *)((u_long)gcsr_map + (u_long)gcsr_vme % pagesize); 264 265 if (reset) { /* reset the local bus... */ 266 gcsr_map->board_scr |= 0x80; 267 } 268 if (entry) { /* ...load start address... */ 269 gcsr_map->gpr[0] = entry >> 16U; 270 gcsr_map->gpr[1] = entry & 0x0000FFFF; 271 } 272 if (go) { /* ... and kick it in the ass! */ 273 gcsr_map->lmsig = 0x1; 274 } 282 275 } 283 276 … … 285 278 main(int argc, char *argv[]) 286 279 { 287 charinpstr[256];288 u_charimage[256];289 charhdrstr[64];290 inti, j, k, result, size, line=0, lastrec=0;291 longaddr, tsize=0, naddr=0, blksize=0, blknum=1;292 FILE*in;293 char infile[256] = "";294 char vmedev[32] = "/dev/vme32d32";/* Assume "/dev/vme32d32" */295 intvme, verbose = 0, go = 0, reset = 0, havefile = 0;296 297 /* 280 char inpstr[256]; 281 u_char image[256]; 282 char hdrstr[64]; 283 int i, j, k, result, size, line=0, lastrec=0; 284 long addr, tsize=0, naddr=0, blksize=0, blknum=1; 285 FILE *in; 286 char infile[256] = ""; 287 char vmedev[32] = "/dev/vme32d32"; /* Assume "/dev/vme32d32" */ 288 int vme, verbose = 0, go = 0, reset = 0, havefile = 0; 289 290 /* Parse the command line */ 298 291 299 292 --argc; 300 293 301 294 while (argv++, argc--) { 302 303 304 295 if (**argv != '-') { 296 strcpy(infile, *argv); 297 havefile = 1; 305 298 } else if (!strcmp(*argv, "-v")) { 306 299 verbose = 1; … … 326 319 if (!havefile) { 327 320 if (!reset && !go) { 328 usage();321 usage(); 329 322 } 330 323 else { … … 333 326 exit(0); 334 327 } 335 328 336 329 if ((in = fopen(infile, "r")) == NULL) { 337 330 perror("open"); 338 331 fprintf(stderr, "Cannot open input file %s\n", infile); 339 exit(1); 332 exit(1); 340 333 } 341 334 … … 348 341 if (validrec(inpstr) == 0) { 349 342 switch (issrec(inpstr)) { 350 case 0 : 351 hdr2str(inpstr, hdrstr); 352 if (verbose) printf("HEADER string = `%s'\n", hdrstr); 353 lastrec=HEADER; 354 break; 355 case 1 : 356 addr = getaddr(inpstr); 357 size = datasize(inpstr); 358 if (blksize == 0) { 359 blksize+=size; 360 naddr=addr+size; 361 if (verbose) printf("DATA\tS19\t$%04lX", addr); 362 lastrec=DATA19; 343 case 0 : 344 hdr2str(inpstr, hdrstr); 345 if (verbose) printf("HEADER string = `%s'\n", hdrstr); 346 lastrec=HEADER; 347 break; 348 case 1 : 349 addr = getaddr(inpstr); 350 size = datasize(inpstr); 351 if (blksize == 0) { 352 blksize+=size; 353 naddr=addr+size; 354 if (verbose) printf("DATA\tS19\t$%04lX", addr); 355 lastrec=DATA19; 356 } 357 else if ((blksize!=0) && (addr==naddr)) { 358 blksize+=size; 359 naddr=addr+size; 360 } 361 else { 362 if (verbose) printf("\t$%04lX\t%lu", naddr-1, blksize); 363 if (verbose) printf("\t%d\n", blknum); 364 blknum+=1; 365 naddr=addr+size; 366 blksize=size; 367 if (verbose) printf("DATA\tS19\t$%04lX", addr); 368 lastrec=DATA19; 369 } 370 tsize += size; 371 if (vme == -1) break; 372 for (i = 0, j = 8, k = size; k-- > 0; i += 1, j += 2) { 373 image[i] = ahdtoi(inpstr[j])*0x10 + ahdtoi(inpstr[j+1]); 374 } 375 if (lseek(vme, addr, SEEK_SET) == -1) { 376 fprintf(stderr, "lseek() to vme address %08X failed\n", addr); 377 } 378 else { 379 if (write(vme, (u_char *)image, size) != size) { 380 fprintf(stderr, "Write to vme address %08X failed\n", addr); 363 381 } 364 else if ((blksize!=0) && (addr==naddr)) { 365 blksize+=size; 366 naddr=addr+size; 382 } 383 break; 384 case 2 : 385 addr = getaddr(inpstr); 386 size = datasize(inpstr); 387 if (blksize == 0) { 388 blksize+=size; 389 naddr=addr+size; 390 if (verbose) printf("DATA\tS28\t$%06lX",addr); 391 lastrec=DATA28; 392 } 393 else if ((blksize!=0) && (addr==naddr)) { 394 blksize+=size; 395 naddr=addr+size; 396 } 397 else { 398 if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize); 399 if (verbose) printf("\t%d\n",blknum); 400 blknum+=1; 401 naddr=addr+size; 402 blksize=size; 403 if (verbose) printf("DATA\tS28\t$%06lX",addr); 404 lastrec=DATA28; 405 } 406 tsize += size; 407 if (vme == -1) break; 408 for (i = 0, j = 10, k = size; k-- > 0; i += 1, j += 2) { 409 image[i] = ahdtoi(inpstr[j])*0x10 + ahdtoi(inpstr[j+1]); 410 } 411 if (lseek(vme, addr, SEEK_SET) == -1) { 412 fprintf(stderr, "lseek() to vme address %08X failed\n", addr); 413 } 414 else { 415 if (write(vme, (u_char *)image, size) != size) { 416 fprintf(stderr, "Write to vme address %08X failed\n", addr); 367 417 } 368 else { 369 if (verbose) printf("\t$%04lX\t%lu", naddr-1, blksize); 370 if (verbose) printf("\t%d\n", blknum); 371 blknum+=1; 372 naddr=addr+size; 373 blksize=size; 374 if (verbose) printf("DATA\tS19\t$%04lX", addr); 375 lastrec=DATA19; 418 } 419 break; 420 case 3 : 421 addr = getaddr(inpstr); 422 size = datasize(inpstr); 423 if (blksize == 0) { 424 blksize+=size; 425 naddr=addr+size; 426 if (verbose) printf("DATA\tS37\t$%08lX",addr); 427 lastrec=DATA37; 428 } 429 else if ((blksize!=0) && (addr==naddr)) { 430 blksize+=size; 431 naddr=addr+size; 432 } 433 else { 434 if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize); 435 if (verbose) printf("\t%d\n",blknum); 436 blknum+=1; 437 naddr=addr+size; 438 blksize=size; 439 if (verbose) printf("DATA\tS37\t$%08lX",addr); 440 lastrec=DATA37; 441 } 442 tsize += size; 443 if (vme == -1) break; 444 for (i = 0, j = 12, k = size; k-- > 0; i += 1, j += 2) { 445 image[i] = ahdtoi(inpstr[j])*0x10 + ahdtoi(inpstr[j+1]); 446 } 447 if (lseek(vme, addr, SEEK_SET) == -1) { 448 fprintf(stderr, "lseek() to vme address %08X failed\n", addr); 449 } 450 else { 451 if (write(vme, (u_char *)image, size) != size) { 452 fprintf(stderr, "Write to vme address %08X failed\n", addr); 376 453 } 377 tsize += size; 378 if (vme == -1) break; 379 for (i = 0, j = 8, k = size; k-- > 0; i += 1, j += 2) { 380 image[i] = ahdtoi(inpstr[j])*0x10 + ahdtoi(inpstr[j+1]); 381 } 382 if (lseek(vme, addr, SEEK_SET) == -1) { 383 fprintf(stderr, "lseek() to vme address %08X failed\n", addr); 384 } 385 else { 386 if (write(vme, (u_char *)image, size) != size) { 387 fprintf(stderr, "Write to vme address %08X failed\n", addr); 388 } 389 } 390 break; 391 case 2 : 392 addr = getaddr(inpstr); 393 size = datasize(inpstr); 394 if (blksize == 0) { 395 blksize+=size; 396 naddr=addr+size; 397 if (verbose) printf("DATA\tS28\t$%06lX",addr); 398 lastrec=DATA28; 399 } 400 else if ((blksize!=0) && (addr==naddr)) { 401 blksize+=size; 402 naddr=addr+size; 403 } 404 else { 405 if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize); 406 if (verbose) printf("\t%d\n",blknum); 407 blknum+=1; 408 naddr=addr+size; 409 blksize=size; 410 if (verbose) printf("DATA\tS28\t$%06lX",addr); 411 lastrec=DATA28; 412 } 413 tsize += size; 414 if (vme == -1) break; 415 for (i = 0, j = 10, k = size; k-- > 0; i += 1, j += 2) { 416 image[i] = ahdtoi(inpstr[j])*0x10 + ahdtoi(inpstr[j+1]); 417 } 418 if (lseek(vme, addr, SEEK_SET) == -1) { 419 fprintf(stderr, "lseek() to vme address %08X failed\n", addr); 420 } 421 else { 422 if (write(vme, (u_char *)image, size) != size) { 423 fprintf(stderr, "Write to vme address %08X failed\n", addr); 424 } 425 } 426 break; 427 case 3 : 428 addr = getaddr(inpstr); 429 size = datasize(inpstr); 430 if (blksize == 0) { 431 blksize+=size; 432 naddr=addr+size; 433 if (verbose) printf("DATA\tS37\t$%08lX",addr); 434 lastrec=DATA37; 435 } 436 else if ((blksize!=0) && (addr==naddr)) { 437 blksize+=size; 438 naddr=addr+size; 439 } 440 else { 441 if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize); 442 if (verbose) printf("\t%d\n",blknum); 443 blknum+=1; 444 naddr=addr+size; 445 blksize=size; 446 if (verbose) printf("DATA\tS37\t$%08lX",addr); 447 lastrec=DATA37; 448 } 449 tsize += size; 450 if (vme == -1) break; 451 for (i = 0, j = 12, k = size; k-- > 0; i += 1, j += 2) { 452 image[i] = ahdtoi(inpstr[j])*0x10 + ahdtoi(inpstr[j+1]); 453 } 454 if (lseek(vme, addr, SEEK_SET) == -1) { 455 fprintf(stderr, "lseek() to vme address %08X failed\n", addr); 456 } 457 else { 458 if (write(vme, (u_char *)image, size) != size) { 459 fprintf(stderr, "Write to vme address %08X failed\n", addr); 460 } 461 } 462 break; 463 case 7 : 464 if (lastrec==DATA19){ 465 if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize); 466 } 467 if (lastrec==DATA28){ 468 if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize); 469 } 470 if (lastrec==DATA37){ 471 if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize); 472 } 473 if (verbose) printf("\t%d\n",blknum); 474 addr = getaddr(inpstr); 475 if (verbose) printf("TERM\tS37"); 476 printf("\nExecution address = $%08lX\n", addr); 477 lastrec=TERMINATOR; 478 break; 479 case 8 : 480 if (lastrec==DATA19){ 481 if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize); 482 } 483 if (lastrec==DATA28){ 484 if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize); 485 } 486 if (lastrec==DATA37){ 487 if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize); 488 } 489 if (verbose) printf("\t%d\n",blknum); 490 addr = getaddr(inpstr); 491 if (verbose) printf("TERM\tS28"); 492 printf("\nExecution address = $%06lX\n", addr); 493 lastrec=TERMINATOR; 494 break; 495 case 9 : 496 if (lastrec==DATA19){ 497 if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize); 498 } 499 if (lastrec==DATA28){ 500 if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize); 501 } 502 if (lastrec==DATA37){ 503 if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize); 504 } 505 if (verbose) printf("\t%d\n",blknum); 506 addr = getaddr(inpstr); 507 if (verbose) printf("TERM\tS19"); 508 printf("\nExecution address = $%04lX\n", addr); 509 lastrec=TERMINATOR; 510 break; 511 } 454 } 455 break; 456 case 7 : 457 if (lastrec==DATA19){if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize);} 458 if (lastrec==DATA28){if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);} 459 if (lastrec==DATA37){if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);} 460 if (verbose) printf("\t%d\n",blknum); 461 addr = getaddr(inpstr); 462 if (verbose) printf("TERM\tS37"); 463 printf("\nExecution address = $%08lX\n", addr); 464 lastrec=TERMINATOR; 465 break; 466 case 8 : 467 if (lastrec==DATA19){if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize);} 468 if (lastrec==DATA28){if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);} 469 if (lastrec==DATA37){if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);} 470 if (verbose) printf("\t%d\n",blknum); 471 addr = getaddr(inpstr); 472 if (verbose) printf("TERM\tS28"); 473 printf("\nExecution address = $%06lX\n", addr); 474 lastrec=TERMINATOR; 475 break; 476 case 9 : 477 if (lastrec==DATA19){if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize);} 478 if (lastrec==DATA28){if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);} 479 if (lastrec==DATA37){if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);} 480 if (verbose) printf("\t%d\n",blknum); 481 addr = getaddr(inpstr); 482 if (verbose) printf("TERM\tS19"); 483 printf("\nExecution address = $%04lX\n", addr); 484 lastrec=TERMINATOR; 485 break; 512 486 } 513 else { 514 printf("\nError on line %d. ",line); 515 switch (validrec(inpstr)) { 516 case -1 : {printf("SRecord contains invalid characters.\n"); break; } 517 case -2 : {printf("SRecord checksum is invalid.\n"); break;} 518 case -3 : {printf("SRecord length is invalid.\n"); break;} 519 } 520 exit(1); 521 } 522 } 523 524 if ((lastrec==DATA19) || (lastrec==DATA28) || (lastrec==DATA37)) { 525 if (lastrec==DATA19){ 526 if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize); 527 } 528 if (lastrec==DATA28){ 529 if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize); 530 } 531 if (lastrec==DATA37){ 532 if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize); 533 } 534 if (verbose) printf("\t%d\n",blknum); 535 printf("ERROR: terminator record not found.\n"); 536 } 537 else { 538 for (i = 0x000FFFF; i-- > 0;) ; /* mystique delay... */ 539 MVMEControl(addr, reset, go); 540 } 541 if (verbose) printf("total data size = %lu bytes\n", tsize); 542 } 487 } 488 else { 489 printf("\nError on line %d. ",line); 490 switch (validrec(inpstr)) { 491 case -1 : {printf("SRecord contains invalid characters.\n"); break; } 492 case -2 : {printf("SRecord checksum is invalid.\n"); break;} 493 case -3 : {printf("SRecord length is invalid.\n"); break;} 494 } 495 exit(1); 496 } 497 } 498 499 if ((lastrec==DATA19) || (lastrec==DATA28) || (lastrec==DATA37)) { 500 if (lastrec==DATA19){if (verbose) printf("\t$%04lX\t%lu",naddr-1,blksize);} 501 if (lastrec==DATA28){if (verbose) printf("\t$%06lX\t%lu",naddr-1,blksize);} 502 if (lastrec==DATA37){if (verbose) printf("\t$%08lX\t%lu",naddr-1,blksize);} 503 if (verbose) printf("\t%d\n",blknum); 504 printf("ERROR: terminator record not found.\n"); 505 } 506 else { 507 for (i = 0x000FFFF; i-- > 0;) ; /* mystique delay... */ 508 MVMEControl(addr, reset, go); 509 } 510 if (verbose) printf("total data size = %lu bytes\n", tsize); 511 }
Note: See TracChangeset
for help on using the changeset viewer.