@@ -293,7 +293,7 @@ spaces (int n)
293
293
int i ;
294
294
295
295
for (i = 0 ; i < n ; i ++ )
296
- putchar (' ' );
296
+ fputc (' ' , output_file );
297
297
298
298
return i < 0 ? 0 : i ;
299
299
}
@@ -383,11 +383,11 @@ dis (struct pdp10_memory *memory, int cpu_model)
383
383
while ((word = get_next_word (memory )) != -1 )
384
384
{
385
385
if (word & START_TAPE )
386
- printf ( "Logical end of tape.\n" );
386
+ fprintf ( output_file , "Logical end of tape.\n" );
387
387
else if (word & START_FILE )
388
- printf ( "Start of file.\n" );
388
+ fprintf ( output_file , "Start of file.\n" );
389
389
else if (word & START_RECORD )
390
- printf ( "Start of record.\n" );
390
+ fprintf ( output_file , "Start of record.\n" );
391
391
disassemble_word (memory , word & mask , get_address (memory ), cpu_model );
392
392
}
393
393
}
@@ -407,13 +407,13 @@ print_val (const char *format, int field, int hint)
407
407
408
408
sym = get_symbol_by_value (field , hint );
409
409
if (sym == NULL )
410
- n += printf ( "%o" , field );
410
+ n += fprintf ( output_file , "%o" , field );
411
411
else
412
- n += printf ( "%s" , sym -> name );
412
+ n += fprintf ( output_file , "%s" , sym -> name );
413
413
}
414
414
else
415
415
{
416
- n += printf ( "%c" , * p );
416
+ n += fprintf ( output_file , "%c" , * p );
417
417
}
418
418
}
419
419
@@ -461,14 +461,14 @@ disassemble_word (struct pdp10_memory *memory, word_t word,
461
461
462
462
sym = get_symbol_by_value (address , HINT_ADDRESS );
463
463
if (sym != NULL )
464
- printf ( "%s:\n" , sym -> name );
464
+ fprintf ( output_file , "%s:\n" , sym -> name );
465
465
466
466
if (address == -1 )
467
- printf ( " " );
467
+ fprintf ( output_file , " " );
468
468
else
469
- printf ( "%06o: " , address );
469
+ fprintf ( output_file , "%06o: " , address );
470
470
471
- printf ( "%012llo " , word );
471
+ fprintf ( output_file , "%012llo " , word );
472
472
473
473
n = 0 ;
474
474
@@ -480,7 +480,7 @@ disassemble_word (struct pdp10_memory *memory, word_t word,
480
480
/* If no opcode found and left half is 0, print as symbol. */
481
481
sym = get_symbol_by_value (Y (word ), HINT_ADDRESS );
482
482
if (sym != NULL )
483
- n += printf ( "%s" , sym -> name );
483
+ n += fprintf ( output_file , "%s" , sym -> name );
484
484
}
485
485
}
486
486
else if ((cpu_model & PDP10_ITS ) && OPCODE (word ) == ITS_OPER )
@@ -489,7 +489,7 @@ disassemble_word (struct pdp10_memory *memory, word_t word,
489
489
oper = lookup_oper (word , opers , sizeof opers / sizeof opers [0 ]);
490
490
if (oper )
491
491
{
492
- n += printf ( "%-8s " , oper -> name );
492
+ n += fprintf ( output_file , "%-8s " , oper -> name );
493
493
if (oper -> hint == HINT_CHANNEL || A (word ) != 0 )
494
494
n += print_val ("%o," , A (word ), oper -> hint );
495
495
}
@@ -501,7 +501,7 @@ disassemble_word (struct pdp10_memory *memory, word_t word,
501
501
sizeof waits_callis / sizeof waits_callis [0 ]);
502
502
if (calli )
503
503
{
504
- n += printf ( "%-8s " , calli -> name );
504
+ n += fprintf ( output_file , "%-8s " , calli -> name );
505
505
if (calli -> hint == HINT_CHANNEL || A (word ) != 0 )
506
506
n += print_val ("%o," , A (word ), calli -> hint );
507
507
}
@@ -511,14 +511,14 @@ disassemble_word (struct pdp10_memory *memory, word_t word,
511
511
{
512
512
int address ;
513
513
514
- n += printf ( "%-8s " , ".call" );
514
+ n += fprintf ( output_file , "%-8s " , ".call" );
515
515
516
516
address = calc_e (memory , word );
517
517
if (address == -1 ||
518
518
get_word_at (memory , address ) != SETZ )
519
519
{
520
520
if (I (word ))
521
- n += printf ( "@" );
521
+ n += fprintf ( output_file , "@" );
522
522
n += print_val ("%o" , Y (word ), HINT_ADDRESS );
523
523
if (X (word ))
524
524
n += print_val ("(%o)" , X (word ), HINT_ACCUMULATOR );
@@ -530,31 +530,31 @@ disassemble_word (struct pdp10_memory *memory, word_t word,
530
530
word_t w ;
531
531
532
532
n = 0 ;
533
- printf ( "[setz\n" );
533
+ fprintf ( output_file , "[setz\n" );
534
534
w = get_word_at (memory , address + 1 );
535
535
sixbit_to_ascii (w , name );
536
- printf ( " SIXBIT/%s/\n" , name );
536
+ fprintf ( output_file , " SIXBIT/%s/\n" , name );
537
537
i = 2 ;
538
538
while (((w = get_word_at (memory , address + i )) & SIGNBIT ) == 0 )
539
539
{
540
- printf ( " %012llo\n" , w );
540
+ fprintf ( output_file , " %012llo\n" , w );
541
541
i ++ ;
542
542
}
543
- printf ( " %012llo]\n" , w );
544
- printf ( " " );
543
+ fprintf ( output_file , " %012llo]\n" , w );
544
+ fprintf ( output_file , " " );
545
545
}
546
546
}
547
547
#endif
548
548
else
549
549
{
550
- n += printf ( "%-8s " , op -> name );
550
+ n += fprintf ( output_file , "%-8s " , op -> name );
551
551
552
552
if (op -> type & PDP10_IO )
553
553
{
554
554
const struct pdp10_device * dev ;
555
555
dev = lookup_device (DEVICE (word ), cpu_model );
556
556
if (dev != NULL )
557
- n += printf ( "%s, " , dev -> name );
557
+ n += fprintf ( output_file , "%s, " , dev -> name );
558
558
else
559
559
n += print_val ("%o, " , DEVICE (word ), HINT_DEVICE );
560
560
}
@@ -576,15 +576,15 @@ disassemble_word (struct pdp10_memory *memory, word_t word,
576
576
if (E (word ) != 0 || !(op -> type & PDP10_E_UNUSED ))
577
577
{
578
578
if (I (word ))
579
- n += printf ( "@" );
579
+ n += fprintf ( output_file , "@" );
580
580
581
581
if (op -> addr_hint == HINT_FLOAT && X (word ) == 0 )
582
582
{
583
583
const struct symbol * sym = get_symbol_by_value (Y (word ), hint );
584
584
if (sym == NULL )
585
- n += printf ( "(%f)" , immediate_float (Y (word )));
585
+ n += fprintf ( output_file , "(%f)" , immediate_float (Y (word )));
586
586
else
587
- n += printf ( "%s" , sym -> name );
587
+ n += fprintf ( output_file , "%s" , sym -> name );
588
588
}
589
589
else if (Y (word ) != 0 && X (word ) != 0 )
590
590
n += print_val ("%o" , Y (word ), HINT_OFFSET );
@@ -607,21 +607,21 @@ disassemble_word (struct pdp10_memory *memory, word_t word,
607
607
{
608
608
int t = instruction_time (word , PDP10_KI10 );
609
609
if (t > 0 )
610
- printf ( ";%5dns" , t );
610
+ fprintf ( output_file , ";%5dns" , t );
611
611
else
612
612
spaces (8 );
613
613
}
614
614
#endif
615
615
616
616
#if 1
617
617
/* Print word as six SIXBIT characters. */
618
- printf ( ";\"" );
618
+ fprintf ( output_file , ";\"" );
619
619
for (i = 0 ; i < 6 ; i ++ )
620
620
{
621
621
int c = (int )(word >> (6 * (5 - i ))) & 077 ;
622
- putchar (c + ' ' );
622
+ fputc (c + ' ' , output_file );
623
623
}
624
- putchar ('"' );
624
+ fputc ('"' , output_file );
625
625
#endif
626
626
627
627
#if 1
@@ -668,51 +668,51 @@ disassemble_word (struct pdp10_memory *memory, word_t word,
668
668
669
669
if (printable )
670
670
{
671
- printf ( " \"" );
671
+ fprintf ( output_file , " \"" );
672
672
for (i = 0 ; i < 5 ; i ++ )
673
673
{
674
674
switch (ch [i ])
675
675
{
676
676
case '\0' :
677
- printf ( "\\0" );
677
+ fprintf ( output_file , "\\0" );
678
678
break ;
679
679
case '\t' :
680
- printf ( "\\t" );
680
+ fprintf ( output_file , "\\t" );
681
681
break ;
682
682
case '\n' :
683
- printf ( "\\n" );
683
+ fprintf ( output_file , "\\n" );
684
684
break ;
685
685
case '\f' :
686
- printf ( "\\f" );
686
+ fprintf ( output_file , "\\f" );
687
687
break ;
688
688
case '\r' :
689
- printf ( "\\r" );
689
+ fprintf ( output_file , "\\r" );
690
690
break ;
691
691
case '\\' :
692
- printf ( "\\\\" );
692
+ fprintf ( output_file , "\\\\" );
693
693
break ;
694
694
case '\"' :
695
- printf ( "\\\"" );
695
+ fprintf ( output_file , "\\\"" );
696
696
break ;
697
697
default :
698
698
if (ch [i ] < 040 || ch [i ] > 0176 )
699
- printf ( "\\%03o" , ch [i ]);
699
+ fprintf ( output_file , "\\%03o" , ch [i ]);
700
700
else
701
- putchar (ch [i ]);
701
+ fputc (ch [i ], output_file );
702
702
break ;
703
703
}
704
704
}
705
- printf ( "\"" );
705
+ fprintf ( output_file , "\"" );
706
706
}
707
707
#endif
708
708
709
709
#if 0
710
710
/* Print word as six SQUOZE characters. */
711
711
squoze_to_ascii (word , ch );
712
- printf ( " \"%s\"" , ch );
712
+ fprintf ( output_file , " \"%s\"" , ch );
713
713
#endif
714
714
715
- printf ( "\n" );
715
+ fprintf ( output_file , "\n" );
716
716
}
717
717
718
718
void
0 commit comments