Style & Diction

While looking at some old picture of a 3B2, I remembered in college we used to use this ‘fine’ system for it’s Writer’s Workbench which revolved around the programs style & diction.

I thought it’d be interesting to see if I could track down the source, however the sources seem to have been part of the AT&T DWB package, and were not included in any of the seemingly numerous available Unix sources available on TUHS.  But thanks to this post on the TUHS mailing list, I saw this:

I know about style and diction which was shipped with BSD4.1
which (again wooly memory) was an early subset of the
whole wwb package.

Going with this, I pulled out the recently unearthed images on bitsavers of 4.1_BSD_19810710, and in the tape images sure was the source!  The only date in there is from 1979!

Deroff Version 2.0    29 December 1979

Which for a 1981 tape sure would be in the same light.  So with some fun playing with the makefiles, I had it running on Debian 8 x64!  So with a little bit of kicking I have it running on Windows via MinGW.

So for a fun example, I though I’d take Bill Gate’s forward on Inside OS/2:

 

      OS/2 is destined to be a very important piece of software. During the
 next 10 years, millions of programmers and users will utilize this system.
 From time to time they will come across a feature or a limitation and
 wonder why it's there. The best way for them to understand the overall
 philosophy of the system will be to read this book. Gordon Letwin is
 Microsoft's architect for OS/2. In his very clear and sometimes humorous
 way, Gordon has laid out in this book why he included what he did and why
 he didn't include other things.
      The very first generation of microcomputers were 8-bit machines, such
 as the Commodore Pet, the TRS-80, the Apple II, and the CPM 80 based
 machines. Built into almost all of them was Microsoft's BASIC Interpreter.
 I met Gordon Letwin when I went to visit Heath's personal computer group
 (now part of Zenith). Gordon had written his own BASIC as well as an
 operating system for the Heath system, and he wasn't too happy that his
 management was considering buying someone else's. In a group of about 15
 people, he bluntly pointed out the limitations of my BASIC versus his.
 After Heath licensed my BASIC, I convinced Gordon that Microsoft was the
 place to be if you wanted your great software to be popular, and so he
 became one of Microsoft's first 10 programmers. His first project was to
 single-handedly write a compiler for Microsoft BASIC. He put a sign on his
 door that read

         Do not disturb, feed, poke, tease...the animal

 and in 5 months wrote a superb compiler that is still the basis for all our
 BASIC compilers. Unlike the code that a lot of superstar programmers write,
 Gordon's source code is a model of readability and includes precise
 explanations of algorithms and why they were chosen.
      When the Intel 80286 came along, with its protected mode completely
 separate from its compatible real mode, we had no idea how we were going to
 get at its new capabilities. In fact, we had given up until Gordon came up
 with the patented idea described in this book that has been referred to as
 "turning the car off and on at 60 MPH." When we first explained the idea to
 Intel and many of its customers, they were sure it wouldn't work. Even
 Gordon wasn't positive it would work until he wrote some test programs that
 proved it did.
      Gordon's role as an operating systems architect is to overview our
 designs and approaches and make sure they are as simple and as elegant as
 possible. Part of this job includes reviewing people's code. Most
 programmers enjoy having Gordon look over their code and point out how it
 could be improved and simplified. A lot of programs end up about half as
 big after Gordon has explained a better way to write them. Gordon doesn't
 mince words, however, so in at least one case a particularly sensitive
 programmer burst into tears after reading his commentary. Gordon isn't
 content to just look over other people's code. When a particular project
 looks very difficult, he dives in. Currently, Gordon has decided to
 personally write most of our new file system, which will be dramatically
 faster than our present one. On a recent "vacation" he wrote more than 50
 pages of source code.
      This is Gordon's debut as a book author, and like any good designer he
 has already imagined what bad reviews might say. I think this book is both
 fun and important. I hope you enjoy it as much as I have.

First we run it through style which will give the overall report on the text.

D:\diction\bin>style.cmd forward.txt
readability grades:
        (Kincaid)  9.1  (auto)  9.2  (Coleman-Liau)  8.8  (Flesch)  8.5 (64.8)
