Homework #5 (3/24/05)
This homework is due on Friday, April 1 (no fooling!) 9am at EGR 105B
© D. Thiebaut 2003

CSC270 HW #5

Problem #1
Returning to the traffic light controller from HW 4, assume now that we want the same behavior of
the traffic light circuit of Problem 1, HW 4 (3 seconds green,
2 seconds yellow, 2 seconds red), but this time the clock signal available has a frequency
of 4 Hz.
Note that you can do this by retaining the circuit from HW 4 and simply adding a new stage to create the
desired clock signal.
Show your new diagram, and highlight the parts in it that are taken directly from your
answer to the first problem.

Problem #2
Write a 6800 assembly language program that converts all the characters
of and ASCII string to uppercase. (You can assume that the string is zero-terminated,
providing you with something to check for your stop condition.)
Assume that the string is stored in a variable located at address 0000,
and is at most 80 chars in length.
Your answer should contain a fully-documented program, with
the instructions and their assembled op-codes in hexadecimal.

Problem #3
Reconstruct the program whose hexadecimal dump is shown below. This program
was located starting at Address 0000 in RAM, and started execution from this
address.
7E 00 0A 00 00 00 00 00
00 00 CE 00 03 C6 05 86
01 97 00 9B 00 08 5A 26
F8 7E FC 00
Your reconstructed program should contain a header explaining the
general behavior of the program, the assembly language
instructions and their equivalent hex opcodes, each with a comment
explaining how each instruction contributes to the general computation.

Problem #4
This is the same question as for Problem #3, but this time with a more challenging
sequence. Assume here as well that the execution starts at 0000.
7E 00 07 03 7E 00 07 86
00 97 06 C6 FC D7 05 CE
03 7E DF 03 20 EE
Your answer should contain a clear explanation of the behavior of the program.
Problem #5: opcode bit-fields
Observe the difference between an LDAA direct and an LDAB direct: one is 96
hex, the other D6 hex. Or 10010110 compared to 11010110. The difference
is just one bit: the second from the left. This means that very likely
the second bit from the left indicates that the register selected is ACCA
if 0, and ACCB if 1.
Look a the op-codes supported by the 6800 and attempt to figure out
how the 6800 decomposes the opcode to understand what it has to
do and how it has to do it.
In particular, answer the following questions:
- What bit or bits define the addressing mode (direct, immediate, etc.)?
- What bit or bits define the operation (add, sub, and, or, etc.)?
- Are there bits that identify the type of the instruction?
In other words, are instructions using the Accumulators (e.g. LDAA)
different
in their bit patterns from the instructions that work on the
index register (e.g. LDX), or from the branch instrutions, or from
other instructions?
- Are there bits that have different meanings depending on
how other bits are set?
For example, does bit j mean something if bit i is 0, and means
something else if bit i is 1?