Write an assembly program & Machine code that:

Load AL by an arbitrary number, if there is parity even, transfer 80H to the Port 0, and if there is parity odd, transfer 01H to the Port 0.

1 answer

Assembly Program:

```
; Load AL with an arbitrary number
MOV AL, 10101010b

; Check if there is parity even
MOV AH, AL
AND AH, 01h
PUSHF
SHR AH, 1
AND AH, 01h
XOR AL, AH
POPF
JPE even

; If parity odd, transfer 01H to Port 0
MOV AL, 01h
MOV DX, 00h
OUT DX, AL
JMP end

even:
; If parity even, transfer 80H to Port 0
MOV AL, 80h
MOV DX, 00h
OUT DX, AL

end:
HLT
```

Machine Code:

```
B0 AA 9A E4 01 00 50 D2 E0 24 C0 02 C4 80 E0 EB 05 B0 01 B4 00 EE EB F6 B0 80 B4 00 EE F4
```
Similar Questions
  1. 3) Write an assembly program that:Load AL by an arbitrary number, if there is parity even, transfer 80H to the Port 0, and if
    1. answers icon 1 answer
  2. Write an assembly program that :Load AL by an arbitrary number, if there is parity even, transfer 80H to the Port 0, and if
    1. answers icon 3 answers
  3. Write an assembly program that:- Load AL by an arbitrary number, - Check whether it is an odd/even number, - If it is an odd
    1. answers icon 1 answer
  4. 3) Write a 8086 assembly program that:- Load AL by an arbitrary number, - Check whether it is an odd/even number, - If it is an
    1. answers icon 1 answer
more similar questions