Conditional Processing Flashcards

(51 cards)

1
Q

AND operation betweent he pair of the matching bits in the two operands:

A

AND destination, source

NOTE: 1-T and 0-F

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

OR operation between the pair of matching bits in two operands:

A

OR destination, source

NOTE: 1-T and 0-F

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

XOR operation between the pair of matching bits in two operands:

A

XOR destination, source

NOTE: 0 & 0 = 0; 1 & 1 = 0

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

NOT operation on a single destination operand:

A

NOT destination

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

Bit- Mapped Sets

A

Binary bits indicate set membership; Efficient use of storage; Also known as bit vectors. It is like creating a bijection from the indices to the elements, where there is no necessity to convert to/from bit representation of the set from the universal set.

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

Is the bit mapped set in the assembly language use the bitwise operations to manipulate the individual bits within a binary word or a memory location?

A

Yes, it is true. This help sus in the storage management as in computer graphics, where each bits corresponds to each pixel, the bit is used to store the state of the pixel rather than byte. There are fast operations such as AND, OR and other which are used to cmbine the images if needed.
Bit vecotr here generally refers to the use of the fixed size array of bits to represent a collection of elements.

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

ASCII character ‘a’

A

97

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

ASCII character ‘A’

A

65

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

Which bit is cleared out to convert the lowercase a into uppercase A, in the AL register:

A

bit 5

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

0-9 (ASCII):

A

48-57

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

How can you turn the caps lock on using the operation OR?

A

Set the bit 6;

mov ax, 40h; loads the segment address of the the BIOS data area into ax
mov ds, ax; Set the ds to BDA segment
mov bx, 17h; Load the offset of the keyboard flag into the bx
or BYTE PTR [bx], 01000000; Turn on the caps lock key

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

Jump to a label if the integer is even?

A

mov ax, wordVal
add ax, 1
jz EvenVals

If the Zero flag is set, jump to the label.

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

LSB

A

the right most bit

not set LSB == zero flag set => jump to the even value, and vice-versa

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

If the integer is negative

A

cmp ax, 0
jl Negative Val

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

Jump to a label if the value in AL is not zero:

A

or al, al
jnz IsNotZero

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

Does Oring a number with itself chnages its value?

A

No

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

Test Instruction perform a bitwise AND operation between two operands (hence, non destructive), but____________

A

it does not stores the result. It just update the flag register based on the result.

NOTE: test al, 00000001b
jnz ValueNotFound

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

CMP instruction:

A

comapres the destination operand to the source operand. Non destructive subtraction of the spurce from the destination. It does not chnage th evalue in the destination.

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

Is the sign flag equal to the overflow flag in the given instructions below?

mov al, -1
cmp al, 5

A

No

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

Jcond Instruction:

A

A Jcond branches to a label when the specific flag or registers conditions are met.

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

JB, JC

A

Jump to a label, When the carry flag is set

22
Q

JE, JZ

A

jump to the label when the zero flag is set

23
Q

JNE, JNZ

A

jump to the label when the zero flag is clear

24
Q

JS

A

jump to the label when the sign flag is set

25
JECXZ
jump to a label if the ECX=0
26
Prior to 386, jump must be within _________ from current counter location.
-128 to +127 byte
27
In x86 processors, __________ permits jum[ anywhere in the memory.
32-bit offset
28
Jump is based on specific flags, equality, signed and unsigned operands
Yes, thats correct!
29
JE
jump if equal
30
JCXZ
jump if CX=0, where CX is the loop counter for 16-bit, ECX for 32-bit & RCX is the 64-bit
31
JA
jump if above, leftop>rightop
32
JNBE
jump if not below or equal
33
JAE
jump if above or equal , leftop >= rightop
34
JNB
same as JAE
35
JB
jump if below, leftop
36
JNAE
same as JB
37
JBE
jump if below or equal
38
JNA
same as JBE
39
JG, JNLE
jump if greater, leftop>rightop
40
JGE, JNL
Jump if greater than or equal
41
JL, JNGE
jump if less than
42
JLE, JNG
jump if less than or equal to
43
Application: Jump to a label if the signed EAX is greater than EBX HOw would you write the code snippet for this?
cmp eax, ebx jg Greater
44
What is the code snippet for the jump to the label L1 if the memory word pointed by the ESI equals zero?
cmp WORD PTR [esi], 0 je L1
45
Jump to the label L1 if the bits 0,1, &3 are set all in AL:
and AL, 00001011b cmp al, 00001011b je L1
46
Encrypting a string code snippet
KEY =239 BUFFMAX=128 .data buffer BYTE BUFMAX+1 DUP (0) buffSize DWORD BUFMAX .code mov ecx, buffSize mov esi, 0 L1: xor buffer[esi], KEY inc esi loop L1
47
BT Instrcution
Copies bit n from the operand into the carry flag for the bit test. BT bitBase, n bitBase is r/m 16; r/m32 n is r16; r32; imm8
48
LOOPZ and LOOPE
LOOPZ destination LOOPE destination Logic: ECX<- ECX -1 if ECX >0 and ZF=1, jump to the destination Useful for scanning the first element that does not match the given element in array
49
LOOPNE and LOOPNZ
LOOPNE destination LOOPNZ destination if ECX >0 and ZF=0, jump to destination Useful when scanning the first element that matches the given value
50
Conditional Structures
Block-Structured IF statements; Compund Expression with AND (use short circuit evaluation: without evaluating each and every part); compund Expression with OR (short circuit evaluation); Table driven selection (uses a table lookup to replace the multiway selction structure- create a table for the lookup values and the offsets of labels or procedures and use a loop to search the table)
51
call NEAR PTR [ebx+1]
call the procedure for the procedure pointers requirement.