4 ms·
Good job! As promised, the code is easy to read. Your major choices all make sense to me: * you went easy on #define's, they obfuscate the code when used heavi
by anatoly 13y ago
Good job! As promised, the code is easy to read. Your major choices all make sense to me:
* you went easy on #define's, they obfuscate the code when used heavily
* you have a simple switch instead of an opcode table with function pointers or something like that (may seem more fun to write, harder to read for someone inexperienced)
* light on comments, which is also excellent, the code is self-documenting almost everywhere.
* the unusual includes for opcode categories are OK. If you wanted it to be more straight-laced C, could put them in separate .c files and break the switch into many switches, one per file. It's probably better the way it is.
One thing it'd be nice to add is a short guide, right there in README, in which order to read the source (e.g. start from cpu.h/cc to understand how the state of the CPU and memory is represented, then cpu.h/cc for the main loop executed once per instruction, etc.).
- haldean 13y agoThanks so much! That's a great idea; I'll write that up.