## csc205 20110412 Notes

Test Next Week.

Today: Calculator, Homework, and in-class.

Study Notes: Think about the padding for negative numbers.

Remember, you have to know the size of your data elements when traversing an array.

Remember, push down pop-up.

## CSC205 2011 04 05 Notes

In Class Exercise

LDA 15, i

CPA 23, i

BRLE WHATEVER

BRANCH:YES N=1, Z=0, V=0, C=0

LDA 15,i

CPA 14,i

BRNE WHATEVER

Yes. N=0, Z=0, V=0, C=0

LDA 15,I

BREQ WHATEVER

No n=0, z=0, v=?, c=?

LDA 3,i

ANDA 12,i

No. n=0, z=1, v=?, c=?

For Test: PEP/* Page, Page 244, Page 247 Figure 6.33 page 285 and A4.

Remember which flags are affected by LDA, CPA. It’s in the handout.

BRNE Branches when the

For local, use stack addressing.

.equate means constant.

A call pushes the return address onto the run time start.

RETN n specifies the number to take off the stack before returning

0-

## csc205 20110322 Notes

Read 6.1, 6.2

Test2

Chapter 5

5.2 Immediate Addressing

Trap Instructions

Need to study converting ands to ors

Need to study minimizations and karnogh maps.

Subtract binary by doing two’s complement and adding.

Patterns: Two Types.

Instructions

Mnemonics

Data

Pseudo-Ops

Instruction Specifier: First eight bits.

Pseudo-Ops.

.end has to be in every set. .end stops the assembly process.

.block sets aside an undefined block of memory.

Immediate Mode means operand is stored with the instruction.

Decimal in and Decimal Out read character in and translate into a number.

In assembly, 0x precedes hex numbers. Without 0x the default is decimal.

Assembly doesn’t create a null at the end of strings. Programmer has to put it there.

STRO changes the index register.

Assembler

Pass I

Build Symbol Table

Symbol Value

Validate Opcodes

Pass II

Substitutes for symbols.

An assembler has a location counter.

Almost certainly on a test will be an assembly instruction and we’ll be asked to re-write the code as it would look after the first pass.

## csc205 Notes

Test on the 15th after the break.

Mr. Sterling will be checking his email.

Test will cover homework.

March 7 through 13: Spring break.

## csc205 notes

Read 5.1

Homework passed out due next week.

Today: Instruction Format

Direct

Van-Neuman Machine.

8u

## csc205 Notes.

Homework, passed out last week.

Read 4.2, 4.3

Given a truth table, translated into a standard two level network.

Basic technique: mark the 1 rows, and ‘and’ them together, then ‘or’ the results.

Product of sums, and of or. Mark the zeros, or them together, then and the results. Need to use parenthesis.

When the xor gate input is 1, it’s an inverter. When it’s a zero, it’s an enabler.

carry

msb-1

xor – v

msb

carry

from chapter 3. MSB

overflow: add two negs and get a pos, or add two pos and get a negative.

This will be on the test:::

Aibi 00 01 11 10

Cin 0 0 0 1 0

1 0 1 1 1

or of ands.

( c(a+b) ) + ab

=

(See truth table from handouts)

011 101 110 111

_ _ _

cab cab cab cab

When doing a sum of products, negate the zeros

State Table.

Master slave SR flip flop. Master stores when clock is on, slave stores when clock is off. This prevents feedback errors.

A JK flip flop is an SR flip flop with two and gates, arranged to allow a 1-1 input perform a toggle.

D flip flop. D stands for delay (or data). Only one input (that’s one input plus the clock).

T flop flop. T for toggle.

## csc 205 Notes

Test at 4:30.

Homework 1

chapter 10

Logic gates logic functions

A carry flag is an error for signed numbers, but not for signed numbers.

Always fill your answers with the appropriate amount of zeros.

Covered truth tables see pages around 500.

## csc205 Notes

Reading Assignment.

Read 10.1 (skip bool algebra), 10.2,

two to the nth power minus 1 (unsigned storage with n bits).

The carry bit could indicate that the result is too big, or could indicate a borrow.

Given N bits, the two’s compliment of a number x _{ 2 } is 2^{n}-x (the technique is to add one to the not). This is not the way it works in a high level language — we’re talking about the way the computer stores data.

Range of signed integers (with N bits)

-2^{n-1} to 2^{n-1} – 1

1 1 1 1

0 0 0 1

——–

0 0 0 0 with a carry flag of 1 and overflow of 0.

In signed numbers, overflow is a sign change.

0 1 0 1

0 0 1 0

——–

0 1 1 1

0 1 0 1

0 1 0 0

——–

1 0 0 1

cf =0

vf = 1

1 0 1 1

1 1 1 0

——–

1 0 0 1 cf = 1 vf = 0

1 0 1 1 0 1 1 1 (-73)

1 0 0 1 1 0 1 1 (-101)

————————–

1 0 1 0 0 0 1 0

cf 1

vf 1

nf 0

zf 0

The computer does the same thing whether we’re doing signed or unsigned. If we’re doing unsigned, the same flags will be set, but we don’t care about the overflow flag or the negative flag. We would care about the carry flag. If signed, then we care about those flags.

## csc205 Notes 2011 01 11

Classes start at 5PM

Reading Assignment

Chapter 3 to page 112

3.1 unsigned integers, binary storage, integers, base conversion, range, additions carry bix

Notes:

Machines do not store numbers, they store symbols. We can interpret 10110110 as many different things.

Range of unsigned numbers:

2 bits 4 bits

x x x x x x

0 0 = 0 0 0 0 0 = 0

1 1 = 3 1 1 1 1 = 15

range of n bits is to 2^n – 1

numbers in n bits range is 2^n

Truth Table

Carry In x y sum Carry Out

0 0 0 0 0

0 0 1 1 0

0 1 0 1 0

0 1 1 0 0

The above acts like an xor

1 0 0 1 0

1 0 1 0 1

1 1 0 0 1

1 1 1 1 1

The above acts like an or

When you think about addition, think about the sum and the carry.

101001

000100

——— No carries, no error

101101

1 carry

101101

000110 carry in of i + 1 is carry out if i. Assume the carry in of the lsd is zero.

——–

101011

100111

110100

——– Error Condition Carry out of msb

Carry goes to the carry flag.

leave a comment