“Hello Habr!” on Xerox Alto

Xerox Altocomputerdeveloped at the research center Xerox PARC in 1973. The world's first computer to use metaphor “desktop” And graphical user interface. This legend computer industry, which had a huge influence on all further development of computers and software.

Using emulation, we will immerse ourselves in that wonderful time, write and compile a test program in BCPL – the great-grandfather of the C language.

On the left is the emulator, on the right is one of the surviving originals.

On the left is the emulator, on the right is one of the surviving originals.

Despite the fact that Xerox Alto workstations were never sold as a commercial product and were used only within the Xerox corporation itself and several other research centers, a small number of such machines still survived to this day, were restored and are now maintained in working condition by the hands of fans.

One of these enthusiast from sunny California is engaged restoration until the preserved workstation is fully operational and describes the process in his blog.

It turns out with difficulty, with the help of a lot of experience, working with an oscilloscope and a community of fan accounts from all over the planet.

For example, this is what a hard drive looks like:

How do you like the size?

How do you like the size?

Emulators

Found whole three existing Xerox Alto emulators, which allow you to run such ancient software on a regular modern x86 computer without any problems.

ContrAltoJS

Implementation of the emulator in Javascript, it works in the browser:

This is a pure JavaScript implementation of the ContrAlto Xerox Alto emulator. The end goal is a usable, performant Xerox Alto emulator running in your web browser.

The sources are here here.

This is probably the easiest way to view Xerox Alto, but unfortunately this implementation Very slow, keep this unfortunate fact in mind.

ContrAlto on a modern computer in a museum.  On the monitor Smalltalk is a distant ancestor of modern Java

ContrAlto on a modern computer in museum. On the monitor Smalltalk is a distant ancestor of modern Java

ContrAlto

Modern emulator in C#, created by employee Living Computers Museumassembled and launched without any problems on both Windows and Linux:

Living Computers' Engineer Josh Dersch spent more than a year creating this emulator of the Xerox Alto, a pioneering computer workstation developed at the Palo Alto Research Center (PARC) in 1973. The Alto introduced several experimental concepts, including the graphical user interface, object -oriented programming, and Ethernet networking.

Sources are located herealso available binary assembly.

It is assembled from source without any problems both in Windows and Linux. The binary build also runs on FreeBSD (with Mono), but this has not been officially announced.

In the title picture of the article, this particular emulator is running.

Salto

Probably the most “hardcore” option – in pure C, the current sources of the project are here here:

SALTO – Xerox Alto I/II Simulator. Not a project of mine, just to keep this code from getting lost

Since the code was posted 11 years ago, I think you yourself can guess that the project slightly outdated and it’s just not going to work like that anymore – I had to correct it a little.

In the first version articles I used this emulator, but for the sake of a wider audience I decided to switch to ContrAlto, which is more common and easier for users. If you are interested meat and hardcore features of assembling a native emulator also for FreeBSD – see original article.

BCPL

But before moving on to poking buttons and entering commands in the emulator, it’s still worth telling a little about the BCPL:

BCPL (Basic Combined Programming Language) — programming languagedeveloped Martin Richards V 1966 V Cambridge University.

Of course, such a dry description from Wikipedia does not even come close to conveying either its power or legend. But this language is an important milestone in the development of programming, which greatly influenced C, which appeared much later:

BCPL has had a productive life of its own, but my interest in it is more in the basis it is provided for the development of the B language and then in the history of C. This influence is traced, with gratitude, in the latter paper. As it tells, the BCPL language definition when B was developed was just the manual recorded here, together with the compiler that Richards contemporaneously wrote for the CTSS system.

The quote above, by the way, is from Bell Labs websitethe same one Bell Labswhich is present in any book on computer history since the invention of the telephone.

To illustrate, this is what the code looked like on BCPL back in 1972 (taken from sources compiler itself):

if SourceName!0 eq 0 do Error("No source file name")
if SourceDevice!0 eq 0 do Movestring(SourceName, SourceDevice)
if BinName!0 eq 0 do Error("No binary file name")

test SWTTOfile % (SWOutput & not SWTTOtype)
   ifso
      [
      if OutputName!0 eq 0 then Error("No output file name")
      OutputStream = OpenOutput(OutputName)
      ]
   ifnot [ OutputStream = TTOstream; OutputName!0 = 0 ]

test SWTTOfile
   ifso ErrorStream = OutputStream
   ifnot ErrorStream = TTOstream
...

In my opinion, even modern languages ​​are more readable, don’t you think?

