From: peter on
Hi
I am adding a "page up" and "page down" button to the instruction
panel (http://peter-bochs.googlecode.com/files/screendump20100203.png)

For the page up button, I don't know how to calculate the address to
start to disassemble. For example, if I am disassembling 0x1000
address, how can I know what address I should disassemble after
pressing the "page up" button, it could be 0xff0, 0xff1, 0xff2.

Currently I use this method, but it has bug, arround 50% will
disassemble the correct result: save the first 10 instructions into
an array, keep trying to disassemble the previous address (decrease
the address one by one to try), if those 10 instructions appears
again, that mean I have disassemble the correct address.

thanks
from Peter (cmk128(a)hotmail.com)
From: Alexei A. Frounze on
On Feb 17, 8:58 pm, peter <cmk...(a)gmail.com> wrote:
> Hi
>     I am adding a "page up" and "page down" button to the instruction
> panel (http://peter-bochs.googlecode.com/files/screendump20100203.png)
>
> For the page up button, I don't know how to calculate the address to
> start to disassemble. For example, if I am disassembling 0x1000
> address, how can I know what address I should disassemble after
> pressing the "page up" button, it could be 0xff0, 0xff1, 0xff2.
>
> Currently I use this method, but it has bug, arround 50% will
> disassemble the correct result:  save the first 10 instructions into
> an array, keep trying to disassemble the previous address (decrease
> the address one by one to try), if those 10 instructions appears
> again, that mean I have disassemble the correct address.
>
> thanks
> from Peter (cmk...(a)hotmail.com)

You can't implement this correctly in general when your instructions
have variable length and even may overlap with data. You may only try
or let the user do this by allowing him to adjust the address on the
first line by +/-1 in an easy manner.
Alex
From: peter on
On 2月18日, 下午2時43分, "Alexei A. Frounze" <alexfrun...(a)gmail.com> wrote:
> On Feb 17, 8:58 pm, peter <cmk...(a)gmail.com> wrote:
>
>
>
>
>
> > Hi
> >     I am adding a "page up" and "page down" button to the instruction
> > panel (http://peter-bochs.googlecode.com/files/screendump20100203.png)
>
> > For the page up button, I don't know how to calculate the address to
> > start to disassemble. For example, if I am disassembling 0x1000
> > address, how can I know what address I should disassemble after
> > pressing the "page up" button, it could be 0xff0, 0xff1, 0xff2.
>
> > Currently I use this method, but it has bug, arround 50% will
> > disassemble the correct result:  save the first 10 instructions into
> > an array, keep trying to disassemble the previous address (decrease
> > the address one by one to try), if those 10 instructions appears
> > again, that mean I have disassemble the correct address.
>
> > thanks
> > from Peter (cmk...(a)hotmail.com)
>
> You can't implement this correctly in general when your instructions
> have variable length and even may overlap with data. You may only try
> or let the user do this by allowing him to adjust the address on the
> first line by +/-1 in an easy manner.
> Alex

thanks, I agree
From: wolfgang kern on

peter asked:
> Hi
Hello,

> I am adding a "page up" and "page down" button to the instruction
> panel (http://peter-bochs.googlecode.com/files/screendump20100203.png)

> For the page up button, I don't know how to calculate the address to
> start to disassemble. For example, if I am disassembling 0x1000
> address, how can I know what address I should disassemble after
> pressing the "page up" button, it could be 0xff0, 0xff1, 0xff2.

> Currently I use this method, but it has bug, arround 50% will
> disassemble the correct result: save the first 10 instructions into
> an array, keep trying to disassemble the previous address (decrease
> the address one by one to try), if those 10 instructions appears
> again, that mean I have disassemble the correct address.

> thanks
> from Peter (cmk128(a)hotmail.com)

I once tried this too and also used backwards byte stepping,
but it will only be correct if it starts with the max. possible
instruction-length (14/15 bytes depending on mode) and it heavy
fails if code is mixed with data. It only remembered the last
known start address of the first visible line for matching.

So finally I just remember the address of the previous page start
(even page size may vary with selected display layout) and use
the cursor keys for moving back one byte at a time.
This way allow to see otherwise hidden entry-points in addition.

__
wolfgang



From: peter on
On 2月18日, 下午7時00分, "wolfgang kern" <nowh...(a)never.at> wrote:
> peter asked:> Hi
>
> Hello,
>
> >    I am adding a "page up" and "page down" button to the instruction
> > panel (http://peter-bochs.googlecode.com/files/screendump20100203.png)
> > For the page up button, I don't know how to calculate the address to
> > start to disassemble. For example, if I am disassembling 0x1000
> > address, how can I know what address I should disassemble after
> > pressing the "page up" button, it could be 0xff0, 0xff1, 0xff2.
> > Currently I use this method, but it has bug, arround 50% will
> > disassemble the correct result:  save the first 10 instructions into
> > an array, keep trying to disassemble the previous address (decrease
> > the address one by one to try), if those 10 instructions appears
> > again, that mean I have disassemble the correct address.
> > thanks
> > from Peter (cmk...(a)hotmail.com)
>
> I once tried this too and also used backwards byte stepping,
> but it will only be correct if it starts with the max. possible
> instruction-length (14/15 bytes depending on mode) and it heavy
> fails if code is mixed with data. It only remembered the last
> known start address of the first visible line for matching.
>
> So finally I just remember the address of the previous page start
> (even page size may vary with selected display layout) and use
> the cursor keys for moving back one byte at a time.
> This way allow to see otherwise hidden entry-points in addition.
>
> __
> wolfgang

thanks too