8086 (was Re: more talking to the press.)

From: Tom Jennings <tomj_at_wps.com>
Date: Fri Nov 14 15:27:03 2003

On Fri, 2003-11-14 at 12:00, Hans Franke wrote:

> > /* Fill a block of memory with 0's. */
> > void foofill (start, end)
> > {
> > char *start, *end; /* memory pointers */
> >
> > while (start < end) { /* until we reach the end... */
> > *start++= 0; /* write 0, incr pointer... */
> > }
> > }
>
> So, where's the problem?
> start and end are memory ponters, and thus belog to one
> segemt.

So, why do you assume I should/must/want to address only within a
segment?

> The whole operation is meaningless if they would
> belong to different segments. The comparsion generated
> for the while is a simple 16 bit compare.

...which technique [16-bit compare] will cause unpleasant side effects,
should the memory block be 65537 bytes long, for example.



> BTW: above example is exactly one thing why I hate C.
> basicly every compiler will generate a stupid loop, while
> in assembly a REP STOSW would do the trick at maximum
> speed possible.

Oh really....! OK you win!

EOT
Received on Fri Nov 14 2003 - 15:27:03 GMT

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:36:19 BST