Lecture 20 Objectives
At the end of today's class you should
KNOW:
- how the ADT stack is defined (review from CS 2303)
- how the stack is implemented on the LC-3
- how to check for stack overflow and underflow
- how an integer is input to a program from the keyboard (ASCII-to-binary)
- how an integer is output from a program to the display (binary-to-ASCII)
BE ABLE TO:
- write an LC-3 assembly language program that uses the stack for
temporary storage
- explain how a stack can be used to implement a binary-to-ASCII routine
Sample Exam Question:
Write an LC-3 assembly language subroutine that reads in a sequence of
characters one at a time until a newline is read in (use TRAP x20), and then
displays the characters in reverse
order. Use a stack to store the characters as they come in. You may
assume that pop, push, and adequate stack space are defined.