sentence info:
        no. sent 31 no. wds 607
        av sent leng 19.6 av word leng 4.43
        no. questions 0 no. imperatives 0
        no. nonfunc wds 338  55.7%   av leng 5.58
        short sent (<15) 35% (11) long sent (>30)  13% (4)
        longest sent 35 wds at sent 14; shortest sent 7 wds at sent 5
sentence types:
        simple  39% (12) complex  32% (10)
        compound   3% (1) compound-complex  26% (8)
word usage:
        verb types as % of total verbs
        tobe  33% (26) aux  22% (17) inf  13% (10)
        passives as % of non-inf verbs   6% (4)
        types as % of total
        prep 8.6% (52) conj 4.1% (25) adv 7.1% (43)
        noun 23.9% (145) adj 14.7% (89) pron 8.4% (51)
        nominalizations   0 % (3)
sentence beginnings:
        subject opener: noun (6) pron (5) pos (2) adj (3) art (3) tot  61%
        prep  19% (6) adv   6% (2)
        verb   0% (0)  sub_conj  13% (4) conj   0% (0)
        expletives   0% (0)

So that places it on the grade 9 level, average readability.

Now let’s see about usage errors with diction!

D:\diction\bin>diction forward.txt
      os 2 is destined to be a[ very ]important piece of software.

 during the  next 10 years  millions of programmers and users will[ utilize]
 this system.

 the best way for them to understand the[ overall ] philosophy of the system
 will be to read this book.

 in his[ very ]clear and sometimes humorous  way  gordon has laid out in this
 book why he included what he did and why  he didn t include other things.

       the[ very ]first generation of microcomputers were 8 bit machines
 such  as the commodore pet  the trs 80  the apple ii  and the cpm 80 based
  machines.

 built into almost[ all of ]them was microsoft s basic interpreter.

 unlike the code that[ a lot of ]superstar programmers write   gordon s source
 code is a model of readability and includes precise  explanations of algorithms
 and why they were chosen.

[ in fact ] we had given up until gordon came up  with the patented idea described
 in this book that has been referred to as   turning the car off and on at
 60 mph.

[ a lot of ]programs[ end up ]about half as  big after gordon has explained
 a better way to write them.

 when a particular project  looks[ very ]difficult  he dives in.

number of sentences 34 number of hits 11

As you can see, Bill likes very, very much.

Explain can give you examples of what to use instead, so how about ‘a lot of’?

D:\diction\bin>bash explain
phrase?
a lot of
use "many" for "a lot of"
phrase?

Explain is a sed script, so in this case I’m using MinGW’s MSYS environment to run the script.

I don’t think much of anyone will care about text processing utilities from the 1970’s in 2016 (and beyond) but for anyone else who is bored, or found out about this by mistake, here you go!

diction.7z

You’ll get a 404 page, just read the error page for the password.

A/UX Documentation Update

(this is a guest post from Tenox)

I have recently received a large box with Apple Unix 3.0 documentation. Scanned and published here: http://www.tenox.net/docs/

The latest additions are these documents:

  • Apple A/UX 3.0 Essentials
  • Apple A/UX 3.0 Installation Guide
  • Apple A/UX 3.0 MacX User Guide
  • Apple A/UX 3.0 Networking Essentials
  • Apple A/UX 3.0 Programming Languages and Tools Vol 1
  • Apple A/UX 3.0 Programming Languages and Tools Vol 2
  • Apple A/UX 3.0 Roadmap to A/UX
  • Apple A/UX 3.0 Setting up Accounts and Peripherals for A/UX
  • Apple A/UX 3.0 Toolbox: Mac ROM Interface
  • Apple A/UX 3.0 X11 User’s Guide for A/UX

 

To my knowledge only 2.0 version of these were floating around.

This should go nicely with the latest release of Shoebill Emulator.

Virtualization Challenge Part II – WYSE Unix

(this is a guest post from Tenox)

The second virtualization contest is now on! Similar to the previous one, the winner receives $100 via Paypal and the submission is posted on this blog! Hopefully this one will be little bit more challenging. 🙂

The subject is the rarest of the rare WYSE Unix!

The progress so far: A few years ago I came in to possession of a set of floppy disks pictured here:

Wyse UnixThanks to Al Kossow from bitsavers.org the floppy disk content has been recovered. Michal Necasek of OS/2 museum successfully converted them in to an usable format and made some modifications to get them to boot on VirtualBox:

