←back to thread

118 points mariuz | 5 comments | | HN request time: 0s | source
1. mati365 ◴[] No.45655689[source]
Writing compilers for old CPUs has some real magic in it. It helps you see how processors really work and brings back the old days when hardware was simple and easy to understand. I miss that time. I once wrote a small C compiler in TypeScript for the Intel 8086 and 8087 ([1]), and I have huge respect for the people who coded for those chips. It’s super hard but also very rewarding.

[1] https://github.com/Mati365/ts-c-compiler

replies(4): >>45655833 #>>45656775 #>>45658223 #>>45662182 #
2. le-mark ◴[] No.45655833[source]
I think writing lexers and parsers is just fun, code generation I have not done; which is next level imo. I guess the next level after that is doing the lexing parsing and code generation on the chip. Then the need for multi pass compilation would become apparent quickly I presume!
3. zahlman ◴[] No.45656775[source]
> It helps you see how processors really work and brings back the old days when hardware was simple and easy to understand. I miss that time.

Just FWIW, you can still find Z80s listed for sale all over the usual e-merchants and people absolutely still design around them. It wasn't discontinued until last June, and there's an updated eZ80 design still made and sold by Zilog.

4. PaulHoule ◴[] No.45658223[source]
The Z-80 was one of the best compiler targets of that age, but the 8086 was even better. Everyone was amazed at the very fast Turbo Pascal compiler for the Z-80 that got ported to 8086. I had an 80286 computer and Turbo Pascal was my favorite programming language because the compiler was fast, execution was fast, and the language was extended enough that you could do most systems and applications programming in Pascal -- you could easily link assembly language procedures such as replacements for the stdlib zero and copy routines that took advantage of new instructions and wider paths to 2x those functions.
5. kjs3 ◴[] No.45662182[source]
8086 was a cakewalk compared to some of the weirder old chips. 6502 is a notoriously bad compiler target but things like the Signetics 2650 or RCA 1802 had a completely different set of challenges.