Lecture #23
- Announce
- Quiz Today
- Start to read Chapter 9 Language Translation
- No labs Thursday and Friday; Start up again Wednesday
Machine Architecture
- Fetch/Execute Cycles
- Get instruction from memory
- Carry out instruction
- Instructions copy and add
- Instructions in and out
- like getInt and setInt
- deals only with integers
- Examples
-
number.as
-
sum.as
- Need to handle IF and WHILE situations
- cmp instruction
- jmp, jnb, jb instructions
- Tracing (often the only way to understand)
- "If" Example
-
largest.as
- Loop Example
-
summer.as
- Factorial Example (Iterative)
-
fact.as
- Writing a Program from Scratch
- Handling Lists or Arrays (Self Modifying Code)
- E.g. sum of squares fo input
- quit on zero
- Fancier Architecture
- Need for more registers
- Dealing with tables (arrays)