Assembly Program:
MOV AL, 10100101b ; Load AL by an arbitrary number
MOV BL, AL ; Copy AL to BL
AND BL, 00000001b ; Mask the least significant bit
CMP BL, 0 ; Check if the least significant bit is 0
JE EVEN ; If 0, jump to EVEN
MOV P0, #01H ; If not 0, transfer 01H to Port 0 and exit
JMP DONE
EVEN:
MOV P0, #80H ; Transfer 80H to Port 0 and exit
DONE:
HLT ; End the program
Machine Code:
B0 A5 ; MOV AL, 10100101b
8A C3 ; MOV BL, AL
24 01 ; AND BL, 00000001b
80 F3 00 ; CMP BL, 0
74 03 ; JE EVEN
74 01 ; JMP DONE
D3 1E 00 ; EVEN: MOV P0, #80H
F4 ; DONE: HLT