Chapter 4 (Section 3) #3 Flashcards

(28 cards)

1
Q

Section 1: Key Terms & Definitions

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a “Shift” in binary terms?

A

Moving the bits stored in a register a given number of places within the register.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Define “Monitoring” versus “Control.”

A

Monitoring is to automatically take readings from a device.
Control is to take readings and then use that data to adjust the device. Uses feedback.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a “Mask” in bit manipulation?

A

A number used with logical operators (AND, OR, XOR) to identify, remove, or set a single bit or a group of bits in an address or register.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Section 2: Types of Binary Shifts

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What happens in a “Logical Shift”?

A

Bits shifted out of the register are replaced with zeros.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the defining characteristic of an Arithmetic Shift?
Detail what happens for left and right Arithmetic Shifts.

A

The sign of the number is preserved.
For left shifts:
1. The leftmost bit is shifted out, and a 0 is introduced on the rightmost end.
2. This multiplies the binary number by 2 (for each shift) or overflow occurs.

For right shifts:
1. The rightmost bit is shifted out and the leftmost bit is preserved to maintain the sign of the number. This means that the leftmost bit is duplicated.
2. This divides the binary number by 2 (for each shift), keeping the sign intact, underflow may occur.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How does a “Cyclic Shift” differ from other shifts?

A

No bits are lost; bits shifted out of one end are introduced at the opposite end of the register.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Section 3: Mathematical Effects of Shifts

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the mathematical effect of a Left Shift?

A

It effectively multiplies the binary number by 2 for each place shifted (unless overflow occurs).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the mathematical effect of a Right Shift?

A

It effectively divides the binary number by 2 for each place shifted (underflow may occur).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Section 4: Assembly Language Shift Instructions

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the instruction “LSL n” do?

A

It shifts the bits in the Accumulator (ACC) logically n places to the left, introducing zeros at the right.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the instruction “LSR n” do?

A

It shifts the bits in the Accumulator (ACC) logically n places to the right, introducing zeros at the left.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which register is always used when performing shift instructions?

A

The Accumulator (ACC).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Section 5: Logical Operations for Bit Manipulation

17
Q

How is the “AND” operator used as a mask?

A

It is used to identify or “keep” specific bits while clearing (setting to 0) all others.

18
Q

How is the “OR” operator used as a mask?

A

It is used to “set” specific bits to 1 while keeping all other bits as they are.

19
Q

How is the “XOR” operator used as a mask?

A

It is used to “toggle” (invert) a specific bit while keeping others the same.

20
Q

Section 6: Assembly Opcodes for Logical Operations

21
Q

What are the two types of operands allowed for the AND, OR, and XOR opcodes?

A

A denary/binary number (n) or a memory address (<address>).

22
Q

Where are the results of logical bit manipulation instructions always stored?

A

In the Accumulator (ACC).

23
Q

What can the “<address>” represent in these instructions?

A

It can be an absolute address or a symbolic address (label).

24
Q

Section 7: Practical Monitoring & Control Examples

25
Why are individual bits used in monitoring and control applications?
Each bit can act as a "flag" to show if data from a specific sensor has been processed.
26
If you want to isolate only the 5th bit of a register, which operator and mask should you use?
Use the AND operator with a mask that has a 1 only in the 5th bit position (e.g., #B00001000).
27
To set the 4th bit of a register to 1 without changing others, what is the instruction?
Use the OR instruction with a mask containing a 1 at the 4th bit position.
28
After a sensor's data is processed, how do you clear its bit flag?
Use the XOR instruction with the bit mask (e.g., XOR #B100) to toggle the bit back to 0.