1 /* disasm.c where all the _work_ gets done in the Netwide Disassembler
3 * The Netwide Assembler is copyright (C) 1996 Simon Tatham and
4 * Julian Hall. All rights reserved. The software is
5 * redistributable under the licence given in the file "Licence"
6 * distributed in the NASM archive.
8 * initial version 27/iii/95 by Simon Tatham
21 extern struct itemplate
**itable
[];
24 * Flags that go into the `segment' field of `insn' structures
27 #define SEG_RELATIVE 1
34 #define SEG_SIGNED 128
36 static int whichreg(long regflags
, int regval
)
38 static int reg32
[] = {
39 R_EAX
, R_ECX
, R_EDX
, R_EBX
, R_ESP
, R_EBP
, R_ESI
, R_EDI
};
40 static int reg16
[] = {
41 R_AX
, R_CX
, R_DX
, R_BX
, R_SP
, R_BP
, R_SI
, R_DI
};
43 R_AL
, R_CL
, R_DL
, R_BL
, R_AH
, R_CH
, R_DH
, R_BH
};
45 R_ES
, R_CS
, R_SS
, R_DS
, R_FS
, R_GS
, 0, 0 };
47 R_CR0
, 0, R_CR2
, R_CR3
, R_CR4
, 0, 0, 0 };
49 R_DR0
, R_DR1
, R_DR2
, R_DR3
, 0, 0, R_DR6
, R_DR7
};
51 0, 0, 0, R_TR3
, R_TR4
, R_TR5
, R_TR6
, R_TR7
};
52 static int fpureg
[] = {
53 R_ST0
, R_ST1
, R_ST2
, R_ST3
, R_ST4
, R_ST5
, R_ST6
, R_ST7
};
54 static int mmxreg
[] = {
55 R_MM0
, R_MM1
, R_MM2
, R_MM3
, R_MM4
, R_MM5
, R_MM6
, R_MM7
};
56 static int xmmreg
[] = {
57 R_XMM0
, R_XMM1
, R_XMM2
, R_XMM3
, R_XMM4
, R_XMM5
, R_XMM6
, R_XMM7
};
59 if (!(REG_AL
& ~regflags
))
61 if (!(REG_AX
& ~regflags
))
63 if (!(REG_EAX
& ~regflags
))
65 if (!(REG_DX
& ~regflags
))
67 if (!(REG_CL
& ~regflags
))
69 if (!(REG_CX
& ~regflags
))
71 if (!(REG_ECX
& ~regflags
))
73 if (!(REG_CR4
& ~regflags
))
75 if (!(FPU0
& ~regflags
))
77 if (!(REG_CS
& ~regflags
))
79 if (!(REG_DESS
& ~regflags
))
80 return (regval
== 0 || regval
== 2 || regval
== 3 ? sreg
[regval
] : 0);
81 if (!(REG_FSGS
& ~regflags
))
82 return (regval
== 4 || regval
== 5 ? sreg
[regval
] : 0);
83 if (!((REGMEM
|BITS8
) & ~regflags
))
85 if (!((REGMEM
|BITS16
) & ~regflags
))
87 if (!((REGMEM
|BITS32
) & ~regflags
))
89 if (!(REG_SREG
& ~regflags
))
91 if (!(REG_CREG
& ~regflags
))
93 if (!(REG_DREG
& ~regflags
))
95 if (!(REG_TREG
& ~regflags
))
97 if (!(FPUREG
& ~regflags
))
98 return fpureg
[regval
];
99 if (!(MMXREG
& ~regflags
))
100 return mmxreg
[regval
];
101 if (!(XMMREG
& ~regflags
))
102 return xmmreg
[regval
];
106 static char *whichcond(int condval
)
108 static int conds
[] = {
109 C_O
, C_NO
, C_C
, C_NC
, C_Z
, C_NZ
, C_NA
, C_A
,
110 C_S
, C_NS
, C_PE
, C_PO
, C_L
, C_NL
, C_NG
, C_G
112 return conditions
[conds
[condval
]];
116 * Process an effective address (ModRM) specification.
118 static unsigned char *do_ea (unsigned char *data
, int modrm
, int asize
,
119 int segsize
, operand
*op
)
121 int mod
, rm
, scale
, index
, base
;
123 mod
= (modrm
>> 6) & 03;
126 if (mod
== 3) { /* pure register version */
128 op
->segment
|= SEG_RMREG
;
136 * <mod> specifies the displacement size (none, byte or
137 * word), and <rm> specifies the register combination.
138 * Exception: mod=0,rm=6 does not specify [BP] as one might
139 * expect, but instead specifies [disp16].
141 op
->indexreg
= op
->basereg
= -1;
142 op
->scale
= 1; /* always, in 16 bits */
144 case 0: op
->basereg
= R_BX
; op
->indexreg
= R_SI
; break;
145 case 1: op
->basereg
= R_BX
; op
->indexreg
= R_DI
; break;
146 case 2: op
->basereg
= R_BP
; op
->indexreg
= R_SI
; break;
147 case 3: op
->basereg
= R_BP
; op
->indexreg
= R_DI
; break;
148 case 4: op
->basereg
= R_SI
; break;
149 case 5: op
->basereg
= R_DI
; break;
150 case 6: op
->basereg
= R_BP
; break;
151 case 7: op
->basereg
= R_BX
; break;
153 if (rm
== 6 && mod
== 0) { /* special case */
157 mod
= 2; /* fake disp16 */
161 op
->segment
|= SEG_NODISP
;
164 op
->segment
|= SEG_DISP8
;
165 op
->offset
= (signed char) *data
++;
168 op
->segment
|= SEG_DISP16
;
169 op
->offset
= *data
++;
170 op
->offset
|= (*data
++) << 8;
176 * Once again, <mod> specifies displacement size (this time
177 * none, byte or *dword*), while <rm> specifies the base
178 * register. Again, [EBP] is missing, replaced by a pure
179 * disp32 (this time that's mod=0,rm=*5*). However, rm=4
180 * indicates not a single base register, but instead the
181 * presence of a SIB byte...
185 case 0: op
->basereg
= R_EAX
; break;
186 case 1: op
->basereg
= R_ECX
; break;
187 case 2: op
->basereg
= R_EDX
; break;
188 case 3: op
->basereg
= R_EBX
; break;
189 case 5: op
->basereg
= R_EBP
; break;
190 case 6: op
->basereg
= R_ESI
; break;
191 case 7: op
->basereg
= R_EDI
; break;
193 if (rm
== 5 && mod
== 0) {
197 mod
= 2; /* fake disp32 */
199 if (rm
== 4) { /* process SIB */
200 scale
= (*data
>> 6) & 03;
201 index
= (*data
>> 3) & 07;
205 op
->scale
= 1 << scale
;
207 case 0: op
->indexreg
= R_EAX
; break;
208 case 1: op
->indexreg
= R_ECX
; break;
209 case 2: op
->indexreg
= R_EDX
; break;
210 case 3: op
->indexreg
= R_EBX
; break;
211 case 4: op
->indexreg
= -1; break;
212 case 5: op
->indexreg
= R_EBP
; break;
213 case 6: op
->indexreg
= R_ESI
; break;
214 case 7: op
->indexreg
= R_EDI
; break;
218 case 0: op
->basereg
= R_EAX
; break;
219 case 1: op
->basereg
= R_ECX
; break;
220 case 2: op
->basereg
= R_EDX
; break;
221 case 3: op
->basereg
= R_EBX
; break;
222 case 4: op
->basereg
= R_ESP
; break;
223 case 6: op
->basereg
= R_ESI
; break;
224 case 7: op
->basereg
= R_EDI
; break;
236 op
->segment
|= SEG_NODISP
;
239 op
->segment
|= SEG_DISP8
;
240 op
->offset
= (signed char) *data
++;
243 op
->segment
|= SEG_DISP32
;
244 op
->offset
= *data
++;
245 op
->offset
|= (*data
++) << 8;
246 op
->offset
|= ((long) *data
++) << 16;
247 op
->offset
|= ((long) *data
++) << 24;
255 * Determine whether the instruction template in t corresponds to the data
256 * stream in data. Return the number of bytes matched if so.
258 static int matches (struct itemplate
*t
, unsigned char *data
, int asize
,
259 int osize
, int segsize
, int rep
, insn
*ins
)
261 unsigned char * r
= (unsigned char *)(t
->code
);
262 unsigned char * origdata
= data
;
263 int a_used
= FALSE
, o_used
= FALSE
;
268 else if ( rep
== 0xF3 )
274 if (c
>= 01 && c
<= 03) {
281 case 0x07: ins
->oprs
[0].basereg
= 0; break;
282 case 0x17: ins
->oprs
[0].basereg
= 2; break;
283 case 0x1F: ins
->oprs
[0].basereg
= 3; break;
284 default: return FALSE
;
289 case 0xA1: ins
->oprs
[0].basereg
= 4; break;
290 case 0xA9: ins
->oprs
[0].basereg
= 5; break;
291 default: return FALSE
;
296 case 0x06: ins
->oprs
[0].basereg
= 0; break;
297 case 0x0E: ins
->oprs
[0].basereg
= 1; break;
298 case 0x16: ins
->oprs
[0].basereg
= 2; break;
299 case 0x1E: ins
->oprs
[0].basereg
= 3; break;
300 default: return FALSE
;
305 case 0xA0: ins
->oprs
[0].basereg
= 4; break;
306 case 0xA8: ins
->oprs
[0].basereg
= 5; break;
307 default: return FALSE
;
310 if (c
>= 010 && c
<= 012) {
311 int t
= *r
++, d
= *data
++;
312 if (d
< t
|| d
> t
+7)
315 ins
->oprs
[c
-010].basereg
= d
-t
;
316 ins
->oprs
[c
-010].segment
|= SEG_RMREG
;
322 if (c
>= 014 && c
<= 016) {
323 ins
->oprs
[c
-014].offset
= (signed char) *data
++;
324 ins
->oprs
[c
-014].segment
|= SEG_SIGNED
;
326 if (c
>= 020 && c
<= 022)
327 ins
->oprs
[c
-020].offset
= *data
++;
328 if (c
>= 024 && c
<= 026)
329 ins
->oprs
[c
-024].offset
= *data
++;
330 if (c
>= 030 && c
<= 032) {
331 ins
->oprs
[c
-030].offset
= *data
++;
332 ins
->oprs
[c
-030].offset
|= (*data
++ << 8);
334 if (c
>= 034 && c
<= 036) {
335 ins
->oprs
[c
-034].offset
= *data
++;
336 ins
->oprs
[c
-034].offset
|= (*data
++ << 8);
338 ins
->oprs
[c
-034].offset
|= (((long) *data
++) << 16);
339 ins
->oprs
[c
-034].offset
|= (((long) *data
++) << 24);
341 if (segsize
!= asize
)
342 ins
->oprs
[c
-034].addr_size
= asize
;
344 if (c
>= 040 && c
<= 042) {
345 ins
->oprs
[c
-040].offset
= *data
++;
346 ins
->oprs
[c
-040].offset
|= (*data
++ << 8);
347 ins
->oprs
[c
-040].offset
|= (((long) *data
++) << 16);
348 ins
->oprs
[c
-040].offset
|= (((long) *data
++) << 24);
350 if (c
>= 050 && c
<= 052) {
351 ins
->oprs
[c
-050].offset
= (signed char) *data
++;
352 ins
->oprs
[c
-050].segment
|= SEG_RELATIVE
;
354 if (c
>= 060 && c
<= 062) {
355 ins
->oprs
[c
-060].offset
= *data
++;
356 ins
->oprs
[c
-060].offset
|= (*data
++ << 8);
357 ins
->oprs
[c
-060].segment
|= SEG_RELATIVE
;
358 ins
->oprs
[c
-060].segment
&= ~SEG_32BIT
;
360 if (c
>= 064 && c
<= 066) {
361 ins
->oprs
[c
-064].offset
= *data
++;
362 ins
->oprs
[c
-064].offset
|= (*data
++ << 8);
364 ins
->oprs
[c
-064].offset
|= (((long) *data
++) << 16);
365 ins
->oprs
[c
-064].offset
|= (((long) *data
++) << 24);
366 ins
->oprs
[c
-064].segment
|= SEG_32BIT
;
368 ins
->oprs
[c
-064].segment
&= ~SEG_32BIT
;
369 ins
->oprs
[c
-064].segment
|= SEG_RELATIVE
;
370 if (segsize
!= osize
) {
371 ins
->oprs
[c
-064].type
=
372 (ins
->oprs
[c
-064].type
& NON_SIZE
)
373 | ((osize
== 16) ? BITS16
: BITS32
);
376 if (c
>= 070 && c
<= 072) {
377 ins
->oprs
[c
-070].offset
= *data
++;
378 ins
->oprs
[c
-070].offset
|= (*data
++ << 8);
379 ins
->oprs
[c
-070].offset
|= (((long) *data
++) << 16);
380 ins
->oprs
[c
-070].offset
|= (((long) *data
++) << 24);
381 ins
->oprs
[c
-070].segment
|= SEG_32BIT
| SEG_RELATIVE
;
383 if (c
>= 0100 && c
< 0130) {
385 ins
->oprs
[c
& 07].basereg
= (modrm
>> 3) & 07;
386 ins
->oprs
[c
& 07].segment
|= SEG_RMREG
;
387 data
= do_ea (data
, modrm
, asize
, segsize
,
388 &ins
->oprs
[(c
>> 3) & 07]);
390 if (c
>= 0130 && c
<= 0132) {
391 ins
->oprs
[c
-0130].offset
= *data
++;
392 ins
->oprs
[c
-0130].offset
|= (*data
++ << 8);
394 if (c
>= 0140 && c
<= 0142) {
395 ins
->oprs
[c
-0140].offset
= *data
++;
396 ins
->oprs
[c
-0140].offset
|= (*data
++ << 8);
397 ins
->oprs
[c
-0140].offset
|= (((long) *data
++) << 16);
398 ins
->oprs
[c
-0140].offset
|= (((long) *data
++) << 24);
400 if (c
>= 0200 && c
<= 0277) {
402 if (((modrm
>> 3) & 07) != (c
& 07))
403 return FALSE
; /* spare field doesn't match up */
404 data
= do_ea (data
, modrm
, asize
, segsize
,
405 &ins
->oprs
[(c
>> 3) & 07]);
407 if (c
>= 0300 && c
<= 0302) {
409 ins
->oprs
[c
-0300].segment
|= SEG_32BIT
;
411 ins
->oprs
[c
-0300].segment
&= ~SEG_32BIT
;
427 if (asize
!= segsize
)
445 if (osize
!= segsize
)
451 int t
= *r
++, d
= *data
++;
452 if (d
< t
|| d
> t
+15)
455 ins
->condition
= d
- t
;
473 * Check for unused rep or a/o prefixes.
477 ins
->prefixes
[ins
->nprefix
++] = drep
;
478 if (!a_used
&& asize
!= segsize
)
479 ins
->prefixes
[ins
->nprefix
++] = (asize
== 16 ? P_A16
: P_A32
);
480 if (!o_used
&& osize
!= segsize
)
481 ins
->prefixes
[ins
->nprefix
++] = (osize
== 16 ? P_O16
: P_O32
);
483 return data
- origdata
;
486 long disasm (unsigned char *data
, char *output
, int segsize
, long offset
,
487 int autosync
, unsigned long prefer
)
489 struct itemplate
**p
, **best_p
;
490 int length
, best_length
= 0;
492 int rep
, lock
, asize
, osize
, i
, slen
, colon
;
493 unsigned char *origdata
;
496 unsigned long goodness
, best
;
501 asize
= osize
= segsize
;
506 if (*data
== 0xF3 || *data
== 0xF2)
508 else if (*data
== 0xF0)
510 else if (*data
== 0x2E || *data
== 0x36 || *data
== 0x3E ||
511 *data
== 0x26 || *data
== 0x64 || *data
== 0x65) {
513 case 0x2E: segover
= "cs"; break;
514 case 0x36: segover
= "ss"; break;
515 case 0x3E: segover
= "ds"; break;
516 case 0x26: segover
= "es"; break;
517 case 0x64: segover
= "fs"; break;
518 case 0x65: segover
= "gs"; break;
520 } else if (*data
== 0x66)
521 osize
= 48 - segsize
, data
++;
522 else if (*data
== 0x67)
523 asize
= 48 - segsize
, data
++;
528 tmp_ins
.oprs
[0].segment
= tmp_ins
.oprs
[1].segment
=
529 tmp_ins
.oprs
[2].segment
=
530 tmp_ins
.oprs
[0].addr_size
= tmp_ins
.oprs
[1].addr_size
=
531 tmp_ins
.oprs
[2].addr_size
= (segsize
== 16 ? 0 : SEG_32BIT
);
532 tmp_ins
.condition
= -1;
533 best
= ~0UL; /* Worst possible */
535 for (p
= itable
[*data
]; *p
; p
++) {
536 if ( (length
= matches(*p
, data
, asize
, osize
,
537 segsize
, rep
, &tmp_ins
)) ) {
540 * Final check to make sure the types of r/m match up.
542 for (i
= 0; i
< (*p
)->operands
; i
++) {
544 /* If it's a mem-only EA but we have a register, die. */
545 ((tmp_ins
.oprs
[i
].segment
& SEG_RMREG
) &&
546 !(MEMORY
& ~(*p
)->opd
[i
])) ||
548 /* If it's a reg-only EA but we have a memory ref, die. */
549 (!(tmp_ins
.oprs
[i
].segment
& SEG_RMREG
) &&
550 !(REGNORM
& ~(*p
)->opd
[i
]) &&
551 !((*p
)->opd
[i
] & REG_SMASK
)) ||
553 /* Register type mismatch (eg FS vs REG_DESS): die. */
554 ((((*p
)->opd
[i
] & (REGISTER
| FPUREG
)) ||
555 (tmp_ins
.oprs
[i
].segment
& SEG_RMREG
)) &&
556 !whichreg ((*p
)->opd
[i
], tmp_ins
.oprs
[i
].basereg
))) {
563 goodness
= ((*p
)->flags
& IF_PFMASK
) ^ prefer
;
564 if ( goodness
< best
) {
565 /* This is the best one found so far */
568 best_length
= length
;
576 return 0; /* no instruction was matched */
578 /* Pick the best match */
580 length
= best_length
;
585 slen
+= sprintf(output
+slen
, "lock ");
586 for (i
= 0; i
< ins
.nprefix
; i
++)
587 switch (ins
.prefixes
[i
]) {
588 case P_REP
: slen
+= sprintf(output
+slen
, "rep "); break;
589 case P_REPE
: slen
+= sprintf(output
+slen
, "repe "); break;
590 case P_REPNE
: slen
+= sprintf(output
+slen
, "repne "); break;
591 case P_A16
: slen
+= sprintf(output
+slen
, "a16 "); break;
592 case P_A32
: slen
+= sprintf(output
+slen
, "a32 "); break;
593 case P_O16
: slen
+= sprintf(output
+slen
, "o16 "); break;
594 case P_O32
: slen
+= sprintf(output
+slen
, "o32 "); break;
597 for (i
= 0; i
< elements(ico
); i
++)
598 if ((*p
)->opcode
== ico
[i
]) {
599 slen
+= sprintf(output
+slen
, "%s%s", icn
[i
],
600 whichcond(ins
.condition
));
603 if (i
>= elements(ico
))
604 slen
+= sprintf(output
+slen
, "%s", insn_names
[(*p
)->opcode
]);
606 length
+= data
- origdata
; /* fix up for prefixes */
607 for (i
=0; i
<(*p
)->operands
; i
++) {
608 output
[slen
++] = (colon
? ':' : i
==0 ? ' ' : ',');
610 if (ins
.oprs
[i
].segment
& SEG_RELATIVE
) {
611 ins
.oprs
[i
].offset
+= offset
+ length
;
613 * sort out wraparound
615 if (!(ins
.oprs
[i
].segment
& SEG_32BIT
))
616 ins
.oprs
[i
].offset
&= 0xFFFF;
618 * add sync marker, if autosync is on
621 add_sync (ins
.oprs
[i
].offset
, 0L);
624 if ((*p
)->opd
[i
] & COLON
)
629 if (((*p
)->opd
[i
] & (REGISTER
| FPUREG
)) ||
630 (ins
.oprs
[i
].segment
& SEG_RMREG
))
632 ins
.oprs
[i
].basereg
= whichreg ((*p
)->opd
[i
],
633 ins
.oprs
[i
].basereg
);
634 if ( (*p
)->opd
[i
] & TO
)
635 slen
+= sprintf(output
+slen
, "to ");
636 slen
+= sprintf(output
+slen
, "%s",
637 reg_names
[ins
.oprs
[i
].basereg
-EXPR_REG_START
]);
638 } else if (!(UNITY
& ~(*p
)->opd
[i
])) {
639 output
[slen
++] = '1';
640 } else if ( (*p
)->opd
[i
] & IMMEDIATE
) {
641 if ( (*p
)->opd
[i
] & BITS8
) {
642 slen
+= sprintf(output
+slen
, "byte ");
643 if (ins
.oprs
[i
].segment
& SEG_SIGNED
) {
644 if (ins
.oprs
[i
].offset
< 0) {
645 ins
.oprs
[i
].offset
*= -1;
646 output
[slen
++] = '-';
648 output
[slen
++] = '+';
650 } else if ( (*p
)->opd
[i
] & BITS16
) {
651 slen
+= sprintf(output
+slen
, "word ");
652 } else if ( (*p
)->opd
[i
] & BITS32
) {
653 slen
+= sprintf(output
+slen
, "dword ");
654 } else if ( (*p
)->opd
[i
] & NEAR
) {
655 slen
+= sprintf(output
+slen
, "near ");
656 } else if ( (*p
)->opd
[i
] & SHORT
) {
657 slen
+= sprintf(output
+slen
, "short ");
659 slen
+= sprintf(output
+slen
, "0x%lx", ins
.oprs
[i
].offset
);
660 } else if ( !(MEM_OFFS
& ~(*p
)->opd
[i
]) ) {
661 slen
+= sprintf(output
+slen
, "[%s%s%s0x%lx]",
662 (segover
? segover
: ""),
663 (segover
? ":" : ""),
664 (ins
.oprs
[i
].addr_size
== 32 ? "dword " :
665 ins
.oprs
[i
].addr_size
== 16 ? "word " : ""),
668 } else if ( !(REGMEM
& ~(*p
)->opd
[i
]) ) {
670 if ( (*p
)->opd
[i
] & BITS8
)
671 slen
+= sprintf(output
+slen
, "byte ");
672 if ( (*p
)->opd
[i
] & BITS16
)
673 slen
+= sprintf(output
+slen
, "word ");
674 if ( (*p
)->opd
[i
] & BITS32
)
675 slen
+= sprintf(output
+slen
, "dword ");
676 if ( (*p
)->opd
[i
] & BITS64
)
677 slen
+= sprintf(output
+slen
, "qword ");
678 if ( (*p
)->opd
[i
] & BITS80
)
679 slen
+= sprintf(output
+slen
, "tword ");
680 if ( (*p
)->opd
[i
] & FAR
)
681 slen
+= sprintf(output
+slen
, "far ");
682 if ( (*p
)->opd
[i
] & NEAR
)
683 slen
+= sprintf(output
+slen
, "near ");
684 output
[slen
++] = '[';
685 if (ins
.oprs
[i
].addr_size
)
686 slen
+= sprintf(output
+slen
, "%s",
687 (ins
.oprs
[i
].addr_size
== 32 ? "dword " :
688 ins
.oprs
[i
].addr_size
== 16 ? "word " : ""));
690 slen
+= sprintf(output
+slen
, "%s:", segover
);
693 if (ins
.oprs
[i
].basereg
!= -1) {
694 slen
+= sprintf(output
+slen
, "%s",
695 reg_names
[(ins
.oprs
[i
].basereg
-
699 if (ins
.oprs
[i
].indexreg
!= -1) {
701 output
[slen
++] = '+';
702 slen
+= sprintf(output
+slen
, "%s",
703 reg_names
[(ins
.oprs
[i
].indexreg
-
705 if (ins
.oprs
[i
].scale
> 1)
706 slen
+= sprintf(output
+slen
, "*%d", ins
.oprs
[i
].scale
);
709 if (ins
.oprs
[i
].segment
& SEG_DISP8
) {
711 if (ins
.oprs
[i
].offset
& 0x80) {
712 ins
.oprs
[i
].offset
= - (signed char) ins
.oprs
[i
].offset
;
715 slen
+= sprintf(output
+slen
, "%c0x%lx", sign
,
717 } else if (ins
.oprs
[i
].segment
& SEG_DISP16
) {
719 output
[slen
++] = '+';
720 slen
+= sprintf(output
+slen
, "0x%lx", ins
.oprs
[i
].offset
);
721 } else if (ins
.oprs
[i
].segment
& SEG_DISP32
) {
723 output
[slen
++] = '+';
724 slen
+= sprintf(output
+slen
, "0x%lx", ins
.oprs
[i
].offset
);
726 output
[slen
++] = ']';
728 slen
+= sprintf(output
+slen
, "<operand%d>", i
);
732 if (segover
) { /* unused segment override */
736 p
[count
+3] = p
[count
];
737 strncpy (output
, segover
, 2);
743 long eatbyte (unsigned char *data
, char *output
)
745 sprintf(output
, "db 0x%02X", *data
);