[HN Gopher] Unearthing my 1996 windowed OS in machine code for A...
       ___________________________________________________________________
        
       Unearthing my 1996 windowed OS in machine code for Am29000 homebrew
       computer
        
       Author : nanochess
       Score  : 178 points
       Date   : 2026-07-31 21:57 UTC (6 days ago)
        
 (HTM) web link (nanochess.org)
 (TXT) w3m dump (nanochess.org)
        
       | gforce_de wrote:
       | Thanks Oscar - as always, a very very nice writing style - a good
       | read!
        
         | nanochess wrote:
         | I'm glad you enjoyed it. It is my longest article so far and it
         | took a lot of effort. Thank you!
        
       | cyberge99 wrote:
       | F 15 Strike Eagle, Infiltrator and 688 Attack Sub were some of my
       | first games.
       | 
       | And then came Leisure Suit Larry and the tweenage years.
        
         | thataccount wrote:
         | Don't leave out F4U Secret Sortie:
         | https://www.oldgame.cz/en/f4u-secret-sortie
        
       | pjmlp wrote:
       | Very interesting article, I wasn't aware of the Am29000.
        
       | rayoleary wrote:
       | You sir, are a rockstar!
        
       | taolson wrote:
       | Wow, blast from the past! I was on the architecture / micro-
       | architecture team for the 29K and 29050, and your story of
       | writing and debugging the emulator brought up similar memories of
       | working on the performance simulator for these chips.
       | 
       | Very impressive work -- congratulations!
        
         | nanochess wrote:
         | Wow! Thank you! The floating-point implementation in the
         | Am29050 is really great as it ran in parallel with the integer
         | unit. Sorry, I need to ask, maybe you don't remember. What
         | happens if you write into gr2-gr63? Not really needed to know,
         | but I've been curious the last 30 years.
        
           | taolson wrote:
           | The FPU in the 29050 was based on the Am29325 bit-slice
           | family FPU; an extra write port was added to the register
           | file to allow for asynchronous FPU result writeback, which
           | allowed the parallel operation.
           | 
           | gr2 and gr3 were used in the 29050 for FP condition code
           | registers, but otherwise I'm pretty sure accessing the rest
           | caused a trap.
        
             | nanochess wrote:
             | Amazing! I didn't knew about the gr2 and gr3 register. I
             | just searched for these in the user's manual, very sparse
             | documentation. Thank you!
        
         | turpentine wrote:
         | For the sake of archival/computing history, do you know if a
         | copy of the am29k High-C compiler could turn up on archive.org
         | one day?
        
       | bluedino wrote:
       | The breadboard computer from 1997 deserves it's own post.
        
       | sage981 wrote:
       | Writing a windowing OS straight in machine code for the Am29000
       | is wild. The emulator debugging story is the part I would love
       | expanded.
        
         | nanochess wrote:
         | The article ended so big for my own measures, but I'm glad to
         | know you want more of my wall of text. Thank you!
        
       | rob74 wrote:
       | > _The AMD Am29000 processor came out in 1987, also announced as
       | the world 's fastest processor (do you see a meme here?) and it
       | could process one instruction every cycle, so indeed it was
       | fast._
       | 
       | The AMD 29k - the fastest CPU you never heard of? No, seriously,
       | I am quite interested in computer hardware, and Computer
       | Architecture by Patterson/Hennessy was required reading during my
       | studies, but I can't say I ever heard of this CPU architecture,
       | which is "based on the seminal Berkeley RISC" (according to
       | https://en.wikipedia.org/wiki/AMD_Am29000). And it seems to have
       | been quite widely used, but not in an actual computer (except for
       | this one)...
        
         | AnotherGoodName wrote:
         | You might have heard of the x86 cpu the AMD K5 that competed
         | against the Pentium?
         | 
         | Well that was basically an am29000 but with an x86 instruction
         | decoder front end. The architecture was that good it was
         | competitive 10years later.
         | 
         | Think of the am29000 as an incredibly influential research
         | project that flowed into all of AMDs future CPUs in some way or
         | another.
        
           | rbanffy wrote:
           | > Well that was basically an am29000 but with an x86
           | instruction decoder front end.
           | 
           | Sad. A 29K saddled with an ugly and kludgy ISA.
        
           | rob74 wrote:
           | Wow, I wasn't aware of that either! I didn't have an AMD K5
           | PC, but (IIRC) a K6-III - did that still have the same
           | underlying architecture?
        
             | adrian_b wrote:
             | No. AMD K5 did not have successors.
             | 
             | AMD bought the company NexGen and K6, K6-2 and K6-III were
             | based on the NexGen design. I had been the happy owner of a
             | K6-2, which did not have the integrated L2 cache of K6-III,
             | but I had a friend who had bought earlier an AMD K5.
             | 
             | The K6 family also did not have successors, as Athlon had a
             | very different microarchitecture, with a lot of inspiration
             | from DEC Alpha.
             | 
             | The AMD K6 family of CPUs has the distinction of being one
             | of the very few modern CPUs that are described in an entire
             | book: "The anatomy of a high-performance microprocessor : a
             | systems perspective" by Bruce Shriver.
             | 
             | I am not aware about any comparable description for any
             | more recent CPU, because nowadays the companies have become
             | much more secretive.
             | 
             | It is likely that the publication of many details about K6
             | was also approved because it was an architecture abandoned
             | by AMD, as they focused on Athlon for their future (this
             | was not yet known publicly when the book was launched, in
             | 1998).
        
           | taolson wrote:
           | > Well that was basically an am29000 but with an x86
           | instruction decoder front end.
           | 
           | The K5 was based upon a 29K-family design, but it was
           | actually an un-released superscalar project code-named
           | "Jaguar", rather than just a 29K with an x86 decoder.
        
         | taolson wrote:
         | Yep, it wound up as the main CPU in a bunch of laser-printers,
         | as well as Apple's 8*24GC QuickDraw accelerator card for the
         | Macintosh, and as part of the flight-control computer on Boeing
         | 777s, among many other embedded system designs.
        
         | kjs3 wrote:
         | It's the 'other' major processor that shipped with register
         | windows along with SPARC and i960. Very popular in the embedded
         | world.
        
         | dboreham wrote:
         | This is because history gets written by the victors.
        
       | smm11 wrote:
       | OP just casually dropped awesomeness on a Thursday.
        
       | rbanffy wrote:
       | Somewhere in my collection I have an AMD 29K-based tablet that
       | was used in Sao Paulo's stock exchange trading floor. It had a
       | huge IR LED array that, I assume, was used to transmit orders to
       | receivers installed near the monitors. I managed to boot it from
       | ROM, but it seemed the machine was waiting for the transmitter to
       | send it its boot image.
       | 
       | Would have been an interesting project. Considering the size of
       | the array, I'd be able to control all TVs from the building one
       | block down.
        
       | fidotron wrote:
       | How is the phrase "register window" not in this article?
       | https://en.wikipedia.org/wiki/Register_window
       | 
       | "The AMD 29000 improved the design by allowing the windows to be
       | of variable size, which helps utilization in the common case
       | where fewer than eight registers are needed for a call. It also
       | separated the registers into a global set of 64, and an
       | additional 128 for the windows."
       | 
       | Amazing stuff. (Both the 29K and the article).
        
         | taolson wrote:
         | The registers could also be partitioned into fixed sizes and
         | protected, to allow for a banked register file that allowed for
         | amazingly fast context switches in RTOS systems.
        
           | fidotron wrote:
           | Yes, I had an architecture professor that was a fan of it
           | (and so your work, presumably!) It's the only way I'd
           | encountered it, sadly.
           | 
           | That was back around 2000 at Loughborough in the UK.
        
         | nanochess wrote:
         | There was so much stuff to cover but there's a slight mention
         | saying " had to add the LOADM and STOREM instructions as these
         | handle the spilling of local registers to memory when the
         | register stack is full" I can add an extra explanation there.
        
           | fidotron wrote:
           | It was more an expression of surprise than anything else. The
           | defining feature of the 29K, when I was introduced to it at
           | least, was what appeared to be an enormous register set and
           | the way of dealing with the stack better than the SPARC
           | equivalents.
           | 
           | The fact you got this stuff working at all is completely mind
           | bending.
        
       | ndiddy wrote:
       | Great article! I remember reading about the Toledo family's
       | computer systems ( http://www.biyubi.com/ ) years ago, but never
       | saw any specifics so they were always shrouded in mystery to me.
       | It's interesting reading about how you wrote the OS and seeing it
       | run in an emulator. It's really impressive that you were able to
       | write such a complex system in machine code.
        
       | Joker_vD wrote:
       | > The subtraction instruction has a set with reversed operands,
       | so we have SUB, SUBU, SUBS, SUBC, SUBCU, SUBCS, but also SUBR,
       | SUBRU, SUBRS, SUBRC, SUBRCU, SUBRCS.
       | 
       | Pretty much the only use of "reversed subtraction" instruction on
       | a 3-operand machine is to implement NEG (subtract from immediate
       | zero) and NOT (subtract from immediate -1, which Am29000 can't
       | actually do since it zero-extends the immediates)... but NOT is
       | usually not a very useful operation on its own anyway, especially
       | when you have an actual ANDN instruction (most of the uses of ~
       | in C are of "var &= ~mask" or "expr & ~mask" variety) _and_ a
       | whole slew of NAND /NOR/XNOR instructions as well. Oh, and also,
       | if you know _for sure_ that your value is either 1 or 0, you can
       | logically negate it by subtracting it from immediate 1.
       | 
       | On the other hand, on a 2-operand machine "SUBR reg, reg" is a
       | surprisingly useful instruction.
       | 
       | > I made a phantom ROM that reads the disk using a special
       | instruction coded in the emulator, and returns on unhandled
       | services.
       | 
       | Really puts into perspective just how useful BIOS/UEFI utilities
       | are, doesn't it? Just give me the device tree info (or the
       | equivalent) and load the bloody OS image, thank you, that's all I
       | need.
       | 
       | > I find fun how they implement the multiplication instruction
       | using a trap and 32 continuous MUL instructions (bit-shifting all
       | the way).
       | 
       | They did division the same way; I believe it was a done as a
       | clever to have an interruptible MULTIPLY/DIVIDE instructions:
       | otherwise, those 32-35 cycle beasts would need some special
       | handling in the pipeline.
        
         | ronsor wrote:
         | The BIOS originates from an era where most or all of the OS
         | software was burned to a ROM on the computer. Then disks
         | arrived and we wanted more, but we didn't want the OS to
         | implement drivers for every hardware configuration. There
         | wasn't enough room. Then there was enough room and it turned
         | out BIOS functions mostly sucked.
        
       ___________________________________________________________________
       (page generated 2026-08-07 16:01 UTC)