static char sccsid
[] = "%Z%%M% %I% %G%";
/* instruction printing */
#define ACCA (8<<3) /* address only */
#define ACCR (1<<3) /* read */
#define ACCW (2<<3) /* write */
#define ACCM (3<<3) /* modify */
#define ACCB (4<<3) /* branch displacement */
#define ACCI (5<<3) /* XFC code */
#define TYPB 0 /* byte */
#define TYPW 1 /* word */
#define TYPL 2 /* long */
#define TYPQ 3 /* quad */
#define TYPF 4 /* floating */
#define TYPD 5 /* double floating */
TYPE
struct optab
*OPTAB
;
#define SYSTAB struct systab
int ioptab
[256]; /* index by opcode to optab */
mkioptab() {/* set up ioptab */
ioptab
[p
->val
&LOBYTE
]=p
-optab
;
extern char *fmtr
; /* not used */
extern char *fmtR
; /* not used */
short argno
; /* argument index */
char **r
; /* register name */
long d
; /* assembled byte, word, long or float */
printf("%s%8t",ip
->iname
);
for (argno
=0; argno
<ip
->nargs
; argno
++,ap
++) {
if (argno
!=0) printc(',');
mode
= 0xAF + ((*ap
&7)<<5); /* branch displacement */
mode
= bchkget(inkdot(incp
),idsp
); ++incp
;
if (mode
& 0300) {/* not short literal */
if (mode
==9){ /* PC absolute, always 4 bytes*/
printquad(d
, snarf(4, idsp
));
printfloating(TYPF
, snarf(4, idsp
), 0);
printfloating(TYPQ
, d
, snarf(4, idsp
));
} /*end of type switch */
* here only for TYPQ, TYPf, TYPD
} else { /*it's not PC immediate or abs*/
case 0xB: /* byte displacement defferred*/
case 0xA: /* byte displacement */
case 0xD: /* word displacement deferred */
case 0xC: /* word displacement */
case 0xF: /* long displacement deferred */
case 0xE: /* long displacement */
if (r
==(regname
+0xF) && mode
>=0xA){
/* PC offset addressing */
psymoff(var
[argno
],type
,"");
} /* end of the mode switch */
} else { /* short literal */
printf("$%s",fltimm
[mode
]);
if (ins
==0xCF || ins
==0xAF || ins
==0x8F) {/* CASEx instr */
for (argno
=0; argno
<=var
[2]; ++argno
) {
printf(" %R: ",argno
+var
[1]);
d
=get(inkdot(incp
+argno
+argno
),idsp
)&0xFFFF;
if (d
&0x8000) d
-= 0x10000;
psymoff(inkdot(incp
)+d
,type
,"");
* magic values to mung an offset to a register into
* something that psymoff can understand.. all magic
static long magic_masks
[5] = {0, 0x80, 0x8000, 0, 0};
static long magic_compl
[5] = {0, 0x100, 0x10000,0, 0};
* The following code is NO LONGER portable from the PDP 11 to the VAX
long snarf (nbytes
, idsp
)
for (byteindex
= 0; byteindex
< nbytes
; byteindex
++){
d
.long_bytes
[byteindex
] = bchkget(inkdot(incp
), idsp
);
if (d
.long_value
& magic_masks
[nbytes
])
d
.long_value
-= magic_compl
[nbytes
];
printfloating(type
, word_first
, word_last
)
reconstructed
.composite
.word_first
= word_first
;
reconstructed
.composite
.word_last
= word_last
;
printf( "%f", reconstructed
.dvalue
);
printquad(word_first
, word_last
)
reconstructed
.quad_long
[0] = word_first
;
reconstructed
.quad_long
[1] = word_last
;
for (byteindex
= 7; byteindex
>= 0; --byteindex
){
for (nibbleindex
= 4; nibbleindex
>= 0; nibbleindex
-= 4){
ch
= (reconstructed
.quad_bytes
[byteindex
]
if ( ! (leading_zero
&= (ch
== 0) ) ){