35
35
#define STBFIL 2
36
36
#define STBINF 3
37
37
38
+ /* Most metadata is not valid if all zeros or all ones. */
39
+ #define GOOD (WORD ) ((WORD) != -1 && \
40
+ (WORD) != 0 && \
41
+ (WORD) != 0777777LL && \
42
+ (WORD) != 0777777777777LL)
43
+
38
44
word_t start_instruction ;
39
45
FILE * output_file ;
40
46
@@ -233,11 +239,13 @@ print_datime (FILE *f, word_t t)
233
239
static void
234
240
print_symbol (word_t word1 , word_t word2 )
235
241
{
236
- char str [7 ];
242
+ char str [7 ], * p ;
237
243
int flags = 0 ;
238
244
239
245
squoze_to_ascii (word1 , str );
240
- fprintf (output_file , " Symbol %s = " , str );
246
+ for (p = str ; * p == ' ' ; p ++ )
247
+ ;
248
+ fprintf (output_file , " Symbol %s = " , p );
241
249
fprintf (output_file , "%llo (" , word2 );
242
250
243
251
if (word1 & SYHKL )
@@ -259,7 +267,7 @@ print_symbol (word_t word1, word_t word2)
259
267
}
260
268
fprintf (output_file , ")\n" );
261
269
262
- add_symbol (str , word2 , flags );
270
+ add_symbol (p , word2 , flags );
263
271
}
264
272
265
273
void
@@ -530,28 +538,43 @@ dmp_info (struct pdp10_memory *memory, int cpu_model)
530
538
}
531
539
}
532
540
541
+ void
542
+ dec_symbols (struct pdp10_memory * memory , int address , int length )
543
+ {
544
+ fprintf (output_file , "Symbol table:\n" );
545
+
546
+ while (length > 0 )
547
+ {
548
+ word_t word1 , word2 ;
549
+ word1 = get_word_at (memory , address ++ );
550
+ word2 = get_word_at (memory , address ++ );
551
+ print_symbol (word1 , word2 );
552
+ length -= 2 ;
553
+ }
554
+ }
555
+
533
556
void
534
557
dec_info (struct pdp10_memory * memory ,
535
558
word_t entry_vec_len , word_t entry_vec_addr ,
536
559
int cpu_model )
537
560
{
561
+ word_t word ;
562
+
538
563
if (entry_vec_addr == -1 || entry_vec_len == 0254000 )
539
564
{
540
- word_t word ;
541
-
542
565
word = get_word_at (memory , JBSA ) & 0777777 ;
543
- if (word != 0 )
566
+ if (GOOD ( word ) )
544
567
{
545
568
fprintf (output_file , "Start address: %06llo\n" , word );
546
569
start_instruction = JRST + word ;
547
570
}
548
571
549
572
word = get_word_at (memory , JBREN ) & 0777777 ;
550
- if (word != 0 )
573
+ if (GOOD ( word ) )
551
574
fprintf (output_file , "Reentry address: %06llo\n" , word );
552
575
553
576
word = get_word_at (memory , JBVER );
554
- if (word != 0 )
577
+ if (GOOD ( word ) )
555
578
fprintf (output_file , "Version: %012llo\n" , word );
556
579
}
557
580
else
@@ -572,15 +595,25 @@ dec_info (struct pdp10_memory *memory,
572
595
disassemble_word (memory , get_word_at (memory , addr ),
573
596
addr , cpu_model );
574
597
575
- fprintf (output_file , "Reentry instruction:\n" );
576
- addr = entry_vec_addr + 1 ;
577
- disassemble_word (memory , get_word_at (memory , addr ),
578
- addr , cpu_model );
579
-
580
- fprintf (output_file , "Version: %012llo\n" ,
581
- get_word_at (memory , entry_vec_addr + 2 ));
598
+ word = get_word_at (memory , ++ addr );
599
+ if (GOOD (word ))
600
+ {
601
+ fprintf (output_file , "Reentry instruction:\n" );
602
+ disassemble_word (memory , word , addr , cpu_model );
603
+ }
604
+
605
+ word = get_word_at (memory , ++ addr );
606
+ if (GOOD (word ))
607
+ {
608
+ fprintf (output_file , "Version: %012llo\n" , word );
609
+ }
582
610
}
583
611
}
612
+
613
+ word = get_word_at (memory , 0116 );
614
+ if (GOOD (word ))
615
+ dec_symbols (memory , word & 0777777 ,
616
+ 01000000 - ((word >> 18 ) & 0777777 ));
584
617
}
585
618
586
619
int
0 commit comments