Read behind: (Re)read Ch. 4, pp. 147-173, skipping Neg and
Deci, Deco. (Re)read Ch 5, p.189-200, Disassemblers p.207-8 (new)
Read ahead: 3.2, pp. 95-104 (how to do negative
numbers)
HW Day 6, Due Friday Day 7
Textbook p. 183. #1 (sizes of things. Hint: p. 148-9
have
the data.)
# 3, #7 and #9b (decode programs from hex, writing out what the
instructions are from pp.153-4. Figure out what it will do.
(This is a repeat from day 4.
Half of 3, 9b , and D were discussed in class. Check the
rest of Day 4's HW and repair anything, hand it in again
repaired.)
Textbook p. 227 #1
(disassemble), #5c,
#6a,b (assemble pseudo-ops),
#9 (hand trace program with AND) Then type it in and run
it; check that your prediction was correct.
A from last time, due on Friday. Pep 8.02's
flags are supposed to be functioning!.
A) Tracing: (Get templates
) a) Trace Program A below,
Memory
trace and Program trace, including flags (on the computer).
Started in class.
b) Note how Ldbyte and
Stbyte affect the registers, the memory locations, and the flags.
Hand in the trace.
c)Underline instructions
where N or Z were "set" (turned to 1) and check that each corresponds
to:
a number with 1 in the leftmost (Most significant) bit; a Zero number.
d) The Add instruction
adds 2 numbers with F's in the leftmost hex digit. If you do the
binary addition, you'll get a carry out of the left side. Does
the
C get set (= 1) at this instruction? Circle the C value for this
instruction.
Now go back and work on Program 1.
Try to finish by Friday. Check the link for some new hints and comments.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Day 5 HW? I didn't collect it, didn't get a sense of what was
difficult. Do I need to go over And and Or? Remaining questions?
For the subtracting 1 program, I want the results in Hex: copy
them from the Accumulator as you step.
I'll expect it Friday unless I get email questions on this
material.
- - - - - - - - - - - - - - - - - - - - - - -
- - - - -
Postpone B, C, D. (C is pretty
accessible now. B and C may be also. )
D) Program W below has a
VonNeumann bug , pp 172-3
(assuming you can get it to assemble!) Trace it and describe the
bug.
Notes:
Von Neumann machine: No intrinsic distinction between data and
program. Programmer has to keep them separate.
Tracing: Get templates
Trace program below, check out new ops and flags.
All flag activity documented Appendix pp. A7-8, Fig A-ll
Byte ops: only 2: LdbyteR, StbyteR Mainly
for
moving characters around. Load
a byte only into the lower byte in the register (the upper byte stays
what
it was), Store the lower byte from the register to the memory byte of
the
operand.
Flags: Note if you load a 00 byte into
a register with non-0 stuff in the upper byte, it won't set the Z
flag.
Design choice.
We got to here, sort of. We didn't go
through flags for specific ops.
Review instructions so far:
--Load from memory to register: LDR,
LDBYTER
--Store to memory from register:
STR, STBYTER
--1-operand instructions: Manipulate data within one
register:
ASLR, ASRR, NOTR
--2-operand instructions: Register OP memory location,
result placed in Register:ADDR, SUBR,
ANDR,
ORR
--input/output: to or from a Memory location only: CHARO
--Flow of control: STOP
All flag activity documented Appendix pp. A7-8, Fig A-ll
--What is -1?, -2? Do they satisfy the mathematical
definition of a negative: 1 +( -1) = 0 2 +( -2 ) =
0. Sec. 3.2 next.
Read ahead: 3.2, pp. 95-104 (how to do negative
numbers)
CHARI gets a single character from the input source.
You
have two choices on the PC: Batch I/O or Interactive Input from
Keyboard.
Batch mode.
You put all your input into the input window before running. The
program reads the first Ascii character from the input
window If you have more than one
CHARI in the program, the next CHARI reads the next character, and so
on.
Run Fig. 5.6, p. 196.
I haven't investigated the interactive input very much yet;
trepidation....
;Program A to investigate Status Registers Z, C,
N, Ldbyt &Stbyt HW Day5
;Sievers
;Sept 4, 2006
;This program uses Ldbyt, .block new
LDa 0x0016, d ;loads zeros into reg. A. Check flags.
LDa 0x0018, d ;loads F0f0 into A
ldbytea 0x0016,d ; loads a 00 byte into a
ldbytea 0x001d,d ;loads a not-0 byte into a (01)
stbytea 0x001a,d ; stores a byte from a to the memory saved for it
Adda 0x0018,d ; adds F0f0 to a
Suba 0x001e,d ; subtracts E0f1 from a
STOP ; STOP must be at the end of the instructions for the cpu to run
.word 0x0000
.word 0xF0F0
.BLOCK 2 ; reserves a block of "empty" space
.word 0x0001
.word 0xe0F1
.END ;END tells assembler we're done.
| To Sievers Home Page |
CS225-Fall06/Daya6.htm
|
|