字幕表 動画を再生する
We're basically using the EDSAC as a classic example of a very early von
Neumann computer. And to the great credit of Cambridge, I mean, they did get
it working by, I think it was April-May 1949, something like that. And it went on
to great glory afterwards and calculations on there, from many
Cambridge scientists ... I mean it's no exaggeration to say Nobel Prizes were
won because of the availability of EDSAC in all sorts of areas.
We're going to take a look and try and answer this question of: "How on earth do you get this
wretched EDSAC to boot up ?!" And with the help of Martin Campbell-Kelly's
emulator we're going to be able to show you something of that, because
what I want to do is to describe how the initial boot programs ... first stab at it
was called Initial Orders I, ssecond stab was called Initial Orders II -
written by a really bright guy who was the PhD student of Maurice Wilkes (who led
the EDSAC team of course). That chap's name was David Wheeler - a really nice
chap. I did know him, only slightly, but he was fearfully bright and always good
for a chat about low-level issues like this, about how did you get this wretched
thing to work given that, I suspect - inherited on EDSAC but feeding back into
early things, again, like Tommy Flowers' "Colossus" - how do you get a bit
pattern in here to tell it what to do? Because if you once get the bit
pattern in, the electronics the logic and everything inside it will execute it
correctly, that will have been checked out, but how do you get the wretched
things in? And the answer certainly on the Colossus machine was you used a set
of what were called Uniselectors to set up the 1s and 0s. And by having
enough Uniselectors plus usually a sort of `load' lever, to load it into the
current location in memory. Then you had to have an automated way inside the
hardware of stepping on to the next word to be loaded.
People like me didn't use Uniselectors but learnt this when you booted up an
early PDP-11, even as late as the 60s and 70s.
It wasn't Uniselectors, it was hand- keys on [the] front of the panel. I think we've
shown those once or twice [in previous videos]. Same thing: "up" for a "1"; down for a "0"zero; boom boom boom
boom - Load. another pattern; Load; another pattern; Load. It's bad enough loading up a
little boot program. It's unthinkable to load in an entire multi-kilobyte program
that way. But on the basis of hand switches and Uniselectors in this case,
yes, these wonderful Initial Orders II and Initial Orders I were loaded in
from Uniselectors. Once you've downloaded Martin's emulator, it comes
with a Tutorial Guide and it makes it very clear in there that, on the actual
EDSAC, when you want you to load Initial Orders you just press a button !
>> Andy Herbert - [director EDSAC rebuild project] "John is working here on the Uniselector units I talked about the boot
ROM or the Initial Instructions. Those are coded by how he's wired up these Uniselectors.
When the operator presses the start button a rotor spins in here and
as it passes each set of contacts that gets injected into the memory to download
the program". >> DFB: To give some idea - the Initial Orders, I think, were about 42 words !
Not 42K. Not 42 Meg - like it might be on a modern BIOS - 42 words! Because memory
was fantastically precious. >> Sean: What was a `word' then? Is that a 16-bit ....
>> DFB: Well, actually it was 18 bits in EDSAC but, basically, yeah. An 18-bit word could be
loaded in and you could load the whole thing in by hand. But you wouldn't want
to! So, here's the challenge then, there's all this memory here, in mercury,
available. What you want is something sitting down at the bottom of memory to
help you get bit patterns in - off paper tape. OK? So that will be your boot
program now that's the kind of thing sitting
in low memory which nowadays is the BIOS. And it's a heck of a sight more
complicated than the Initial Orders I. So, what David Wheeler for Initial
Orders I - just to get us started - early 1949: "I will write a set of Initial
Orders that sits there, all the time. And other people's tapes that come along, I
want to say two things to them: first of all please do not trample all over my
Initial Orders that have been pre-loaded. Don't go into very low memory addresses,
like zero, and start trying to overwrite it - this will] kill the program stone-dead.
But starting from, I think, he finished at 42 with his Initial Orders. But to allow for
future expansion I think the recommendation was to start off at location
64 in memory? 64 and above. you put your program there.
I will now help you load it because when you put your paper tape in, it will be my
Initial Orders I that is asking to read your tape, character by character.
OK? And initially, in Initial Orders I, he said, I will do the following. If you
type `A', I know that A is a certain bit pattern meaning ADD and I will put that
in the correct field of the correct word for you. You may then want to write an
explicit decimal number to be added, like 10. To save your brain I will translate
your decimal numbers in your instructions into binary. So there's two
things I'm doing for you: I'm translating the opcode; I'm translating
obviously decimal numbers into binary and I am keeping track of where I'm
loading them for you into memory, I will start - if you say start at 64 I'll start
at 64 - and I'll put them in successively, one after the other. >> Sean: So far it sounds to
me like he's doing the job of a modern CPU with registers and an interpreter to
interpret the code ... ? >> DFB: Yeah, it's like a very elementary assembler but whereas with
assembly it's a two-pass process: you run the assembler - then you've got your binary.
Here you're using assembly codes to make your own binary on-the-fly
>> Sean: Is this the great-grandfather of the operating system then? >> DFB: Oh yeah
The great-great-great-grandfather of the operating system! First of all we are
starting with a loader because that's all this is. It loads into memory but
it's very crude, Initial Orders I, right? What drove people mad about it was that
unfortunately you had to be in control of your [absolute] addresses. Because if your
program said "jump to location 70" - you started at 64, fine, but what happens if you
want to intervene [insert] a few more orders - a few more instructions - between 64 and 70?
You've got to [potentially] alter all the addresses in your program. Because what
was at 70 - where you wanted to go to - is now at 76. So you've got to go and say:
"Don't jump to 70, jump to 76". So, although it was a loader it couldn't do anything
much about being at all adaptive, or helping you to *relocate*, as it was called.
So, this was realized very quickly - that any alteration to your program involved
changing all your addresses on the tape. So, Initial Orders II: David Wheeler
became celebrated throughout the computer science world for this. He only in his
life ever published 11 papers, did David, but he was still an FRS [Fellow of the Royal Society].
That's how much he was rated I remember meeting Don Knuth saying, you know, who have
you met recently? What have you been doing? I said "I saw David Wheeler". "Not D.J. Wheeler?!" he
said. You know: R-E-S-P-E-C-T ! Initial Orders II ! I mean, yes, David was really celebrated
for this. It seems obvious now but it certainly was not obvious at the time.
Everybody: "Wow - your Initial Orders II - is going to help
us be able to alter the program. And just feed the tape in again without changing
all of the addresses! All we have to do is to change the load point [base address] at the top,
say, or something like that. Maybe we don't want to put it at 64, we
want to put it somewhere else. But what David Wheeler said was:
So long as you, throughout your orders, indicate and flag up to me the addresses
that will need changing. I will keep track of them and I will alter them for you.
>> Sean: Are these like variables then? >> DFB: Yeah! They ... basically it was doing what
modern assemblers can do anyway, but very early on. Saying no matter where you
choose to place this in memory. you might want to put it at 128 or
256, or anywhere. Just tell me and I will load it there. And I will fix up all
the addresses. You can just sort of say, like, 0, 1, 2 if you like. But I will
add on 64 to them, or 128 added on, or whatever you want. All you must
do is flag up to me the addresses that need to be altered - in a special way that
my Initial Orders understand. And it just revolutionized the use of EDSAC because
what, of course, every computer scientist wants to do - and admittedly this was not
done in 1949 it was done recently - is get your computer to say "Hello World".
Well, there's a contributed program here [for the simulator] that, for the sake of brevity, just gets it to
say "HI". And perhaps you want to run "HI" first and then say: "How the heck does
Initial Orders II enable this to be loaded in and to work correctly?" So, here
we go then. This is the program that we'll first of all load, when I say "Start".
"Start" loads the program that is showing in your window on the left. It has loaded in the
"HI" program. However with my fading memory of EDSAC codes I can see
that the third instruction, ZF, means "Stop". That was a very common trick to use
in an EDSAC program, is make it stop in its execution, early on. Because then you
can check in your peep... - your peephole into the tanks. Does it look plausible?
Does all of this stuff here look like a binary interpretation of all your
elementary assembler op-codes? >> Sean: And people would know what to see? >> DFB: Oh! they know what
to see. Oh yes! you can look in there saying: "Ooh! looks like an ADD instruction to me!"
Yes, so there we are. Now that's stopped here but what you can now do is
to single-shot it. Those of you, again in assembler will know, you often have a
single-shot capability for debugging. >> Sean: This is like a step through is it?
>> DFB: Yeah! just to step through. But with a bit of luck - Single EP. Ah! got a cursor now!
If I "Single EP" again, look, it's printing the letter `H'. Single-shot again, `HI'. So I think
one of the exercises in Martin's instructions - I encourage you all to do
it - just to get it to actually say "HELLO WORLD". Just make a bit longer. But here,
when we look at the program, we can see an awful lot of what is actually
happening here. It's saying "Stop" but then it goes on to actually outputting the
message. How does it do it? It uses an `O' (output) instruction. And that is part of
the EDSAC opcode. It basically means "punch this to tape", which is the way it
would have come out initially. With this @ symbol - that was one of the signals to
David Wheeler's Initial Orders. This is a relative address not an absolute one, and
I want you to adjust it for me. And because, right at the top, we've said
T 64 K - for assembler programmers that's like saying ORG = 64, in many
assemblers. But here its starting point is 64. But look at this
`O5@' means output the thing that is five locations beyond where I
currently am [correction: 5 beyond the base pointer] The `@' says you've got to add on the baseline [of 64] now, to the 5, [to give] 69.
So, down here, then, what it does first of all is it outputs `*F'. That is the code
that says `turn [change] into letter shift'. Now if you go back and watch my previous
5-hole paper tape program you'll find that, whether it's Baudot code or EDSAC code,
you have to make sure - if you want to print out letters - be doubly sure you are
in Letter shift not in Figure shift and vice-versa.
Otherwise it will all look like junk. So here is the code in EDSAC that says `turn
me into Letter shift' and make sure. Next instruction beyond here says output the
thing that is six beyond this location [i.e 6 beyond the base pointer] When you look there, right, it just says `HF' [i.e. put the bit pattern for `H' as data in this address]
So, in other words the letters H and I, that are to be output, are being picked
up as data from instructions further down and are being output by using this
memory relocation [and offset] capability. So that's all you have to do is to put down
asterisk - shortcut in EDSAC for saying `switch to letter shift'; print the letter
H; print the letter I. But it's all done very carefully by adjusting these
addresses here to actually be 69, 70 and 71 in real life. And if you do that you
then say output the bit pattern that is in 69. It's a `change to letter shift' request.
Do the one in 70 - it's the letter `H' because I've planted that there [as data] And so on.
So, I hope that if you work through that, very painfully, you can see that just
that ability to use relative offsets, yeah,
rather than absolute addresses means that the amount of rewriting of your
program - just because it gets bigger - can be greatly minimized. So, what is Initial
Orders II ? It's arguably the world's first, elementary, relocating loader. It is
keeping your program well away from trampling on Initial Orders II, but it's
relying on Initial Orders II for translation (well you don't even need to
translate opcodes into binary they are [already in] binary), decimal-to-binary conversion
and now relocation. All done for you. And all in much less than 64 words. So that's why
it's so celebrated!