The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] Does anybody recall how the TU10 bootstrap code actually operates?
@ 2015-12-23 18:02 Noel Chiappa
  2015-12-23 18:06 ` Larry McVoy
  0 siblings, 1 reply; 8+ messages in thread
From: Noel Chiappa @ 2015-12-23 18:02 UTC (permalink / raw)


    > Thank you for responding so carefully.

The devil is in the details...

    > I have been reading the PDP-11/40 handbook, much too much :)

I'm not sure that's possible! :-)

Yes, yes, I know, the architecture is deader than a doornail for serious use,
but I liken it to sailing vessels: nobody uses them for serious cargo haul any
more, but they are still much beloved (and for good reasons, IMO).

The PDP-11 is an incredibly elegant architecture, perhaps the best ever (IMO),
which remains one of the very best examples ever of how to get 30 pounds into
the proverbial ten-pount sack - like early UNIX (more below).

    > this is really elegant code. The guys who thought this up were amazing.

Nah, it's just a clever hack (small-scale).  What is really, almost
un-approachably, brilliant about early UNIX is the amount of functionality
they got into such a small machine.

It's hard to really appreciate, now, the impact UNIX had when it first
appeared on the scene: just as it's impossible for people who didn't
themselves actually experience the pre-Internet world to _really_ appreciate
what it was like (even turning off all one's computers for a day only
approximates it). I think only people who lived with prior 'small computer
OS's' could really grasp what a giant leap it was, compared to what came
before.

I remember first being shown it in circa 1975 or so, and just being utterly
blown away: the ability to trivially add arbitrary commands, I/O redirection,
invisibly mountable sections of the directory tree - the list just goes on and
on. Heck, it was better than all but a few 'big machine' OS's!

    > Thanks again for your help.

Eh, de nada.

	Noel



^ permalink raw reply	[flat|nested] 8+ messages in thread
* [TUHS] Does anybody recall how the TU10 bootstrap code actually operates?
@ 2015-12-23  6:59 Noel Chiappa
  2015-12-23 15:03 ` Will Senn
  2015-12-24 22:33 ` Ronald Natalie
  0 siblings, 2 replies; 8+ messages in thread
From: Noel Chiappa @ 2015-12-23  6:59 UTC (permalink / raw)


    > From: Will Senn

    > 000777  HALT

That's actually "BR ."; the difference is important, since the CPU (IIRC)
doesn't honour DMA requests when it is halted, and DMA needs to be working for
the controller to read that first block (a secondary tape bootstrap) into
memory.

    > This seems like gobbledegook to me.

:-)

    > It moves the MTCMA (Magtape Current Memory Address) into R0, then it
    > moves the MTCMA into the MTBRC (Magtape Byte Record Count)

"The address of the MTCMA into", etc. Looking quickly at the programming spec
for the TM11 controllers, it wants a negative of the byte count to transfer in
this register; the address of the MTCMA just happens to also be a large enough
negative number to be usable as the (negative) size of the transfer request.
(The first record is probably shorter than that, but that doesn't matter.)

Note that this code could probably also have been written:

    MOV #172524, R0
    MOV R0, at R0

and been equally functional.

    > then it moves 60003 into the MTC (Magtape control register), which
    > causes a read operation with 800BPI 9 Channel density.

I'm too lazy to look at the programming spec for the details, but that sounds
right.

    > Am I misinterpreting the byte codes or is this some idiosyncratic way to
    > get the Magnetic tape to rewind or something (the TM11 has a control
    > function to rewind, so it seems unlikely that this is the case

No, it's just the shortest possible program to read the first block off the
tape.

It depends on i) the operator having manually set the tape to the right point
(the start of the tape), so that it's the first block that gets read, and ii)
the fact that the reset performed by hitting the 'Start' key on the CPU clears
the TM11 registers, including the Current Memory Address register, so the
block that's read is read into memory location zero.

Hence the direction to 'once the tape has stopped moving, re-start the CPU at
0'.

	Noel



^ permalink raw reply	[flat|nested] 8+ messages in thread
* [TUHS] Does anybody recall how the TU10 bootstrap code actually operates?
@ 2015-12-23  6:13 Will Senn
  0 siblings, 0 replies; 8+ messages in thread
From: Will Senn @ 2015-12-23  6:13 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3106 bytes --]

All,

I am in the process of gaining a deeper understanding of PDP-11 machine 
instructions and how the bootstrap loader and its cousins function. As 
part of that process, I am analyzing the code. I am concurrently working 
through the DEC bootstrap loader and the bootstrap loader that is 
described in the v6 documentation. The DEC bootstrap loader, while 
fascinating and elegant, is relatively straightforward, given its 
enormous range and the fact that it is self-modifying. I wrote up my 
preliminary notes here:

http://decuser.blogspot.com/2015/12/analysis-of-pdp-11-bootloader-code.html

The code that is in the v6 documentation on the other hand is not 
yielding easily to reasonable interpretation and I was hoping y'all 
might be able to shed some light on how it works.

The following is the TU10 (TM11) bootstrap code from "Setting Up Unix - 
Sixth Edition":
TU10
012700
172526
010040
012740
060003
000777

The author's notes around the code are:
The tape should move and the CPU loop. (The TU10 code is not the DEC 
bulk ROM for tape; it reads block 0, not block 1.)
Halt and restart the CPU at 0. The tape should rewind. The console 
should type ‘=’.

Of course, following the instructions results in a successful outcome, 
but understanding what is happening is difficult given that this is a 
virtual environment and no discernible tape movement can be detected.

My attempt at interpretation is along the following lines, I 
manufactured the dissasembly based on my reading of the PDP-11/40 
handbook and the machine codes:

012700  MOV #172526, R0 ; moves the TM11 Current Memory Address Register 
(MTCMA) address into R0
172526                                  ; the immediate operand
010040  MOV R0,-(R0)        ; moves the contents of R0, 172526, into 
memory location 172524, the TM11 Byte Record Counter (MTBRC)
012740  MOV #60003,-(R0); moves 60003 into memory location 172522, the 
TM11 Command Register (MTC)
060003                                   ; immediate data
000777  HALT

This seems like gobbledegook to me. It moves the MTCMA (Magtape Current 
Memory Address) into R0, then it moves the MTCMA into the MTBRC (Magtape 
Byte Record Count), then it moves 60003 into the MTC (Magtape control 
register), which causes a read operation with 800BPI 9 Channel density. 
172526 is -5252 in 2's complement.

Am I misinterpreting the byte codes or is this some idiosyncratic way to 
get the Magnetic tape to rewind or something (the TM11 has a control 
function to rewind, so it seems unlikely that this is the case, but I'm 
mystified)?

I single stepped through the code in the simulator, and the TM11 
registers appear to be pretty unobservable (examining these three 
registers always displays 0's, but if I change from referencing the TM11 
registers to another area of memory, say 100500 I see the values I would 
expect to see as they are being moved from the registers into memory).

Thanks,

Will
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20151223/6f3fefdc/attachment.html>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-12-24 22:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-23 18:02 [TUHS] Does anybody recall how the TU10 bootstrap code actually operates? Noel Chiappa
2015-12-23 18:06 ` Larry McVoy
2015-12-23 20:29   ` Clem Cole
  -- strict thread matches above, loose matches on Subject: below --
2015-12-23  6:59 Noel Chiappa
2015-12-23 15:03 ` Will Senn
2015-12-23 15:58   ` John Cowan
2015-12-24 22:33 ` Ronald Natalie
2015-12-23  6:13 Will Senn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).