Re: Some words of encouragement

David Given
2012-02-25T19:09:27Z

[-- Attachment #1: Type: text/plain, Size: 1987 bytes --]

On 25/02/12 18:04, Brad Normand wrote:
[...]
> What I was thinking of, is pointers are stored as flat 32 bit (4GB)
> pointers, and when code uses a pointer, it can do its own arithmetic
> in 32 bits, or it can make the kernel translate the address into a
> DS:SI or ES:DI combination (behind the scenes, swapping in the 64KB
> this makes visible if needed).

When you say 4GB pointers, you mean physical addresses? It sounds
feasible, but I've never heard of anybody doing it.

This would give you fast pointer arithmetic at the expensive of much
slower indirection, due to having to frequently reload ds or es; I'd
imagine that there's more indirection than pointer arithmetic in the
average C program.

Hmm... the compiler would be able to optimise constant indirections
(a->b), but not non-constant indirections (a[i]). The first case would
turn into a ds:[si+$n] indirection, but the latter case would have to do
explicit pointer arithmetic on the physical address a and then reload ds.

As you say, compiler support is the biggest issue. (You know what would
be nice? 8086 support for LLVM.)

Aha. I see that Watcom allows you to *mix* large and huge mode. This
would let you use large mode for most of your data, i.e. anything that's
referring to objects that are smaller than 64kB, and huge pointers for
anything bigger. Of course, this does require you to annotate your
pointers, but it gives you the speed of large mode plus limited
flexibility when you need large data objects.

> tl;dr: I'd love me some nethack running on 8088.

Get the overlaid real-mode version from here:

http://www.nethack.org/v331/ports/download-msdos.html

PS. Please don't cc me if you're replying to the list!

--
┌─── ｄｇ＠ｃｏｗｌａｒｋ．ｃｏｍ ───── http://www.cowlark.com ─────
│
│ "Never attribute to malice what can be adequately explained by
│ stupidity." --- Nick Diamos (Hanlon's Razor)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]