[Gllug] The BBC and Microsoft.

Nix nix at esperi.demon.co.uk
Wed Oct 31 00:09:31 UTC 2001


On Mon, 29 Oct 2001, jim at madeira.physiol.ucl.ac.uk uttered the
following:
> I wouldn't bet my life on it. I know Unix-like shells exist for the
> Commodore 64, which uses a 1MHz 6502 (well actually a 6510; it's
> instruction-set compatible but has a few hardware differences). The Beeb,
> on the other hand, has a 2MHz 6502A. Yes, the Commodore 64 can access all
> its 64K of RAM as a contiguous address space, but expansion boards exist
> for the Beeb to bring it up to 64K or more (not contiguous though, you'd
> need to bank switch), and if you had a 2nd processor over the Tube I think
> such a thing would be quite feasible.

*Absolutely* so. In a two-year long bout of insanity from 1991--93, just
after I discovered Unix and a few years after I discovered C, I wrote a
pseudo-C and a sort of quarter-Unix on my C64 (I already had a PC, but
it had no programming languages other than BASIC and I hated 8086
assembly, so I stuck to the C64 for serious hacking.)

It needed all 64K of RAM (chucking the OS out completely) and a 1541
disk drive; it used the 6502 and 32K of RAM in the disk drive (the 1541
must have been the most overspecced floppy drive of its day); the RAM on
the disk drive was used for caching and so forth; under memory pressure,
I could also swap entire programs onto it and run them there. Programs
were preferentially run on the disk drive if they were big so kept
getting swapped.)

Bugs:

  The OS used too much memory; I hardly had space to do anything else
  after they'd loaded.

  The C and Unix were bad imitations; I didn't have a copy of the C
  Standard at the time, or hardly any other references, working from an
  old Unix book that didn't talk about kernel issues, a copy of
  Tanenbaum (? I think it was) for the general OS design stuff, and for
  C --- I shudder to recall --- a *Herb Schildt* book; I'm amazed I
  managed anything, let alone the thing I called NutriC (because it was
  almost, but not quite, entirely unlike C). (The Unix was called
  Dentix; I can't recall why. Probably because it had so little memory,
  and I made some kind of connection with absent-mindedness...)

  The whole-process swapping was barely adequate; I should have written
  a virtual machine and run all the programs bytecoded in that; that'd
  have allowed the sort of VM I really wanted to implement. But I never
  got around to it. That would also have let me implement proper memory
  protection, instead of decidedly iffy compile-time bounds checks (I
  didn't even try to do formal proofs that the checks were correct, so
  of course they were horribly buggy. Later, when I learnt about the
  halting problem, I realised that what I was trying to do in that
  compiler was a special case of that. Whoops.)

Niggles:

  I was never able to use the sprite collision-detection support and
  some of the more bizarre sound stuff to perform computations, as
  I'd wanted. (Talking to the sound chip was so slow it was probably
  always a no-starter anyway, but the extra code would have filled
  what little memory I had left. ;) )  But I did use the noise
  waveform generator as a true random number generator. :)

  The terminal control codes were, er, original (I had no VT spec, and
  barely knew what a VT terminal was), and no network support. But it
  did support a serial terminal, and there was a sort of weird half-
  baked implementation of waht if I'd known they'd existed I'd have
  called PTYs.

  There was no shared memory --- but I did have full-duplex pipes,
  FIFOs, multiuser-logins-at-the-same-time, &c. (The lack of memory
  protection and the crapness of the filesystem I implemented made the
  multiuser stuff pretty pointless, but it was the *principle* of
  the thing...)

  X11 was never implemented. ;)


It was *great* fun, but not much actual use; bootstrapping it was hard,
'cos the C64 had no assembler and an appalling BASIC (my first encounter
with MS software, and it was not nice); I had none of the amenities I'd
later get used to. I had to write an assembler in hex codes, and write a
crappo-C in that that I could implement the rest of the system in.


With almost no hardware references (I couldn't afford them) and no
network links at all, I was working from almost nothing. But I did it ;)


Thinking back to it, if only I'd had decent hardware and docs (and had
been a good bit older and more clued) I might have implemented something
like Linux. Unfortunately, I discovered six years later that Linus had
started the Linux kernel even before I started working on my crappy
imitation --- and he had decent hardware, decent tools, and an Internet
link to a community of like-minded madmen :)


I recommend implementing an OS and toolchain, even a useless one, on
maximally restrictive hardware; it's not just fun, it's educational too!
(I'm fairly sure that it's what got me off on my still-running compiler
kick; I found the compiler rather more fun to write than the actual OS,
probably because writing the OS involved reverse-engineering too many of
Commodore's, er, *original* hardware decisions, often by reverse-
engineering the Kernal --- but many things, like sound and graphics,
were hardly handled by anything in ROM, so it was raw port-level hacking
or nothing).


I might perhaps still have the disks somewhere (probably in distant
Yorkshire, getting eaten by mice and attacked by damp). Certainly I've
dumped most of the memories in the ensuing decade.


Most of them. I'm off on a reminiscence kick now...

-- 
`You're the only person I know who can't tell the difference
 between a pair of trousers and a desk.' --- Kieran, to me

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list