scout wrote
Thank you so much for your reply Mark (should I address you by Professor Mark?).
You see this is amazing, it's a whole new world to me. My academic pursuits are not computer science, this is just a curiosity/hobby/complement to my academic degree, so I want to make sure I understand every bit (no pun intended).
If I may let me ask you a couple more questions about my hypothetical 2ISC. You mention it could be implement with just a subtract and a JLE (I suppose it means Jump if Less or Equal than).
Could it also be implemented with an add and a JGE (let's just agree that it means Jump if Greater or Equal than)?
Should we prefer your proposal to avoid overflow problems, or my proposal is not viable at all?
"Mark" will do, I'm an engineer/programmer.
Warning, it sounds like you've been bitten by the computer hobby. I took up electronics as a hobby when I was 11 and it never let go of me... (late 1960's -- vacuum tube radios, slide rules, etc. Discovered computer programming a couple years later and it was all down hill from there! 8^)
In chapter 1 you learned that Nand can be used as a fundamental primitive to build all logic. Implied, but not stated is that you also need one constant, either true or false. (Once you derive Not, use false = Not(true) or true = Not(false) to get the other.) This system works because Nand includes Not in its operation.
For the One or Two-instruction computer, the arithmetic operation needs to include negation, and subtract is a useful way to do that. You can make addition from subtraction:
a +
b =
a - (0 -
b)
but you can't make subtraction from addition.
The OISC also needs a constant, either 1 or -1. One way to supply this constant is to hard wire a RAM address to always be that constant. An example would be have RAM[0] always be 0 and RAM[1] always be 1. (Hard wiring RAM[0]=0 saves every program from starting with SUB 0, 0.)
The compare operation needs to include either less than or greater than, including equals in the comparison is optional. All 4 of these compares are logically equivalent:
a < 0 = Not(
a >= 0)
a > 0 = -
a < 0
Could this 2ISC computer actually run a full fledged operating system (like Linux or Windows), given that a team of highly skilled individuals with a lot of time and funds was working on it?
The Hack computer designed in this course is almost powerful enough to run a simple operating system. (More like MSDOS than Linux or Windows). All it needs is larger RAM and ROM, some sort of data storage peripheral (disk), and a way for programs to get other programs loaded from the disk into ROM.
The VM translator (chapter 7) converts a virtual stack language to Hack assembler. One could just as easily write a translator that output code for the 2ISC, and then Jack programs could be run on the 2ISC.
--Mark