←back to thread

617 points EvgeniyZh | 1 comments | | HN request time: 0.205s | source
Show context
zabzonk ◴[] No.43576999[source]
I've written an Intel 8080 emulator that was portable between Dec10/VAX/IBM VM CMS. That was easy - the 8080 can be done quite simply with a 256 value switch - I did mine in FORTRAN77.

Writing a BASIC interpreter, with floating point, is much harder. Gates, Allen and other collaborators BASIC was pretty damned good.

replies(4): >>43577257 #>>43577890 #>>43579471 #>>43580146 #
teleforce ◴[] No.43580146[source]
Fun facts, according to Jobs for some unknown reasons Wozniak refused to add floating point support to Apple Basic thus they had to license BASIC with floating point numbers from Microsoft [1].

[1] Bill & Steve (Jobs!) reminisce about floating point BASIC:

https://devblogs.microsoft.com/vbteam/bill-steve-jobs-remini...

replies(2): >>43580215 #>>43585252 #
WalterBright ◴[] No.43585252[source]
Writing a floating point emulator (I've done it) is not too hard. First, write it in a high level language, and debug the algorithm. Then hand-assembling it is not hard.

What is hard is skipping the high level language step, and trying to do it in assembler in one step.

replies(3): >>43585361 #>>43586743 #>>43589235 #
zabzonk ◴[] No.43585361[source]
I've never understood floating point :-)
replies(5): >>43585716 #>>43585892 #>>43587144 #>>43587391 #>>43590143 #
1. djmips ◴[] No.43587391[source]
Fixed point is where the number has a predetermined number of bits for the integer and fraction like 8.8 where you have 0-255 for the integer and the fraction goes from 1/256 to 255/256 in steps of 1/256

Floating point at it's simplest just makes that a variable. So the (.) position is stored as a separate number. Now instead of being fixed - it floats around.

This way you can put more in the integer or more in the fraction.

The Microsoft Basic here used 23 bits for the number, 1 sign bit and 8 bits to say where the floating point should be placed.

Of course in practice you have to deal with a lot of details depending on how robust you want your system. This Basic was not as robost as modern IEEE754 but it did the job.

Reading more about IEE754 is a fascinating way to learn about modern floating point. I also recommend Bruce Dawson's observations on his Random ASCII blog.