www.digitalmars.com         C & C++   DMDScript  

c++.command-line - buglet in obj2asm, branches fall a tad short

reply Larry Brasfield <larry_brasfield snotmail.com> writes:
While perusing obj2asm output, I was initially perplexed
by branches that appeared to land in the middle of
instructions.  Further study shows that the real problem
is an error in the disassembly.  Here is an example.

Partial disassembly of the medium model C startup code:
002b:   81 FB 00 10     cmp     BX,01000h
002f:   72 03           jb      $+4h
0031:   BB FF 0F        mov     BX,0FFFh
0034:   8B D0           mov     DX,AX
0036:   03 D3           add     DX,BX

Note that the jb target is off by -1.  (The 03 operand
is added to the IP for the following instruction.)  It
should read "...  jb  $+5h" to conform to conventional
meaning of the '$' notation.

-- 
-Larry Brasfield
(address munged, s/sn/h/ to reply)
Jun 29 2002
parent "Walter" <walter digitalmars.com> writes:
Thanks. I'll check it out. -Walter

"Larry Brasfield" <larry_brasfield snotmail.com> wrote in message
news:MPG.178799f14ffbe8a2989681 news.digitalmars.com...
 While perusing obj2asm output, I was initially perplexed
 by branches that appeared to land in the middle of
 instructions.  Further study shows that the real problem
 is an error in the disassembly.  Here is an example.

 Partial disassembly of the medium model C startup code:
 002b:   81 FB 00 10     cmp     BX,01000h
 002f:   72 03           jb      $+4h
 0031:   BB FF 0F        mov     BX,0FFFh
 0034:   8B D0           mov     DX,AX
 0036:   03 D3           add     DX,BX

 Note that the jb target is off by -1.  (The 03 operand
 is added to the IP for the following instruction.)  It
 should read "...  jb  $+5h" to conform to conventional
 meaning of the '$' notation.

 --
 -Larry Brasfield
 (address munged, s/sn/h/ to reply)

Jul 01 2002