[H-GEN] PHP-11 emulator in Javascript!
Mick
bareman at tpg.com.au
Fri May 6 02:29:37 EDT 2011
On Fri, 06 May 2011 16:21:57 +1000
Russell Stuart <russell-humbug at stuart.id.au> wrote:
> [ Humbug *General* list - semi-serious discussions about Humbug
> and ] [ Unix-related topics. Posts from non-subscribed addresses
> will vanish. ]
>
> On Thu, 2011-05-05 at 20:48 +1000, Robert Brockway wrote:
> > Amazing...
> >
> > http://aiju.de/code/pdp11/
>
> I confess to thinking it must be some sort of hoax. But it isn't.
>
> I presume Greg and I were one of the few who can comfortably use the
> native v6 editor with referring to a manual. I guess that is
> indicative of being a certain age, however even I was mystified by
> the command dsw, so I tracked it down. Turns out it is the
> predecessor of rm -i, however its usage is somewhat atypical. From
> http://tldp.org/LDP/LG/issue49/fischer.html:
>
> "To use the original dsw, you would set the front panel
> switches to a number and run dsw, which would then read that number of
> entries from the current directory, print on the terminal the
> name of the last one it had read, and crash itself, leaving a
> core dump. You could then, if you wanted, remove the file it
> had named by re-executing the core file."
>
> Sadly the emulator doesn't have the front panel switches.
>
> Seeing the instruction set of a PDP-11 reduced to 1000 odd lines of
> javascript fired off mixed emotions. I recall being very proud of
> mastering it quickly, so it is deflating to see it made so simple.
> Another experience a couple of months ago to puts it into a different
> perspective. I was doing some kernel hacking and was forced to
> download the Intel x86 Architecture Manuals, which comes in 5 volumes
> totalling some 4000 pages. I spent many days dredging through them,
> trying to understand the finer details of how switch between ring 0
> and ring 3 effects the memory mapping. At the end of what felt like
> a journey to hell and back, I wondered how we got to this point.
>
> To get a feel for why, consider the pseudo code for the add
> instruction. Here is it copy and pasted from the Intel manual:
>
> DEST ← DEST + SRC;
>
> Notice how neatly the pseudo code abstracts away all the messy details
> surrounding memory addressing, faults, flags and instruction decoding.
> The pseudo code for the call instruction is written in a similar
> way. I won't list it here because it it around 350 lines long.
>
> To put it another way, it takes roughly 1/3 of the code needed to
> implement an entire PDP-11 to implement the call instruction on the
> x86. Almost all of this pseudo code implements features no one uses,
> because they are too slow. If the features no one uses weren't
> there, the pseudo code for call would be:
>
> Push(IP); IP ← DEST;
>
> To me, the modern x86 architecture looks like it was designed using
> the same mentality as dsw's user interface.
>
NEVER FORGET:
x86 is just massive overloading of an unsuccessful 4 bit washing
machine controller ;)
mick
More information about the General
mailing list