• Tidak ada hasil yang ditemukan

- Write a single logical (AND, OR, NOT, XOR) instruction to do each of the following: Key Key

N/A
N/A
Protected

Academic year: 2024

Membagikan "- Write a single logical (AND, OR, NOT, XOR) instruction to do each of the following: Key Key"

Copied!
2
0
0

Teks penuh

(1)

عيمجتلا ةغلب ةجمربلاو تابساحلا ميظنت -٣

١٤٠١٢١٤ 2nd S em ester 1 43 0/143 1 Q u iz 5 M onda y 24M a y 20 10 ـھ١٤٣١يناثلاىدامج١٠ 1

Name:

Key

ID:

Key

Name: ID:

Fill the table below with the Hexadecimal values of AX and carry Flag (CF) after execution:

Instruction

Before execution After Execution

AX CF AX CF

ROL AX, 1 45A3 0 8B46 0

RCL AX, 1 4BA3 0 9746 0

ROR AX, 1 45CC 0 22E6 0

MOV CL,3 ROR AX, CL

45A3 1

68B4 0

RCR AX, 1 1A3F 0 0D1F 1

- Write a single logical (AND, OR, NOT, XOR) instruction to do each of the following:

1) Complement the middle four bits of AL.

XOR AL, 3C h or XOR AL, 0011 1100 b

2) Clear (make zero) the most significant bit and least significant bit of AL.

AND AL, 7E h or AND AL, 0111 1110 b

3) Convert capital letters in AL to small letters, recall that the ASCII code of ‘A’=41h and ‘a’ = 61h.

OR AL, 0010 0000 b ; OR AL, 20h ; XOR AL, 0010 0000 b ; XOR AL, 20h OR AL, 0110 0000 b ; OR AL, 60h (because the two MSB should be 01) 4) Assume AL is an unsigned even number, increment the number by one.

OR AL, 01 or XOR AL, 01

(2)

عيمجتلا ةغلب ةجمربلاو تابساحلا ميظنت -٣

١٤٠١٢١٤ 2nd S em ester 1 43 0/143 1 Q u iz 5 M onda y 24M a y 20 10 ـھ١٤٣١يناثلاىدامج١٠ 2

- Write a single shift (SHL, SHR, SAR, SAR) instruction to do each of the following:

1) Assume BL is a negative even number, give half its value.

SAR BL, 1

2) Double the value in BX.

SHL BX, 1 or SAL AL, 1

3) Divide BL by 8, assuming it is a positive number of two hexadecimal digits and least significant digit is 0h.

SAR BL, 3

4) Check if AX contains an even number through carry flag, if AX is even number make carry flag = 0.

SHR AX, 1

Suppose that AX = 1234h, BX = 5678h, CX = 9ABCh and SP = 0100h. Give the Hexadecimal contents of AX, BX, CX, SP and TOS (the word on top of the stack) after executing each of the following instructions:

PUSH AX

AX BX CX SP TOS content

1234h 5678h 9ABCh 0100h-2h=00FEh 1234h

PUSH BX

AX BX CX SP TOS content

1234h 5678h 9ABCh 00FEh-2h=00FCh 5678h

POP AX

AX BX CX SP TOS content

5678h 5678h 9ABCh 00FCh+2h=00FEh 1234h

PUSH CX

AX BX CX SP TOS content

5678h 5678h 9ABCh 00FEh-2h=00FCh 9ABCh

POP BX

AX BX CX SP TOS content

5678h 9ABCh 9ABCh 00FCh+2h=00FEh 1234h

POP CX

AX BX CX SP TOS content

5678h 9ABCh 1234h 00FEh+2h=0100h ????? (unknown)

Referensi

Dokumen terkait