I think Computer Architecture can be designed around legacy but fun hardwares.
So instead of using some fantasy machines such as LC-3, students can directly get into the world of 6502.
First semester: mostly concentrated on 6502 with a full 6502 CPU emulator as the final project.
Second semester: concentrate on a real machine such as the NES. Students need to learn to improve their emulators to program in it (so, do you need a debugger? a decompiler?), as well as hacking roms, burning roms, using carts to load the games into a real NES, and programming new games for it. The game must run in the emulator as well as a real NES.
Third semester for honour: upgrade to a 16/24/32-bit machine, e.g. 80286, SNES, 68K, whatever, and get some serious project done. Can use C if applicable. The project can even be a simple OS or a BASIC interpreter to pave the way for advanced classes. Or maybe a computer virus, anything that is fun and creative.
OS and compiler classes can also be designed around real hardware and projects. e.g. Porting an early version of Linux to a once popular architecture and add a few small functionalities; Write a compiler for a LISP-like language for that architecture and OS.
You don't even need Data Structure and Algorithm and those BS Java programming classes - they learn them on the way. And if they miss anything they can pick them up on the job.
> First semester: mostly concentrated on 6502 with a full 6502 CPU emulator as the final project.
I like the principle, and the 6502 holds a special place in my heart as my introduction to machine code programming on an Apple ][ in late 1980 after I got bored with BASIC after two days .. self-taught from the ROM listing and 6502 reference in the back of the manual.
But it's absolutely the wrong ISA today.
RISC-V RV32I (or RV32E, with only 16 registers) is the right ISA today, for many reasons. It is every bit as easy to understand as 6502, if not easier. It is certainly much easier to write an emulator for than 6502 -- and I've done both. And it is at least 10x easier to write real useful programs using, especially if you're going to deal with values bigger than 8 bits, or pointers, or recursive/reentrant subroutines.
You can also cheaply buy a large and growing range of RISC-V hardware, starting from the $0.10 CH32V003 (48 MHz, 2k RAM, 16k of flash for your program) or boards with that chip for about $1, up to ESP32-C3 or RP2350 boards for a couple of bucks with a few hundred KB of RAM. Or the full Linux $5 Milk-V Duo with 1 GHz 64 bit CPU, 64 MB RAM, and SD card for the OS/programs, which you can power from the USB port on any PC and also ssh into it from the PC.
The only advantage the 6502 has now is it is one of the few chips you can still buy with exposed and non-multiplexed 16 bit address bus and 8 bit data bus, which allows you to do tricks such as hard-wiring the data bus to a NOP instruction (0xEA), and feed it a slow clock and watch the PC increment the address bus through all the NOPs.
Nice, but you can do that with an emulator too, or for that matter with a debugger talking to your microcontroller chip.
I don't disagree with you. I picked 6502 has the advantage of having so many real legacy products built on top of it.
But again, I agree it's not a great ISA (and only having 3 registers always bug me anyway), so as long as it's a real machine I think it's good. Maybe the one you talked about, or a Z80 machine, would all do the job.
Something with meaningful restrictions such as register count and RAM that you'll hit quickly when hand-coding assembler is a super IMHO useful teaching tool. 16 registers is luxurious!
The 16 registers in RV32EC [1] on the CH32V003 is not a lot using the standard ABI once you take out the zero register, return address, stack pointer, globals pointer, and thread pointer [2] you're left with 11 registers, allocated as 6 function argument / local variable registers (caller cave), 2 callee save registers, and 3 temporary registers.
Empirically you need up to 20% more instructions executed vs the 32 register RV2I, which is also similar to what Intel reports with their new "APX" x86 extension giving 32 GPRs.
The 2k RAM also concentrates the mind more so than a 6502 or Z80 with 64k RAM.
[1] you can ignore the "C" for simplicity if you want
[2] which arguably you're not going to use for that purpose so it's effectively available too, most usefully as a 3rd callee save register.
For a teaching tool, you can get the best of both worlds by simply restricting RISC-V to fewer registers. Something like: "Write this in RISC-V assembly, but only use registers 0..3, and 31 for the return address."
I like your idea, though I'm probably biased because I learned computers and computer programming starting with zero experience, zero knowledge and nothing but a 4K, sub-1 Mhz Radio Shack Color Computer. Unfortunately, in 1980 there were virtually no real instructional materials available on microcomputers. Learning consisted mostly of just trying things, typing in listings from low-budget hobbyist 'zines and comparing notes at user's group meetings.
One great advantage to your approach is that emulators are free and some of them, like MAME, have extremely powerful debugging and exploration tools built right in. Plus there's extensive developer documentation, SDKs and instructional materials available for many of the most popular platforms along with lots of commented code disassemblies. Having an actual course structured around curated sets of these materials would be pretty amazing.
There's a YouTube channel called CocoTown where he's building a Moon Patrol clone for the Color Computer in assembly from scratch. He's making good use of MAME and other modern tools. Can't imagine how less pleasant it would have been creating something like that using just EDTASM back in the day.
That's really a nice project. I had a thought a few years ago that if someone wants to be a game programmer, one idea is to find a hero (e.g. Rebecca Heinemann or John Carmack) and replicate some games they made, aka walk their roads on retro platforms.
I think it's a good idea to go further to work on more difficult retro platforms. I know teachers like LC-3 because it is simple, but I think they underestimate the devoted students.
> I think it's a good idea to go further to work on more difficult retro platforms.
Agreed, although I'm not sure platforms like Genesis, Amiga or NeoGeo would really be much more difficult for a beginner following a framework than NES. However, their increased performance, resolution and colors would be more capable of creating inspiring output.
I love the 6502, but if we're considering teaching architecture using a legacy machine my preferred choice would be the PDP-11. The ISA is quite nice, and the machine has many of the "modern" features one would expect from a computer, like address translation. On top of that, there's loads of good, historic code to be looked at. Hell, bring back the Lions commentary book!
I don't disagree with you. Any real computer would work I think. But maybe teaching a not-so-good but popular ISA has educational values too. After all we don't know why good things are good if we haven't seen the bad ones...hah!
6502 would give them a dose of reality, but I think teaching people by having them program an 8-bit CISC chip is cruel. There's so many asymmetries that get in the way.
(Also, I don't think anyone actually likes NES games except for nostalgia, but this might just be because square waves make my ears hurt.)
This just isn't true. There are plenty of very good NES games that have great game loops and are a blast to play. Some of the good ones have quirks or unintuitive controls but are still quite enjoyable.
Ah, just need some years for me to learn all these stuffs and produce a few courses...maybe 10 years given I have a family and not rich enough to fire my boss?
When I was in college, we took a hybrid approach. We used a real CPU (6809), but instead of using a real computer (since 6809-based computers were not as common as Z80 or 6502-based ones), we used an educational kit designed and built by the professor who taught the course. This kit could be programmed via the serial console using the built-in debugger (or monitor, as they were called back then).
I did an EE degree and the sophmore firmware course used an 8 bit PIC (or a motorola 6800 a few years before). About a third of the semester was entirely in PIC assembly, then C, then advanced stuff in C. I think your idea is pretty viable, and sounds more fun than the comp arch class offered.
The more I think about AI the more often I get back to what little time humans have. Besides a tad useless your course would be a ton of fun but when I looked in my agenda I couldn't find a few years to spend on it.
I think it's going to be more useful once they get pass the first two courses when they go for more advanced courses. I'd argue 6502 or 8086 is still more useful than LC-3 which is frequently used in CompArch classes.
The thing about advanced courses are: all production material more or less went through 30-40 years of evolution so it's impossible to get students to jump into it directly. Few people can hack modern gcc or Linux kernals nowadays. We can only go back some 30 years and work on the machines then to get some ideas.
Yeah it takes a lot of time though, plus it's just a concept, not real courses -- I myself is a very mediocre programmer.
So instead of using some fantasy machines such as LC-3, students can directly get into the world of 6502.
First semester: mostly concentrated on 6502 with a full 6502 CPU emulator as the final project.
Second semester: concentrate on a real machine such as the NES. Students need to learn to improve their emulators to program in it (so, do you need a debugger? a decompiler?), as well as hacking roms, burning roms, using carts to load the games into a real NES, and programming new games for it. The game must run in the emulator as well as a real NES.
Third semester for honour: upgrade to a 16/24/32-bit machine, e.g. 80286, SNES, 68K, whatever, and get some serious project done. Can use C if applicable. The project can even be a simple OS or a BASIC interpreter to pave the way for advanced classes. Or maybe a computer virus, anything that is fun and creative.
OS and compiler classes can also be designed around real hardware and projects. e.g. Porting an early version of Linux to a once popular architecture and add a few small functionalities; Write a compiler for a LISP-like language for that architecture and OS.
You don't even need Data Structure and Algorithm and those BS Java programming classes - they learn them on the way. And if they miss anything they can pick them up on the job.