Wyse Unix in VirtualBoxCouple of years later, thanks to Andrew Gong, a WYSE Unix tape has been found on eBay:

wyseunixMore recently Al Kossow was able to read the tape in to an image, which now I have uploaded to my web server: wyseunix321a.zip

The next step is yours! Install the whole system on to a hypervisor of your choice, document the process and supply a vanilla boot image or VM.

The winner shall be the person who will first post a comment declaring success including a screenshot and can further prove it by emailing emailing me the submission shortly after. If the comment gets blocked by spam filter, don’t worry the original submission time will of course count. Oh and almost forgot: I also need aclock binary for it, however if there is no compiler and the standard SysV binary works fine, you are exempt from the requirement.

The catch? Looks like floppy disk trouble. The boot disk is fine after it has been fixed up by Michal. The Base floppy looks like has same content as boot. Copy Tools is very small. Looks like it may be truncated. Hopefully not, but if yes I count on your creativity. Remember that Dell Unix is an exactly save release of SystemV/386 and did not have or needed copy tools to install.

Good Luck!

Update: Looks like the contest has been won by Mihai! Congratulations!

I saw this git/Unix archive mentioned on TUHS

And I thought that I should broadcast it to the world. Diomidis Spinellis has gone through the hard work of going through all the old legacy Unix source code, making it easily available here.  Even more fun it to just find somewhere with a couple of GB free, and clone it!

git clone https://github.com/dspinellis/unix-history-repo

With that done, you can then ‘check’ out the repo from any of the major releases and get the source!  For example to see 4.4 BSD, you would type in:

cd unix-history-repo
git checkout BSD-4_4

Pretty cool!

And it goes up to FreeBSD 10.0.1  Release tags are:

  • Epoch
  • Research-V1
  • Research-V3
  • Research-V4
  • Research-V5
  • Research-V6
  • BSD-1
  • BSD-2
  • Research-V7
  • Bell-32V
  • BSD-3
  • BSD-4
  • BSD-4_1_snap
  • BSD-4_1c_2
  • BSD-4_2
  • BSD-4_3
  • BSD-4_3_Reno
  • BSD-4_3_Net_1
  • BSD-4_3_Tahoe
  • BSD-4_3_Net_2
  • BSD-4_4
  • BSD-4_4_Lite1
  • BSD-4_4_Lite2
  • BSD-SCCS-END
  • 386BSD-0.0
  • 386BSD-0.1
  • FreeBSD-release/1.0, 1.1, 1.1.5
  • FreeBSD-release/2.0 2.0.5, 2.1.0, 2.1.5, 2.1.6, 2.1.6.1, 2.1.7, 2.2.0, 2.2.1, 2.2.2, 2.2.5, 2.2.6, 2.2.7, 2.2.8
  • FreeBSD-release/3.0.0, 3.1.0, 3.2.0, 3.3.0, 3.4.0, 3.5.0
  • FreeBSD-release/4.0.0 4.1.0, 4.1.1, 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.6.1, 4.6.2, 4.7.0, 4.8.0, 4.9.0, 4.10.0, 4.11.0
  • FreeBSD-release/5.0.0 5.1.0, 5.2.0, 5.2.1, 5.3.0, 5.4.0, 5.5.0
  • FreeBSD-release/6.0.0, 6.1.0, 6.2.0, 6.3.0, 6.4.0
  • FreeBSD-release/7.0.0, 7.1.0, 7.2.0, 7.3.0, 7.4.0
  • FreeBSD-release/8.0.0, 8.1.0, 8.2.0, 8.3.0, 8.4.0
  • FreeBSD-release/9.0.0, 9.1.0, 9.2.0
  • FreeBSD-release/10.0.0, 10.1.0

Apout on Windows

I read somewhere that kids these days are interested in games where you can modify how the game operates with sub programs written in their own languages etc.

Hello from Unix v7

Hello

So while this does sound interesting, it does remind me of that good old fashioned syscall emulation, where you emulate the CPU, load an executable, but any system calls that are made, are handled by the simulator, little if any hardware is actually emulated. Yes Basilisk II is an example of this, but so is Wine, WOW, NTVDM, i386 code on x64 platforms, and various others. The major advantage is that they typically can access your native file system so you don’t have to mess with virtual disks. Of course it all depends on the implementation.