An even more surprising thing was discovered: thanks to the efforts of “historian fans,” the BCPL compiler was ported to the x86 architecture: once And two.

I was also able to assemble one of these ports and use it to compile a test application (see. original article) on an x86 machine, without any emulation, but in order not to be distracted from the topic, we’ll skip it.

“Hello world” on Xerox Alto

All manipulations were carried out on regular Linux, an emulator was used ContrAlto. The only requirements for the environment are the presence of Mono installed:

mono --version
Mono JIT compiler version 6.12.0.182 (tarball Fri May  5 03:10:06 UTC 2023)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug 
        Interpreter:   yes
        LLVM:          supported, not enabled.
        Suspend:       hybrid
        GC:            sgen (concurrent by default)

Disk images can be downloaded from hereto work with the compiler you will need a file tdisk4.dsk.Z

For some unknown reason, a seemingly more relevant image bcpl.dsk contains a broken editor (bravo), so I couldn't use it.

The disk image must be unpacked before use – it turned out that ContrAlto (unlike Salto) cannot work with archived images:

zcat tdisk4.dsk.Z > tdisk4.dsk

Download the emulator from the section Releases in the project's Github repository, the required file: ContrAlto-mono.zip

Unpack and run:

mkdir contralto
cd contralto
unzip ../ContrAlto-mono.zip
mono ./Contralto.exe

The running emulator will have its own console, with its own commands:

mono ./Contralto.exe
ContrAlto v1.2.3.0 (c) 2015-2018 Living Computers: Museum+Labs.
Bug reports to joshd@livingcomputers.org

You are at the ContrAlto console.  Type 'show commands' to see
a list of possible commands, and hit Tab to see possible command completions.
>

You need to download the disk image:

>load disk 0 disks/tdisk4.dsk
Drive 0 loaded.
>             

And call the emulation start command:

>start                       
Alto started.


A graphical emulator window will appear, with Xerox Alto running inside:

The window, like the original system, has "portrait" aspect ratio, so may not fit into the screen

The window, like the original system, has a “portrait” aspect ratio, so it may not fit into the screen

Everything inside is extremely unusual for a modern user:

Team '?' will show a list of files on the disk – only filesunless I missed something, the concept of a catalog did not yet exist.

All files with the .RUN extension are executable; to launch, simply enter the name of such a file, case insensitive, and it will launch.

For example, to view the contents of a file, use the type command (TYPE.RUN):

Someone tested the cycle in 1983

Someone tested the cycle in 1983

You can enjoy the build version using the release command:

This release was ~2 months before my birth

This release was ~2 months before my birth

Having enjoyed the unity with history, we finally launch the bravo text editor:

Yes, this is the very first WYSIWYG editor in the world.

Yes, this is the very first WYSIWYG editor in the world.

Press the key i (INSERT) and enter this code:

// Hello world demo
get "streams.d"
external
[
Ws
]

let Main() be
[
Ws("Hello Habr!*N")
]

After entering, press ESC, then the key p and enter the file name:

hello.bcpl

Then press again ESC (NOT Enter!) and the saving process will start, visually slow.

After saving to disk there will be a message:

Press the key q and then Enter to exit this wonderful editor.

Now run the BCPL compiler:

bcpl hello.bcpl

This is what the compilation result looks like in the emulator:

Now let's launch linker (yes yes it is still 1972!):

bldr/d/l/v hello

Pay attention to passing parameters to the linker:

bldr is the application itself, and /d/l/v are parameters that appear in a row immediately after the application name and without spaces.

This is what the result of the linker looks like:

Finally, we launch the application itself:

hello

Result:

Congratulations – you have just touched the history of the IT industry with your own hands, almost live.

Epilogue

The Xerox Alto project is in its purest form story the entire computer industry. An important stage of development that determined all further development of computers.

Of course, research workstations so incredibly powerful, created and used before my birth, never appeared on the territory of the USSR/RF; even in the USA itself there was little information about this project in those years.

Launching an emulator of this station and seeing it live means touching the origins of the entire IT industry, seeing where the principles of program construction, graphic editors and the interface itself in general came from.

And climbing on the laid out source code archive Xerox Alto, you can see for yourself how old really are principles of computer operation and software development.

Incredible experience, I recommend it.

0x08 Software

We are a small team of IT industry veterans, we create and develop a wide variety of software; our software automates business processes on three continents, in a wide variety of industries and conditions.

Let's revive long dead, fixing something that never worked and create impossible — then we talk about it in our articles.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *