Hacker News new | ask | show | jobs
by teabee89 2853 days ago
From https://hackaday.io/project/18206-a2z-computer/log/71637-5-a...

I’m afraid, Linux and a C compiler is totally not feasible.

A2Z lacks many things to achieve the goal of C retargeting and Linux porting.

- A2Z only manages Direct Addressing in hardware. No complex address computation. If you want to implement data stack, recursive functions, then direct addressing is not enough. You cannot retarget a C compiler with only direct addressing (or if you emulate complex addressing modes by software, it would be very very slow).

- A2Z has not interrupt management. You cannot implement/port a pre-emptive multitasking OS (Linux) without interrupt management.

- A2Z has no memory management unit.

- A2Z’s ALU is compatible with nothing.

1 comments

Linux is probably out of the question but lack of addressing modes won't stop a C (-ish) compiler implementation; one only need to look at microcontrollers like the PIC family, the 8051, and the 6502 to see how far they've been pushed --- C compilers are available for all of the latter.

or if you emulate complex addressing modes by software, it would be very very slow

This is exactly what 8051 compilers do, and it's actually acceptably fast in practice.

...and Linux is only "out of the question" if you rule out any sort of emulation. Otherwise... well, just take a look:

http://dmitry.gr/?r=05.Projects&proj=07.%20Linux%20on%208bit

Maybe I have not understood in details what you mean... but my A2Z CPU has no internal (hardware) stack pointer, unlike the 8051. The only available addressing mode is "direct addressing". Of course, you can emulate indirect addressing modes, and you can emulate 32 bits manipulations... But it will be not optimal at all (=very slow compared to programs using only direct addressing). Here, on A2Z, the compiler matches the simplicit of the CPU architecture, it is the same philosophy : only static allocation for variables. If I wanted a custom CPU compatible with a C compiler and with Linux, the CPU would have been totally different.