CSC 215 Weekly Assignments: Week 3

CSC 215


Overview

As we begin week three, our goal will be to gradually make it easier and easier to program our Altair 8800. Two weeks of flicking switches is enough. This week, we will move to writing our machine language programs in HEX, using this MITS Altair Simulator Program Converter. This switch will also mean we can start putting our programs into our git repos.

Friday, September 18th

Classwork

Today in class we'll start by sharing solutions to the programming project assigned last class.

After that we'll be ready for our next programming project with new partners:

  • Pair A: Giselle and Dimitri
  • Pair B: Mason and Delanie
  • Pair C: Waleed and Nathan
  • Pair D: Chris and Stephan

Project: Copy the Upper Case Letters

Write a program that reads in a starting memory address, s1, pointing to the beginning of a null-terminated string containing only upper and lower case letters, and a copy to address s2. The program will iterate over the letters, copying only those that are upper case to the string beginning at address s2.

Homework

Read Chapter 1: The Intel 8080 Instruction Set and come to class next Wednesday ready to apply your new knowledge of the instruction set to a final machine language programming project.

Wednesday, September 16th

Classwork

After the promised quiz, you will have the rest of class to work on the program we discussed briefly last week. Here it is again for your convenience:

Project: Sum n Bytes

Write a program that reads in a starting memory address, m, and a number of bytes, n, and computes the sum of the n bytes beginning at address m.

The pairs are:

  • Pair B: Dimitri and Delanie
  • Pair C: Mason and Nathan
  • Pair D: Waleed and Stephan
  • Pair A: Giselle and Chris

Chris found a wonderful presentation of the Intel 8080 instruction set that we can use a resource.

Homework / Evaluation

Come to class on Friday ready to show your git repos and discuss either how you solved this programming challenge or where you got stuck on it.

Monday, September 14th

Classwork

We'll start class today with an introduction to the MITS Altair Simulator Program Converter. I spent the better part of the day Saturday adapting it to our Sim-8800: Altair 8800 Simulator.

I'll show you how it works using this example program, count10from.spc:

01    # Load following 2 bytes into regs C and B 
50
00
0A    # Load reg A with contents of mem addr in reg B and C (0x0050)
11    # Load following 2 bytes into regs E and D 
00
0A
3C    # START LOOP HERE: Increment reg A
0C    # Increment reg C
02    # Store reg A in mem addr from regs B and C
15    # Decrement reg D
C2    # LOOP: Jump if not zero back to START LOOP
07
00
76    # HALT
===
50:20 # Start counting at 32 (0x20) 

Then we'll spend 30 minutes having you try it out with the programs you presented last class.

After that Chris and Nathan will present their program to find the index of the largest positive integer in a sequence of ten positive integers.

They will be introducing how both looping and branching are written in machine language using jump instructions.

Pay close attention and ask questions! You will need to understand this and be able to use it to write your own programs soon.

Homework / Evaluation

  1. Study the count10from.spc presented in the beginning of class. It uses the instruction 11H (the LXI instruction) at byte 04H of the program to load 00 0A H into registers E and D respectively. If you understand the logic of the program, only register D is used in the computation. Replace the LXI instruction with an MVI instruction that only sets register D.
  2. The flip side of operating on a register pair when you only need a single register is operating on a single register when it is part of an address pair. That's what we are doing with the 0CH instruction at byte 08H. Instead of incrementing register B, we should be incrementing the BC register pair. See if you can find the instruction to do this and make the change.
Come to class Wednesday ready for a short quiz on this program with these modifications.