Q. What is the task of the following program? Specify the contents of flags, registers used
and output port 30H after the execution of the following instructions.
1200: MVI A, 55H
1202: ANI 80H
1204: JNZ 120DH
1207: OUT 30H
120A: JMP 1212H
120D: MVI A, 01H
120F: OUT 30H
1212: HLT
The task of the program is to check whether the number in the accumulator is positive or
negative. The D7 bit of the number determines the sign. In this case the number 55H has D7 bit
‘0’, i.e. the number is positive so the result at the o/p device 30H is zero (00H), denoting positive.
If there is any other number with D7 bit ‘1’, the result at the o/p device 30h will be one (01H)
denoting negative.
Content of flags:
Contents of register A: 00H
Content of o/p port 30H: 00H
and output port 30H after the execution of the following instructions.
1200: MVI A, 55H
1202: ANI 80H
1204: JNZ 120DH
1207: OUT 30H
120A: JMP 1212H
120D: MVI A, 01H
120F: OUT 30H
1212: HLT
The task of the program is to check whether the number in the accumulator is positive or
negative. The D7 bit of the number determines the sign. In this case the number 55H has D7 bit
‘0’, i.e. the number is positive so the result at the o/p device 30H is zero (00H), denoting positive.
If there is any other number with D7 bit ‘1’, the result at the o/p device 30h will be one (01H)
denoting negative.
Content of flags:
Contents of register A: 00H
Content of o/p port 30H: 00H
Comments
Post a Comment