My architecture course is really geared toward teaching them how computers are designed and organized. As part of the course, they will have to engineer their own instruction set and then implement that design using gate-level logic. In the past, I've always had them play with a couple of different machine languages in simulation, but this year they will have a physical machine to play with. Actually, I'm planning on having them do three physical machines. They will be getting hands on experience with the Intel 8080 on my Altair Clone, Z80 on their TI-83+/84+ calculators, MOS 6502 on an Apple 1 simulator, ARM via qemu, and then a little x86 at the end as a lead-in to my operating systems course.
I'll have them write basically the same suite of programs on all of these machines, though usually with a little bit of modification to pick up the flavor of the hardware they are using. For the 8080, z80, and 6502 they will write out assembly by hand and then work out the machine language. For ARM and x86, they will be using the gnu assembler. I've always done this in the past, but now I have a chance for them to really work with octal and binary via the switches on my clone!
If you would like to try them yourself, my suite of programs, as adapted for the Altair, are as follows:
- Count from 0 to 255 in binary over and over again. Display the numbers on the high order address bus lights. (Timing for visibility of course!)
- Fill all of the RAM following your program code with the number 42. BONUS: FIll all of RAM, including your program space, with 42.
- Write a program which sorts an array of bytes using any sorting algorithm of your choice.
- Create a four function calculator using the sense switches and the high order address bus lights. The two most significant bits of the sense switch words are the operator (00 - Add, 01 - Subtract, 10 - Multiply, 11 - Divide). The next three bits are the left operand, and the final three are the right operand.
That last one will be fun for them. I'm not going to draw attention to the fact that the 8080 has no multiply instruction. (I've done the same with z80 programming in the past, it's always a startling moment for them!) I'm also going to give them the chance to write a more elaborate program on the altair as an option for their final project. Of course, I will keep the machine set up in my office so they can play with it any time they wish!