Chapter 2 · SimulationRegister Explorer ? ← Chapter 2 General-purpose registers · AX = AH : AL Pointer and index registers Segment registers and instruction pointer Flags register (FLAGS) Program ◀ Back Step ▶ Play Reset Run Speed Try it yourself Correct 0 / 0 Close Register Explorer Goal: See the whole 8086 register set on one screen: the 16-bit and 8-bit use of the general-purpose registers, the pointer, index and segment registers, the instruction pointer (IP) and the bits of the flags register. How to use it Pick a program and run the instructions one by one with Step ▶ (keyboard: → and ←). A changed byte or register gets an orange frame, and changed bits are underlined. Type your own instruction in the box and press Run: the instruction is inserted after the current step and executed. Supported instructions: MOV, XCHG, ADD, SUB, CMP, INC, DEC, NEG, CLC, STC, CMC, CLD, STD, CLI, STI. Operands are registers or immediate values (there are no memory operands). Numbers: 1234h (a hexadecimal number that starts with a letter needs a leading 0: 0FFh), 1010b, 65, -1, 'A'. With Try it yourself on, you are asked for the new value of the destination register (ZF for CMP) before each instruction. Reminder The high and low bytes of AX, BX, CX and DX work as separate registers: AX = AH : AL. Writing AL does not change AH; writing AX changes both. MOV DL, -1 sets only DL to FFh, with no sign extension. SP, BP, SI, DI, the segment registers and IP are used only as 16-bit registers. An immediate value or another segment register cannot be moved into a segment register directly, CS cannot be a destination, and IP cannot be written as an operand in any instruction. The bits used in the flags register: OF (11), DF (10), IF (9), TF (8), SF (7), ZF (6), AF (4), PF (2), CF (0). On the 8086, bits 15–12 and bit 1 always read as 1, and bits 5 and 3 always read as 0 (dashed boxes). MOV and XCHG do not change the flags. INC and DEC do not change CF. For NEG, CF = 1 whenever the operand is not zero. PF looks only at the number of 1 bits in the low byte of the result (1 if the count is even). After each instruction IP grows by the instruction's length in bytes (e.g. MOV AX, 1234h is 3 bytes, MOV AL, 5 is 2 bytes, INC CX is 1 byte). An invalid instruction is not executed and the registers stay unchanged. The initial values (CS = DS = ES = SS = 0700h, IP = 0100h, SP = FFFEh, IF = 1, other flags 0) resemble the start of a .COM program. Related slides: Chapter 2.2 · 8086 Registers (AX = AH : AL, pointer and index registers, segment registers and IP, the flags register, invalid operand combinations).