I did remember this old simulator, Apout, which could run UNIX v6, 7 along with BSD 2.9 stuff on modern Unix. The emulation layer here being LIBC, and how pretty much the basics of how UNIX operates hasn’t changed since those ancient days in the 1970’s.

So I thought I’d try to see how much of this works on Win32 using Microsoft Visual C++ 5. And surprisingly I didn’t have to glue in that much, the biggest thing I had to do was trying to detect if a file about to be opened was ASCII or BINARY as the UNIX platform doesn’t distinguish these two but Win32 with it’s MS-DOS legacy does. As you can see I did get the banner program running, some of the games work ok, although I had to comment out the sgtty functions as there is no immediate equivalent on Windows, and I didn’t think there would be that much of a demand for such a thing anyways. I can even run the login program. Which brings me to the issue which is that it’ll spawn new programs fine, but when an exit is called Apout just exits. Even on Linux it’ll just do this. I tried doing something with setjmp/longjmp but it crashes shortly afterwards… No doubt some stack unwinding fun. As such trying to compile things just bomb out. I went ahead and took the source code to cc and made a native Win32 version that then calls apout for the various parts and that almost worked except I then found out that the assembler on the PDP-11 is a 2 pass assembler, written in assembly. And yes, when as calls as2, and unwinds all hell breaks loose. Which is another problem that UNIX likes to share file descriptors among itself and children, but children like to close things when they die. I guess the solution is to give each child it’s own descriptor table as everyone likes to close stdin/stdout/stderr and even #4, which the simulator uses for logging. it’s very annoying so I just prevented it from closing handles under 4.

But running each of the phases manually does get me an executable but it doesn’t seem to do anything, the only syscalls are closing all the file handles and exiting.

So close!

I don’t think anyone will care, but here is my source/binary along with Unix v7. It’s hard coded to dump stuff into c:\temp for temporary files, the Unix v7 must be in c:\v7 … ugh.

Hunt the wumpus on NT

Hunt the wumpus on NT

But yeah, you can play that thrilling game from 1979, hunt the wumpus!

Dungeon on A/UX

Dungeon on A/UX

Dungeon on A/UX

I know it’s been a while since I’ve done one of these, but now that I’ve been playing with A/UX on Shoebill, I noticed that A/UX comes with a Fortran compiler!

So I downloaded dungeon, and took a few minutes, mostly making a GNU Makefile, and I was able to produce a working binary!

For anyone who cares it’s here.  I guess f2c is kind of pointless, seeing that the OS already comes with a F77 compiler.

Atari System V UNIX Saga – Part III – SCSI Disk Replacement

(note this is a guest post by Tenox)

In previous posts from ASV series I have explained why I got hooked on Atari System V UNIX and what I had to do to get a decent resolution out of Atari TT. Having built the VGA monitor adapter, the next challenge was to replace the internal SCSI hard disk with a flash storage of some sort. I really don’t like spinning hard disks and especial the old ones.

I have mentioned that there are two surviving ASV disk images. The better one was made out of a rather large old, loud and obnoxious Maxtor. I’m definitely not having this monstrosity inside of my beloved Atari!

Maxtor LXT340SY

Maxtor LXT340SY

 

So how can you replace an old SCSI hard disk with a modern flash device? There actually are several different ways.

If you have the money you can go industrial route, which is a SCSI disk replacement for various machinery and embedded systems produced by ReactiveData. You can buy one of these for a little over $1000 USD. The good part is that they substitute a specific real hard disk model and are exceptionally good in quality of emulation. However, spending a lot of money on my TT and TenoxVGA already, this really wasn’t an option without getting a divorce.

Another approach is to use SCSI to IDE bridge combined with IDE to CF adapter or possibly SCSI to SATA bridge and SATA SSD disk. These are widely used by Atari / Amiga / Mac 68k community. The most popular bridge come from a company called Acard. I actually had one of these at hand, AEC-7220U which I used for TOS/GEM work.

acard front

acard front

 

Did it work? As you can guess – of course it didn’t! The initial boot loader errors out unable to read disk capacity.

