Overview I
During our last two weeks of Intel 8080 assembly language programming, you will be finishing your four function calculator projects.
Overview II
Chris here - Jeff is out, so I'm taking over this week. In other words:
I'm the captain now
Jeff has tasked us with getting the postfix calculator working by the end of the week, so that's our goal.
Thursday, November 12th
Classwork
3 Cheers to Mason, who did the work to stitch everyone's code together into a single working program, here.
Here's a direct link to the simulator with Mason's code loaded
We started class with Mason talking us through the code. It works pretty well, with a few caveats:
- As we discussed last class, we're focusing on positive integers
- Output to the cli doesn't work yet - when the input ends, we can find the answer (in hex) at memory address 0x04FD which is the bottom of the stack.
We had a good discussion about this code. We agreed that we understand the high-level structure but will need to spend individual study time to really grok it. We spent the rest of the class discussing in small groups.
We'll wait on Jeff to set plans for next week. But Chris suggested that Jeff might want to give us a quiz about Mason's code. We're intimidated by that possibility, but we'll do the best to make sure we're prepared.
Monday, November 9th
Classwork
First, our friend Wixette reached out to me to share some cool updates to the Altair simulator. I'd like to share some feedback, so we'll spend a few minutes playing with:
- 3d mode on the Altair simulator
- This new simulator of the Leibniz Calculator
- This new simulator of the Jacquard Loom
After that, we worked together to come up with a strategy for the `main` loop of our postfix calculator. We did this together as a class, in Python. Delanie was the driver and scribe, so this code is in Delanie's computer. We had some internet issues, so hopefully Delanie will commit to our shared repo soon! I think at the end of this, we all had a better understanding of how this worked.
Finally, everyone worked on getting their add/subtract/multiply/divide functions merged into the shared repo.
Homework / Evaluation
Keep on keepin' on!
Thursday, October 29th
During class, we setup a shared repo at https://codeberg.org/GHC_Students/stackpancake. We added branch protection to main, and agreed that we'll use PRs to submit code.
We also discussed how all of the functions we're working on will interface with each other. Here's what we decided so far:
- Each function will expect that when it's called, its operands are already loaded into the register pairs BC/DE
- After each function ends, it'll put its result in the HL register pair
- Each function will preserve everything in memory, with the exception of Mult, which needs to be able to store a counter at address 0x00FF
-
This means that main will be responsible for:
- input/output
- parsing the math expression into a stack and maintaining the stack
- making sure that BC/DE are all set before calling a function, and grabbing results from HL
- making sure that none of this interferes with the instructions in memory that start at 0x0000, or with the single-byte counter at 0x00FF
Tuesday, October 27th: A High Level View of Our Task
We'll do a check-in today on how progress is going with out calculator project, and I thought in preparation for that some high level discussion of the algorithms we will need for the task will be helpful.
Reverse Polish Notation
Reverse Polish notation also called postfix notation is a mathematical notation that places operators after their operands. It was used by several HP calculators in the late 1960s and 1970s, starting with the HP 9100A.
Since postfix notation removes the ambiguity associated with infix notation, it eliminates the need to use parathensis for grouping. Here are some examples to illustrate this:
Infix: (3 + 5) * (7 - 2) Postfix: 3 5 + 7 2 - * Infix: 1 + 2 * 3 Postfix: 1 2 3 * + Infix: (1 + 2) * 3 Postfix: 1 2 + 3 * Infix: (3 - 1) * (2 + 4) / 5 Postfix: 3 1 - 2 4 + * 5 /
A List of Subroutines
To help make this problem more tractable, we should create a collection of subroutines, a list of which might include:
-
ADDY(67 crew) -
SUBY(67 crew) -
MULT(Dimitri and Stephan) -
DIV(Waleed and Mason) -
INT(To convert a sequence of digits into an integer - Waleed and Mason) -
ISDIG -
ISOP -
PARSE(To process the input string) -
EVAL(To coordinate calling the appropriate subroutines)
We'll talk a bit about this in class today before letting you get back to work on the project.