-5

I am trying to build a CPU from scratch (from NOR gates) in an emulator first, then on breadboard. (Inspired by nand2tetris and Ben Eater)

Just trying to understand how things work.

Now, as my CPU will be new, how would I instruct an OS, say Arch Linux to work with it?

What role the BIOS will play? Will I have to write a BIOS which contains an assembler in it?

Do I need to write some program on the OS too?

So that, it starts to communicate with my CPU.

[P.S]: I am a programmer, so pretty much have an idea on how things move till assembly level.

Just want to know how the hardware level works beyond Assembly.

Or in other words, what was written on BIOS for the first ever computer?

How did it bootstrap?

6
  • 5
    This sounds like a generic CS question with no RC relation at all, doesn't it?
    – Raffzahn
    May 22, 2022 at 19:31
  • 4
    Well, RC.SE is about old computers, not CS or electronics and nor about teaching basics.
    – Raffzahn
    May 22, 2022 at 19:43
  • 9
    You may want to pick up Andrew S. Tanenbaum's book "Operating Systems Design and Implementation" where he writes the Minix operating system from the ground up. Linux was based on Minix. I think BeOS was, too. May 22, 2022 at 19:53
  • 2
    Software doesn't "know" how to run. You write it. You'll need compilers (or at least code generators) and you'll need to write the architecture-specific support in any OS you chouse.
    – dave
    May 23, 2022 at 1:06
  • 2
    @PalashKantiKundu Don't believe anything you read on Stack Overflow. Especially where you should be asking your questions. May 23, 2022 at 7:01

1 Answer 1

5

If it's entirely new, it's not "retrocomputing", even if you try to make some very simple computer, like in old times.

After completing the hardware, you'll likely want to make a cross compiler, typically a new target for LLVM or GCC and binutils.

Then some inital boot software that will detect the hardware and configure some stuff before starting the OS. For example based on U-BOOT.

Then you will need to adapt the OS (Linux, NetBSD for example) to be able to run on your computer. That means writing code for managing low level hardware such as the MMU, interruptions, register saving, task switches, timers... And if the peripherals are also different, then you'll need to write new drivers.

You can also imagine different ways to make computers, something else than UNIX or Windows. This is where studying old computers (60s-80s) you will find many original point of view from what is done nowadays. For example Lisp machines, Xerox, Soviet computers, etc.

4
  • Hmm, now I understand. Thanks for the pointer of old machines. I will read about them. I definitely need to read a lot more beyond the high level programming. May 22, 2022 at 19:46
  • The only issue is that, I don't want to use any other machine except for the one which runs logisim and I pretend I am building the first computer. May 22, 2022 at 19:48
  • 4
    Sounds like a fun project. But remember, the first computer (the first couple of generations of computers...) did not run Linux. Hard to say (for me, just because I haven't done the research, the information is available) what the minimum requirements are, but a typical first computer from NOR gates, etc. might be 8-bits, 4K - 64K RAM, etc. A viable Linux will need a lot more power than that. Better to think in terms of "CP/M" or "MS-DOS" or similar as the OS starting point, but you can make it whatever you want since it is your design. May 22, 2022 at 20:41
  • 5
    If you're building rhe first computer then you're programming in machine code, at least until you've got a rudimentary assembler working. Then you can use that to write everything else. You have nothing except what you write.
    – dave
    May 23, 2022 at 1:08

Not the answer you're looking for? Browse other questions tagged .