Conditional Processing Flashcards

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
Q

JECXZ

A

jump to a label if the ECX=0

26
Q

Prior to 386, jump must be within _________ from current counter location.

A

-128 to +127 byte

27
Q

In x86 processors, __________ permits jum[ anywhere in the memory.

A

32-bit offset

28
Q

Jump is based on specific flags, equality, signed and unsigned operands

A

Yes, thats correct!

29
Q

JE

A

jump if equal

30
Q

JCXZ

A

jump if CX=0, where CX is the loop counter for 16-bit, ECX for 32-bit & RCX is the 64-bit

31
Q

JA

A

jump if above, leftop>rightop

32
Q

JNBE

A

jump if not below or equal

33
Q

JAE

A

jump if above or equal , leftop >= rightop

34
Q

JNB

A

same as JAE

35
Q

JB

A

jump if below, leftop<rightop

36
Q

JNAE

A

same as JB

37
Q

JBE

A

jump if below or equal

38
Q

JNA

A

same as JBE

39
Q

JG, JNLE

A

jump if greater, leftop>rightop

40
Q

JGE, JNL

A

Jump if greater than or equal

41
Q

JL, JNGE

A

jump if less than

42
Q

JLE, JNG

A

jump if less than or equal to

43
Q

Application: Jump to a label if the signed EAX is greater than EBX
HOw would you write the code snippet for this?

A

cmp eax, ebx
jg Greater

44
Q

What is the code snippet for the jump to the label L1 if the memory word pointed by the ESI equals zero?

A

cmp WORD PTR [esi], 0
je L1

45
Q

Jump to the label L1 if the bits 0,1, &3 are set all in AL:

A

and AL, 00001011b
cmp al, 00001011b
je L1

46
Q

Encrypting a string code snippet

A

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
Q

BT Instrcution

A

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
Q

LOOPZ and LOOPE

A

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
Q

LOOPNE and LOOPNZ

A

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
Q

Conditional Structures

A

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
Q

call NEAR PTR [ebx+1]

A

call the procedure for the procedure pointers requirement.