6 ms·
As a teenager I took an intro CS class at a community college, and the instructor had us design a simple cpu instruction set, and write our own VM and assembler
by _yb2s 2y ago
As a teenager I took an intro CS class at a community college, and the instructor had us design a simple cpu instruction set, and write our own VM and assembler that worked and let me write and run assembly programs. It was shockingly easy, and it was amazing how much is demystified computers for me.
I feel like one could learn every level of computing this way- from designing a real cpu for a FPGA, to writing a simple OS and programs that run on it. This stuff is all shockingly simple if you just want it to work and don’t need all of the extra performance and security modern computing needs.
- tralarpa 2y agoThat's what the nand2tetris course does, I think (I only looked at the first lessons)
- spit2wind 2y agoThat sounds like a fun class! It sounds very similar to https://www.nand2tetris.org/ https://www.nand2tetris.org/ or Charles Petzold's book "Code".
- NooneAtAll3 2y agoor https://nandgame.com/ https://nandgame.com/
- dimava 2y agoOr Turing Complete [0] the game [0] https://store.steampowered.com/app/1444480/Turing_Complete/ https://store.steampowered.com/app/1444480/Turing_Complete/
- markus_zhang 2y agoI think once you move from early fantasy CPUs to early CPUs in production such as 80286, the complexity immediately moves up drastically. IIRC it involves at least memory segmentation, protected mode (MMU).
- remexre 2y agothe 80286 has its own problems/inessential complexity if you look at this from the riscv angle, moving from "u-mode only vm that doesn't use paging under the hood" to "u+s-mode vm with sv39" isn't an enormous jump in complexity imo i think i might teach it starting as like, "sv21" (page tables aren't nested), then pose real sv39 and the tree structure as the solution to making a sparse mapping over 512GiB then moving on to the idea of having a TLB is simple, especially if students have already been introduced to hashtables
- PaulHoule 2y agoSometimes I dream of a 24-bit generation of computers (in terms of address space and the space of index math) of which https://en.wikipedia.org/wiki/Zilog_eZ80 https://en.wikipedia.org/wiki/Zilog_eZ80 may be the best realization. You can almost run a real operating system on that chip in the sense of a 24 bit supervisor that could run multiple 16 bit processes (if you could get CP/M to run you have one heck of a userspace) Unfortunately you can't trap the instruction that switches back to 24 bit mode. Would be nice too if a 24 bit supervisor could contain a 24 bit application, that requires some kind of memory management and I'd imagine something a little lighter weight than the usual paging system, say something that maps (0..N) in logical space to (i+0..i+N) in physical address space. I like the "access register" concept https://en.wikipedia.org/wiki/Access_register https://en.wikipedia.org/wiki/Access_register but would probably have a small number of memory banks such as 16 or 64. In a load-store architecture it doesn't seem like much of a burden to add a bank id to stores and loads. In return you get not just more RAM but also separation of code and data, video memory, file mmap(ing) and such. What bugs me is how to control the mapping of memory banks to physical memory, on one hand you want the supervisor in charge so it can be used for memory protection, on the other hand some programming techniques would want the speed of changing the memory banks from user space. The 80286 was a turkey because it didn't meet the minimal viable product level of being a target for a 24-bit OS that could virtualize DOS applications. It was already crazy fast and became affordable pretty quickly but it seemed tragic that it couldn't do that.
- kazinator 2y ago
- whartung 2y agoOur CS 101 class had such a system. Simple computer/assembler written in BASIC on the PDP. One of the assignments was to do a simple multiply (i.e. add in a loop). Rather than do that, my friend simply altered the program and created a new MUL command. The teacher was not amused.
- JoeAltmaier 2y agoTeachers don't want extra work. My first 360 assembler class our first assignment: add two numbers, fault, print the crashdump and circle the answer to the ADD in the printout. I wrote an RPN calculator, had it do a series of calculations and print the result. Turned that in. The teacher wrote on it "You have 24 hours to turn in the required assignment"
- MortyWaves 2y ago“Don’t let education get in the way of your learning” seems appropriate here. Never underestimate how few fucks teachers give about anything beyond their small bubble.
- fuzztester 2y agoI never let schooling get in the way of my education. - Mark Twain.
- kubb 2y agoSounds like you needed to learn to follow basic instructions.
- JoeAltmaier 2y agoSaid like a true teacher.
- aleph_minus_one 2y ago> My first 360 assembler class our first assignment: add two numbers, fault, print the crashdump and circle the answer to the ADD in the printout. > I wrote an RPN calculator, had it do a series of calculations and print the result. Turned that in. The teacher wanted you to learn: 1. how to write a (very simple) assembly program for 360 to add to numbers 2. how to create a fault 3. how to print a crashdump 4. how to read a crashdump By using a RPN calculator, you learned none of these objectives.
- chii 2y ago> This stuff is all shockingly simple it is, but the thing is that these simple building blocks end up quite far away from an actual production level outcome that someone looking at a computer might see or interact with. It's hundreds of levels deep. Someone with curiosity and eager to learn will be able to easily learn these foundational layers. Someone looking to "get rich quick" and be ready and employable ASAP won't.