3 ms·
Learn C and dive in. The various "osdev" communities are good places to hang out, though I personally find IRC to be somewhat better than the forums and such.
by Syonyk 5y ago
Learn C and dive in.
The various "osdev" communities are good places to hang out, though I personally find IRC to be somewhat better than the forums and such.
If you can reason about the code you write in a memory-byte-accurate and handwavingly "what it actually uses in assembly" manner, you can start in. Most hobby OS projects don't ever get past toy stage, a few do.
Unix, however, was designed to be portable, so getting Unix-like OSes running on all sorts of random stuff is easier than writing from scratch.
- wk_end 5y agoC on the 6502 is pretty painful.
- homarp 5y agosee https://news.ycombinator.com/item?id=27324653 https://news.ycombinator.com/item?id=27324653 A project to port LLVM to the MOS 6502 and http://calc6502.com/RobotGame/summary.html http://calc6502.com/RobotGame/summary.html comparing ASM, C and Forth of the same program
- duskwuff 5y agoExtremely painful. * There are only three data registers (A, X, Y), and they aren't interchangeable. Values get spilled to the stack or memory constantly. * Memory addresses are 16 bits, so they cannot be stored in registers at all, and performing even simple operations on them (like incrementing an address) requires carry handling. * The stack is hard-limited to 256 bytes, so pushing too many temporary values onto the stack risks stack overflow. * Addressing modes are limited. There is no "address + immediate offset" addressing mode, making pointers to dynamically allocated structures awkward to work with, and some indexed addressing modes will roll over if they're used to index past the end of a 256-byte page.
- NobodyNada 5y ago* There's also no stack-relative addressing mode (unless you move the stack pointer to the X register). * No instructions to push or pop anything besides A or status flags. The combination of all of this basically means there's no good way to do local variables on the 6502. IIRC the C compilers typically reserve a bunch of memory for a separate "C stack" to avoid these limitations, but this is rather inefficient in terms of both performance and memory use. Idiomatic 6502 assembly tends to have a mindset of "all variables are global", with only a few bytes for temporary/intermediate values that you have to juggle around carefully and deliberately.
- pjmlp 5y agoUNIX wasn't designed to be portable, it became portable around V5 edition.