logoalt Hacker News

johngossmanyesterday at 8:29 PM3 repliesview on HN

Sometime in the 80s, I implemented the core of the Mandelbrot Set calculation using assembly on an 8087. As the article mentions, the compilers did math very inefficiently on this stack architecture. For example, if you multiplied two numbers together and then added a third, they would push the first two numbers, multiply, pop the result, push the result back onto the stack (perhaps clearing the stack? after 40 years I don't remember), push the third number, add, pop the result. For the Mandelbrot loop this was even worse, as it never kept the results of the loop. My assembly kept all the intermediate results on the stack for a 100x speed up.

Running this code, the 8087 emitted a high-pitched whine. I could tell when my code was broken and it had gone into an infinite loop by the sound. Which was convenient because, of course, there was no debugger.

Thanks for bringing back this memory.


Replies

anyfootoday at 12:06 AM

Ah, lots of supposedly solid state computer stuff, including CPUs, did that. I, too, used it for debugging. This wasn't very conscious on my part, but if some whine became unusual and constant, it was often a sign of something hanging.

As I got older, not only did computers stop doing that, my hearing also got worse (entirely normal for my age, but still), so that's mostly a thing of the past.

show 3 replies
userbinatortoday at 1:37 AM

The compilers available at the time that the 8087 was commonplace were overall horrible and easily beaten anyway.

On the other hand, skilled humans can do very very well with the x87; this 256-byte demo makes use of it excellently: https://www.pouet.net/prod.php?which=53816

show 2 replies
anthkyesterday at 11:41 PM

- You can do the Mandelbrot set with integers. In Forth it's 6 lines.

- Coincidentally, Forth promotes a fixed point philosophy.

- Forth people defined the IEEE754 standard on floating point, because they knew how to do that well in software.

show 1 reply