Atari SYS V failed to boot

Atari SYS V failed to boot

 

Atari ST/TT, somewhat similarly to 68k Macs require a hard disk driver, present on the hard disk itself. There are several 3rd party implementations, some of them, like HDDRIVER maintained up to present date. Unfortunately these drivers are TOS specific and obviously don’t work with Atari Unix. The system comes with it’s own hard disk driver which seems to be obsolete and with limited hardware support.

The next step was to research and try out some other SCSI to IDE bridges in hope one would just work. And surprisingly there are several to choose from.

The second on the line was I-O Data R-IDSC21-E/R. No longer produced and supported, however still fairly popular. Usually regarded as the ultimate bridge with most fancy options bells and whistles. It has most jumpers and modes of all tested devices. For instance ATA PIO and DMA modes.  Unfortunately this didn’t help at all and same error was observed.

idsc21e

idsc21e

 

Another device tried was Yamaha v769970. This bridge was conceived to allow use IDE CDROM and Hard Disks with Yamaha samplers. No longer produced and obsolete, it’s somewhat most easy to set up, robust and stable. It’s actually my favorite bridge for day to day use, except for ASV where it just doesn’t work.

v769970

v769970

 

More recent kid on the block is an integrated SCSI2IDE + IDE2CF in one device called Aztec Monster. Recently designed and currently produced in Japan (you can buy one on eBay) is a fairly decent choice, which I recommend to every one. I had a lot of luck with these, except for ASV of course…

CF_AM_r1_1

CF_AM_r1_1

 

I also looked in to SCSI to SATA bridges, like this one, but they have additional issues, like need to convert LVD to SE on one end and SATA to IDE to CF on the other. Little bit too complex for what I wanted.

Being out of luck I started researching if it would be possible to build an open source version, which can be easily diagnosed and fixed. Doing so I found out that there in fact is one open source SCSI adapter called SCSI2SD.

SCSI2SD_V3.0_plain

SCSI2SD_V3.0_plain

 

I was bit skeptical in the beginning but then I though that being open source it can be debugged and fixed if it needs to be. So I immediately ordered one.

Once it arrived, I plugged it in, applied the image to the card and BAM! It worked! The system booted fully and worked flawlessly!

Atari Unix System V – Boot Sequence from Antoni Sawicki on Vimeo.

Going back to the hardware, there are some gotchas with SCSI2SD. First of all it’s not really SD card but rather a micro-SD. Which is not a big problem, but requires magnifying glass and tweezers to operate. Secondly even though the board looks like standard 3.5″ width, it in fact it is not! So a warning: it doesn’t fit 3.5″ hard disk slot!

photo 1

photo 1

 

When one side is placed on 3.5″ HDD holes the other leaves a gaping hole. Just doesn’t fit. Apparently you need a special 3D printed bracket to fit it together. Or a double sided tape, I recommend 3M VHB Tape. The upcoming version will feature 2.5″ sized holes, so look for this one.

Other than that SCSI2SD is flawless and it works fantastic. One feature that Mac users will appreciate:

--apple Set the vendor, product ID and revision fields to simulate an
        apple-suppled disk. Provides support for the Apple Drive Setup
        utility.

In the next article I will write about my first steps in the system post boot and then bringing it to a more or less usable state. Stay tuned!

Shoebill ported to Windows!

Shoebill!

Shoebill!

Good news, as mentioned here, the Shoebill emulator was recently given some much needed SDL love, and ported to Linux.

Well that’s great and all, but the vast majority of people who run anything these days do it with Windows.  So I decided to try to get it to compile with MinGW to see how far I could get.

And the short version is that I got it working!

The long version is that in the first pass there is some SIGUSR2 stuff that is undefined.  And for a good reason, since it won’t work.  So I just commented them out.  The next minor problem was the lack of bzero.  Honestly I don’t know why bzero is missing from MinGW, but who knows why.

Shoebill also processes some internal macros with a perl script that for some reason was dropping in binary values into the source, making GCC mad.  I just commented out a line that was adding in more comments into the header.  This let me compile with a simple pass.

