logoalt Hacker News

Unearthing my 1996 windowed OS in machine code for Am29000 homebrew computer

138 pointsby nanochesslast Friday at 9:57 PM32 commentsview on HN

Comments

taolsontoday at 2:24 PM

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!

show 1 reply
Joker_vDtoday at 6:53 PM

> 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.

show 1 reply
ndiddytoday at 5:42 PM

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.

rbanffytoday at 4:07 PM

Somewhere in my collection I have an AMD 29K-based tablet that was used in São 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.

sage981today at 2:50 PM

Writing a windowing OS straight in machine code for the Am29000 is wild. The emulator debugging story is the part I would love expanded.

show 1 reply
fidotrontoday at 5:32 PM

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).

show 2 replies
rob74today at 2:57 PM

> 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)...

show 4 replies
gforce_delast Saturday at 5:02 AM

Thanks Oscar - as always, a very very nice writing style - a good read!

show 1 reply
cyberge99today at 1:00 PM

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.

show 1 reply
bluedinotoday at 2:31 PM

The breadboard computer from 1997 deserves it's own post.

pjmlptoday at 1:40 PM

Very interesting article, I wasn't aware of the Am29000.

rayolearytoday at 2:17 PM

You sir, are a rockstar!

smm11today at 3:39 PM

OP just casually dropped awesomeness on a Thursday.