Combination of characters to specify which flags bits will be checked?.In this example we have used unconditional jump instruction " JMP start" at the beginning to skip executing variable declaration statements as executable instructions.Ĭonditional jump A conditional jump instruction forces processor to start executing instructions from specified address when a condition met. In a conditional jump instruction, two parts are specified: Start: start: is a label/address in a program If you write instruction JMP L1, it will force processor to execute instructions from label L1. The address in JMP instruction can be specified via a label. If CS=0100, for example, processor will start executing instructions from physical memory address 010003. For example if you write JMP 03h, it assigns address 0003 to instruction pointer and processor starts executing instructions from physical address formed via logical pair CS:IP. Unconditional jump An unconditional jump instruction forces processor to start executing instructions from a specific address unconditionally. JUMP instructions Jump instructions can be used to start executing instructions from any address location within memory. Decisions are taken using conditional jump instructions. Those flag bits might have been updated previously by an ALU instruction or a CMP instruction. In a jump instruction, decision is taken based on flag bits. Why? Because there is no use of comparison if you’re not taking a decision after comparison. OF=1 SF=1 (negative result)Ĭompare and Jump instructions A compare instruction (CMP) without jump instruction is meaningless. Subtracting -2 from 127 makes it 129, max positive number in one byte is 127? So overflow occurs. Subtracting 10 from 5 requires borrow, so carry flag will be set, CF=1 SF=1 Source and destination remains unchanged.ĬMP instruction: Effect on flags MOV AX, 5 Subtracts source operand from destination operand and updates flags only.ĬMP AX, BX Performs (AX-BX) and updates flags. Compare instruction-CMP CMP works like sub instruction with the only difference that it doesn’t change operands.