There was some issues reading the ROM file, since the 68000 is a BIG ENDIAN processor, and the 8086 is LITTLE ENDIAN, Shoebill makes extensive use of hotns and hotnl, ntohl, and ntohll.  These can be found in the winsock library, and even better they dont need any winsock initialization, they work right away.  I just have to make sure I include winsock2.h, and link against the winsock library.

However when trying to boot, the checksum was 0x00000000, not the expected value!   Luckily there was an assert to catch that and crash.  This led me to notice that in Linux files are opened in binary mode by default, while on Windows, they are opened in ASCII mode.  A quick change of all the fopen calls, and I was reading the ROM, but now crashing on the disk.

As it turns out newer versions of GCC go all crazy when it comes to structs, and try to automatically align to boundaries for quick access.  Which sound nice, until you try to read in some binary data, and expect things to be in certain locations and find out that your structure is larger than expected, and data is read in the wrong place.

The solution is to force the compiler to leave it alone with

__attribute__ ((__packed__))

HOWEVER as luck would have it, Microsoft apparently packs structures a different way, and you have to either make a macro to do a bunch of work to force it to make the structure 1:1 of what you expect, or use the CFLAG option of

-mno-ms-bitfields

And now MinGW’s GCC will build something along the lines of what it’d build on Linux.

Putting it all together, I amazingly got this!

Shoebill on Windows

Shoebill on Windows

Phew!  So for those interested, here is the source code drop(Use the updated one here!), and here is the binary.

If you ever wanted to see the “OS X” of the 1980’s, now is your chance!

Philip Pemberton’s 3B1 emulator now Boots AT&T Unix!

No really, you read that right!  You may remember my post about this emulator a while back, with a small mention how it’ll boot the diagnostic disk, and fail from there.

Well now, thanks to Andrew Warkentin’s hard work, the system now boots!

3B1 time check

3B1 time check

Using the 3.51 installation set from bitsavers, and the IMDU program to decompress the disk images the emulator can install UNIX onto a hard disk image (be sure to check the debug version, and the stderr.txt for the emulated geometry for your supplied hd.img).

I’ve got to say, it’s pretty cool!  Although building the exe for Windows needed a little nudge, but my compile seems to be working, although the ‘release’ version still outputs far too much information.

blank

blank

At this point it’s stuck “working” .. I thought it’d be able to do more, but it did take down the new root password, and then say it’s “setting up the screen”.  I ran a second copy on wine for the heck of it, and it’s doing the same thing.

xx

Apparently if you ‘X’ the modem panel, you’ll get a desktop

I’ll update as I can, but I wanted to get this out there.  For those who want to try, you can download my work here. Remember F10 will capture/uncapture the mouse.

The floppy disk file is called ‘discim’.  Simply copy the RAW 409,600 byte file onto this filename, and freebee will pick this up as a disk change.  You can make a hard disk file by simply creating a blank file (I used qemu-img create -f raw hd.img 65M) by providing a file of that size called hd.img .  When freebee starts, if you look at stderr.txt it will tell you the geometry that it is going to use:

WD2010 initialised, 1040 cylinders, 8 heads, 16 sectors per trackDisc image loaded.

Which you then pass onto the diagnostic disk to format the hd.img.

(boot with the diagnostic/setup disk, 01.RAW)

Option #2 (Format Disk), then Option 12 (Others).  Then using my information, 1040 cylinders, 8 tracks, 16 sectors per track (I guess it figures out heads on it’s own from the tracks?)  I then let it setup the disk as multi-user and it’ll format the disk.  It should only take a few seconds.

Format the disk from the diagnostics floppy

Format the disk from the diagnostics floppy

Installation of the OS starts with 02.RAW and it’s pretty self explanatory.

Apparently the best way to login the first time is to move the mouse frantically around, and it may let you into the system.  Logon as root and try doing this:

remove the /dev/ph0 and /dev/ph1 files

make a new /etc/inittab

is:2:initdefault:
rc::bootwait:/etc/rc > /dev/null 2>&1
vid:2:respawn:/etc/getty window 9600

remove the files

/etc/.modeminit
/etc/.phclr
/etc/.phinit

I did that to my disk (download), and I can now boot up.

3B1 booted up!

3B1 booted up!

I found vi and the C compiler on the bitsavers archive, but the C compiler currently doesn’t work.

panic

panic: pagein

Which is no doubt something else up with the MMU.