Basic computer architecture
Posted: Sat Jan 14, 2017 11:49 pm
Where did you go to learn basic computer architecture when you started the journey of OS development (besides school)?
The Place to Start for Operating System Developers
http://f.osdev.org/
I learned ZX Spectrum architecture by reading the associated manual (there was no Internet at that time), fortunately I had a printed version with full hardware schematic and CPU instruction set manual. When you know that little basics, its easier to go forward.Mark12 wrote:Where did you go to learn basic computer architecture when you started the journey of OS development (besides school)?
You can mix them, get a bit of theory then write some assembly to try it out. I used to do that with Peter Norton's PC book, which described all BIOS and DOS services (it was in the age of real mode, but still - the same idea applies - read about some interesting piece of hardware, go and play with it).Mark12 wrote:Well, I guess I need to learn C and/or Assembly before tackling this theory.
Design-wise it's a wrong approach, because command line in your case is the end of the line - you need to have A LOT of other things working before you will have a properly working command line. And the command line (or "a shell") will be perhaps the simplest part of the whole design.Mark12 wrote:But, my aim for OSDev isn't like very high now. I just want at least something that's a command line.
Manuals are written in English language and you seem to already know it. Assembly language is specific to each CPU architecture, so if you start tinkering with RaspberryPi - you'll have to learn ARM assembly, if you try to play with wifi routers - you'd need to learn MIPS assembly and so on.Mark12 wrote:I don't think I'll be able to study any old computer reference manuals without learning the language first.
If you're looking to write programs for the Apple II, sure. It won't help much for programming a system that uses a different CPU, however; the 6502, an 8-bit CPU designed in 1975, is quite different from the Intel x86 architecture that is used in PCs, even more divergent from the Motorola 68000 used in early Macs and Amigas, and even further still from the ARM architecture used in the Raspberry Pi and the majority of smartphones and tablets.Mark12 wrote:I did get my hands on the old Apple II reference, is that good? I think so.
Yep, that's good, it's an old and rather simple 8-bit CPU, should be easy to figure out it's hardware in an evening or so.Mark12 wrote:I did get my hands on the old Apple II reference, is that good? I think so.
Good advice. As I said, just because it doesn't apply to more recent designs directly doesn't mean it won't help you understand those later.dozniak wrote:Yep, that's good, it's an old and rather simple 8-bit CPU, should be easy to figure out it's hardware in an evening or so.Mark12 wrote:I did get my hands on the old Apple II reference, is that good? I think so.
I'd say that the underlying reason is backward compatibility - it's why documentation has been accumulating over a few decades, it's why there's standards (AHCI, UEFI, etc) instead of dodgy manufacturer datasheets and/or no information, it's why there's existing source code that can be referred to, etc. It's also part of why people choose "80x86 PC" for OS development - they know that if/when they actually finish writing their OS (in 10 years or so) that "PC" will probably still be compatible with their OS (and that they haven't spent years working on software for something that will be obsolete before the OS is ready).Mark12 wrote:It doesn't really matter to me much about what my target architecture is. What's the reason most on here choose x86, besides that one being the most documented?
The other part of this is that PC architecture is "open" i.e. you can install your own bootloader and use it for running your own OS (well, lets put secure boot aside for now). The market share of the ARM CPUs is MUCH bigger than PC (tens of billions of devices) but you have absolutely no access to it's boot process and even less access to the documentation for the actual board it's installed on.Brendan wrote:For example, it's easy to find/buy/borrow multiple different computers to test your OS on, and most people are using "80x86 PC" to write (and compile/build) their OS anyway.
It's probably not a good idea to compare the market share of a range of incompatible CPUs (that have no "standardised architecture") with the market share of an actual standardised architecture. More sensible would be to compare the market shares of (e.g.) ARM's Server Base System Architecture with "80x86 PC", or Raspberry Pi Foundation's "de-facto Raspberry Pi version 1.0 architecture" with "80x86 PC", or...dozniak wrote:Brendan wrote:For example, it's easy to find/buy/borrow multiple different computers to test your OS on, and most people are using "80x86 PC" to write (and compile/build) their OS anyway.