Answer to Question #159338 in Assembler for Raya

Question #159338

Draw the flag register of 80286 depicting the flags. Demonstrate the use of IOPL and Nested task

Flag.


1
Expert's answer
2021-01-30T09:33:10-0500

The 80286 contain a FLAG register (16 bits):

| -  |  NT  |    IOPL   |  OF  |  DF | IF | TF | SF | ZF |   -  | AF  |  -  |  PF |  -   | CF  |

------------------------------------------------------------------------------------------------------------------------

| 15 | 14 |  13 – 12 |   11 | 10  | 09 | 08 | 07 | 06 | 05 |  04 | 03 | 02 | 01 | 00 |

-------------------------------------------------------------------------------------------------------------------------

CF (carry). Carry holds the carry after addition or the borrow after subtraction.

PF (parity). Parity is a logic 0 for odd parity and a logic 1 for even parity. Parity is a count of ones in a number expressed as even or odd.

AF (auxiliary carry). The auxiliary carry holds the carry (half-carry) after addition or the borrow after subtraction between bits positions 3 and 4 of the result.

ZF (zero). The zero flag shows that the result of an arithmetic or logic opera­tion is zero. If Z=1, the result is zero; if Z= 0, the result is not zero.

SF (sign). The sign flag holds the arithmetic sign of the result after an arithmetic or logic instruction executes. If S=1, the sign bit (leftmost hit of a number) is set or negative; if S=0, the sign bit is cleared or positive.

TF (trap). The trap flag enables trapping through an on-chip debugging feature. (A program is debugged to find an error or bug.) If the T flag is enabled (1), the microprocessor interrupts the flow of the program on conditions as indicated by the debug registers and control registers. lf the T flag is a logic 0, the trapping (debugging) feature is disabled.

IF (interrupt). The interrupt flag controls the operation of the INTR (interrupt request) input pin. If I=1. the INTR pin is enabled: if I= 0, the INTR pin is disabled. The state of the I flag bit is controlled by the STI (set I flag) and CLI (clear I flag) instructions.

DF (direction). The direction flag selects either the increment or decrement mode for the Dl and/or SI registers during string instructions. If D=1, the registers are automatically decremented: if D=1, the registers are automatically incremented. The D flag is set with the STD (set direction) and cleared with the CLD (clear direction) instructions.

0F (overflow). Overflows occurs when signed numbers are added or subtracted. An overflow indicates that the result has exceeded the capacity of the machine. For unsigned operations, the overflow flag is ignored.

 

The additional fields available in 80286 flag registers are:

IOPL - I/O Privilege Field (bits D12 and D13)

NT - Nested Task flag (bit D14)

 

IOPL.  It occupies bits 12 and 13 in the FLAGS register. In protected mode and long mode, it shows the I/O privilege level of the current program or task.

The CPL (Current Privilege Level) (CPL0, CPL1, CPL2, CPL3) of the task or program must be less than or equal to the IOPL in order for the task or program to access I/O ports.

The IOPL can be changed using POPF(D) and IRET(D) only when the current privilege level is Ring 0.

Besides IOPL, the I/O Port Permissions in the TSS also take part in determining the ability of a task to access an I/O port.

 

NT - Nested Task flag (bit D14). Used in protected mode. The nested task flag indicates that the current task is nested within another task in protected mode operation. This line is set when the task is nested by software.

When set, it indicates that one system task has invoked another via a CALL Instruction, rather than a JMP.

Together with the "TSS" field in the task status segment, it ensures correct nesting of tasks

 



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS