x86-session04.ppt

29
Property of Accel Technol ogies Ltd., Copyright pro tected 1 X86 Session_04 Instructions in X86

Transcript of x86-session04.ppt

  • X86 Session_04Instructions in X86

    Property of Accel Technologies Ltd., Copyright protected

  • 8086 InstructionsData Transfer Instructions

    MOV : copy byte or word from specified source to specified destination PUSH : copy specified word to top of stack POP : copy word from top of stack to specified location PUSHA: copy all registers to stack (80186/80188 only) POP A : copy words from stack to all registers (80186/80188 only) XCHG : Exchange bytes or exchange words XLAT : Translate a byte in AL using a table in memory

    Property of Accel Technologies Ltd., Copyright protectedFor the MOV instruction,the destination can be a register or a memory location.The source can be a register,a memory location or an immediate data. The source and destination both can not be memory locations.

  • Data Transfer InstructionsMOV CX,037AH : put the immediate number in CXMOV BL,[437AH] : copy byte in DS at offset 437AH to BLMOV AX,BX : copy contents of BX to AXMOV DL,[BX] : copy byte from memory at [BX] to DLMOV DS,BX : copy word from BX to DS registerMOV RESULTS[BP],AX : copy AX to two locationsMOV CS:RESULTS[BP],AX : same as the previous instruction ;but the physical address = EA + CS instead of EA + SSNote: No flags are affected

    Property of Accel Technologies Ltd., Copyright protectedMOV RESULTS[BP],AX : copies AX to 2 memory locations;EA of the first location is the sum of the displacement RESULTS and the contents of BP.Physical address is EA + SS

  • Data Transfer InstructionsPUSH BX : decrement SP by 2,copy BX to stackPUSH DS : decrement SP by 2,copy DS to stackPUSH TABLE[BX] : Decrement SP by 2,copy word from memory in DS at EA=TABLE+[BX] to stackPUSHF : Push flag register on the stack Similar instructions are possible with POP instructionsNote : No flags are affected

    Property of Accel Technologies Ltd., Copyright protectedPUSH Source and POP Destination are the common formats.Suppose the SP contains 4002 and the SS contains 1000 then BH would be moved to 14001 and BL to 14000.

    PUSH AL is invalid as it is trying to push a byte rather than a word.

  • Data Transfer InstructionsXCHG AX,DX : Exchange word in AX with word in DXXCHG BL,CH : Exchange byte in BL with byte in CHXCHG AL,PRICES[BX] : Exchange byte in AL with byte in memory at EA = PRICES[BX] in DSXLATB : Adds the byte in AL to the offset of the start of the table in BX,and then copies the byte addressed by [BX+AL] back to AL Note : No flags are affected; Both the source and the destination cannot be memory locations; The segment registers cannot be exchanged;

    Property of Accel Technologies Ltd., Copyright protectedXCHG exchanges the contents of aregister with the contents of another register or the contents of a register with the contents of a memory location.It cannot exchange the contents of two memory locations. The memory location can be specified in any one of the 24 addressing modes. No flags are affected and no segment registers can be used.XLATB is used for code conversion. It can be used to convert any code of 8 bits or less to any other code of 8 bits or less.No flags are altered.For e.g. replacing ASCII with EBCDIC from a table.

  • Data Transfer Instructions IN : copy a byte or word from specified port to accumulator OUT : copy a byte or word from accumulator to specified port LEA : Load effective address of operand into specified register LDS : Load DS register and other specified registers from memory LES : Load ES register and other specified register from memory

    Property of Accel Technologies Ltd., Copyright protectedThese are some more data transfer instructions .

  • Data Transfer Instructions Fixed Port IN AL,0C8H : input a byte from port 0C8h to AL IN AX,34H : input a word from port 34H to AX A_TO_D EQU 4AH IN AX,A_TO_D : input a word from port 4AH to AX Variable Port MOV DX,0FF78H: initialize DX to point to port IN AL,DX : input a byte from 8 bit port 0FF78H to AL IN AX,DX : input a word from 16 bit port 0FF78H to AX

    Property of Accel Technologies Ltd., Copyright protectedIt has two formats: fixed port and variable port type For the fixed port type the 8 bit address of the port is specified directlyFor the variable port type,the port address is loaded into the DX register.The variable port IN instruction has the advantage that the port address can be computed or dynamically determined in the program.The IN instruction does not change the flag.

  • Data Transfer Instructions Fixed Port OUT 3BH,AL : copy the contents of AL to port 3BH OUT 2CH,AX : copy the contents of AX to port 2CH Variable Port MOV DX,0FFF8H: Load desired port address in DX OUT DX, AL: copy contents of AL to port FFF8H OUT DX,AX : copy contents of AX to port FFF8H

    Property of Accel Technologies Ltd., Copyright protectedIt has two formats: fixed port and variable port type For the fixed port type the 8 bit address of the port is specified directlyFor the variable port type,the port address is loaded into the DX registerThe OUT instruction does not affect any flags.

  • Data Transfer Instructions LEA BX,PRICES : Load BX with offset of PRICES in DS LEA BP,SS:STACK_TOP : Load BP with offset of STACK_TOP in SS LEA CX,[BX][DI]: Load CX with EA=[BX] + [DI] LDS BX,[4326]: copy contents of memory at displacement 4326H in DS to BL,contents of 4327H to BH;copy contents at displacement of 4328H and 4329H in DS to DS register

    Property of Accel Technologies Ltd., Copyright protectedSay PRICES is an array of bytes.The instruction LEA BX,PRICES will load the displacement of the first element of PRICES directly into BX.The instruction MOV AL,[BX] can then be used to bring an element from the array into AL.LDS instruction is useful for pointing SI and DS at the start of a string before using one of the string instructions.This instruction also does not affect the flags

  • Data Transfer Instructions LDS SI,SRING_POINTER : Copy contents of memory at displacements STRING_POINTER and STRING_POINTER +1 in DS to SI register. Copy contents of memory at displacements STRING_POINTER +2 and STRING POINTER +3 in DS to DS register. DS:SI now points at start of desired string LES BX,[789AH]: contents of memory at displacements 789AH and 789BH in DS copied to BX. Contents of memory at displacements 789CH and 789DH in DS copied to ES register

    Property of Accel Technologies Ltd., Copyright protectedLES loads the specified register with the word from the first two memory locations and the word from the next two memory locations is copied into the ES register.LES affects no flags.

  • Data Transfer Instructions

    LES DI,[BX] :

    Copy the contents of memory at offset [BX] and offset [BX +1] in DS to DI register.Copy contents of memory at offsets [BX + 2] and [BX + 3] to ES register

    Property of Accel Technologies Ltd., Copyright protectedLES loads the specified register with the word from the first two memory locations and the word from the next two memory locations is copied into the ES register.LES affects no flags.

  • Data Transfer Instructions LAHF : Load AH with the low byte of the flag register SAHF : Store AH register to low byte of flag register PUSHF : Decrement the SP by 2 and copy the word in the flag register to the memory location pointed to by the SP.No flag is affected POPF : Copy a word from two memory locations at the top of the stack to the flag register and increment the SP by 2.ALL flags are affected

    Property of Accel Technologies Ltd., Copyright protectedThe lower byte of the 8086 flag register is the same as the flag byte for the 8085. LAHF followed by PUSH AX has the same effect as PUSH PSW in 8085.LAHF changes no flags.Similarly an 8085 POP PSW instruction will be translated to a POP AX - SAHF sequence to run on an 8086.SAHF changes the flags in the lower byte of the flag register.

  • Arithmetic Instructions ADD : Add specified byte to byte or specified word to word ADC : Add byte +byte+carry flag or word+word + carry flag INC : increment specified byte or specified word (register or memory specified in one of 24 ways ) by 1 AAA : ASCII adjust after addition DAA : Decimal adjust AL after BCD addition

    Property of Accel Technologies Ltd., Copyright protectedNext,we move on to the arithmetic instructions.Some of the arithmetic instructions have been given here.For the ADD and ADDC instructions the flags affected :AF,CF,OF,PF,SF,ZFAAA instruction:E.g: AL=00110101,ASCII 5 BL=00111001,ASCII 9ADD AL,BLAAA will put 04 in AL and a 1 in the carry flag. OF,PF,SF and ZF are undefined

  • Arithmetic Instructions; The source can be an immediate number,a register, or a memory location specified in any one of the 24 ways.The destination can not be a number.The AF,CF,OF,PF,SF and ZF are affected;ADD AL,74HADC CL,BL ADD DX,BXADD DX,[SI]ADC AL,PRICES[BX]ADD PRICES[BX],AL

    Property of Accel Technologies Ltd., Copyright protectedCF indicates the carry out of bit7.PF =0 if the result has odd parity.(It is meaningful only for an 8 bit result)AF = 1 if a carry is generated out of bit 3.ZF =1 if the result in the destination is zero.SF reflects the MSB of the result.OF =1 is used to indicate whether the result of additionof signed numbers is too large to be fit in to 7 bits ADD DX,[SI] : Add word from memory at offset [SI] in DS to contents of DX.

  • Arithmetic InstructionsINC BL : Add 1 to contents of BL register INC CX : Add 1 to contents of CX register INC BYTE PTR[BX] : Increment byte in data segment at offset contained in BX. INC WORD PTR [BX] : Increment the word at offset of [BX] and [BX + 1] in the data segment INC PRICES[BX] : Increment element pointed to by [BX] in array PRICES

    Property of Accel Technologies Ltd., Copyright protectedFor an INC instruction, AF,OF,PF,SF and ZF are affected but the carry flag is not affected.ie, if an 8 bit destination containing FF or a 16 bit destination containing FFFF is incremented the result will be all zeroes with no carry.

  • Arithmetic InstructionsAAA : ASCII Adjust for AdditionE.g: AL = 0011 0101 ,ASCII 5 BL = 0011 1001 , ASCII 9ADD AL,BL : Result : AL = 0110 1110 =6EHAAA : AL = 0000 0100 : CF =1OR AL with 30H to get 34H and the 1 in the carry flag can be rotated into the low nibble of a register ,Ored with 30H to give ASCII 1

    Property of Accel Technologies Ltd., Copyright protectedAAA instruction works only on the AL register.It updates AF and CF but OF,PF,SF and ZF are left undefined.

  • Arithmetic InstructionsDAA : Decimal Adjust AL after BCD AdditionE.g: AL = 0101 1001 = 59 BCD BL = 0011 0101 = 35 BCDADD AL,BL : Result : AL = 1000 1110 =8EHDAA : AL = 1001 0100 = 94 BCD

    It updates AF,CF,PF and ZF.OF is undefined after a DAA instruction.

    Property of Accel Technologies Ltd., Copyright protectedA decimal counter can be implemented using a DAA instruction.

  • Arithmetic Instructions

    SUB : Subtract byte from byte or word from word SBB : Subtract byte and carry flag from byte or word and carry flag from word DEC : Decrement specified byte or specified word by 1 NEG : Get 2s complement of specified byte or word CMP : Compare two specified bytes or words AAS : ASCII adjust after subtraction DAS : Decimal adjust after subtraction

    Property of Accel Technologies Ltd., Copyright protectedAAS leaves the correct unpacked BCD in lower nibble of AL and resets the upper nibble of AL. Updates AF and CF.CMP affects all the flags.CF,SF,ZF are important.DEC does not affect the carry flag

  • Arithmetic Instructions

    SUB CX,BX: CX - BX , result in CX SBB CH,AL : Subtract contents of AL and contents of CF from contents of CH .Result in CH SUB AX,3427H : Subtract immediate number from AX SUB BX,[3427] : Subtract word at displacement 3427H in DS and contents of CF from BX SBB PRICES[BX],04H : Subtract 04 from byte at EA PRICES[BX] if PRICES declared with DB.Subtract 04 from word at EA PRICES[BX] if PRICES declared with DW.

    Property of Accel Technologies Ltd., Copyright protectedAll the arithmetic flags are modified by the SUB instruction.AAS leaves the correct unpacked BCD in lower nibble of AL and resets the upper nibble of AL. Updates AF and CF.CMP affects all the flags.CF,SF,ZF are important.DEC does not affect the carry flag

  • Arithmetic Instructions

    DEC CL : Subtract 1 from contents of CL register DEC BP : Subtract 1 from contents of BP register NEG AL : Replace AL with its 2s complement NEG WORD PTR[BP] : Replace word at offset [BP] in SS with its 2s complement

    Property of Accel Technologies Ltd., Copyright protectedAll the arithmetic flags are modified by the SUB instruction.AAS leaves the correct unpacked BCD in lower nibble of AL and resets the upper nibble of AL. Updates AF and CF.The NEG instruction updates AF,CF,SF,PF,ZF and OF.CMP affects all the flags.CF,SF,ZF are important.DEC does not affect the carry flag

  • Arithmetic Instructions

    CMP AL,01H : Compare immediate number 01H with byte in AL CMP BH,CL : Compare byte in CL with byte in BH CMP CX,TEMP_MIN : Compare word in DS at displacement TEMP_MIN with word in CX CMP PRICES[BX],49H: Compare immediate 49H with byte at offset [BX] in array PRICES

    Property of Accel Technologies Ltd., Copyright protectedAF,OF,SF,ZF,PF and CF are updated by the CMP instruction.CF ZF SF0 1 0 : result of subtraction is 00 0 0 : when CX > BX in CMP CX,BX1 0 1 : CX < BX

  • Arithmetic Instructions

    AAS : ASCII Adjust for subtraction is similar to the AAA ; E.g: 1 AL = 0011 1001 = 39H BL = 0011 0101 = 35HSUB AL,BL : AL = 00000100 ; CF =0AAS : AL = 00000100 ; CF =0

    E.g: 2 AL = 0011 0101 = 35H BL = 0011 1001 = 39H SUB AL,BL : AL = 11111100 = -4 ; CF =1AAS : AL = 00000100 ; CF =1

    Property of Accel Technologies Ltd., Copyright protectedAF,OF,SF,ZF,PF and CF are updated by the CMP instruction.CF ZF SF0 1 0 : result of subtraction is 00 0 0 : when CX > BX in CMP CX,BX1 0 1 : CX < BX

  • Arithmetic InstructionsExamples for DAS instruction 1) AL=1000 0110,BH=0101 0111 SUB AL,BH ; AL= 0010 1111(CF=0) DAS ; subtract 0000 0110 ; will result 29 in AL2) AL=0100 1001 ; BH=0111 0010 SUB AL,BH ; AL= 1101 0111 (CF=1) DAS ; subtract 0110 0000 ; will result 77 in AL

    Property of Accel Technologies Ltd., Copyright protectedThis instruction is used for subtracting two packed BCD numbers to make sure the result is correct packed BCD.It works only for AL register.It subtracts 6 from the lower nibble of the result whenever the lower nibble in AL after a subtraction is greater than 9 or the AF was set by the subtraction.If the result in the upper nibble is now greater than 9 or if the carry flag was set the DAS instruction will subtract 60 from AL A Decimal down counter could be implemented using this instruction

  • Arithmetic Instructions MUL : multiply unsigned byte by byte or unsigned word by word IMUL : multiply signed byte by signed byte in AL or signed word by signed word in AX .In the second case DX holds the high order word AAM : ASCII adjust after multiplication

    Property of Accel Technologies Ltd., Copyright protectedAL=00000101; BH=00001001MUL BH ; result in AXIf a word is multiplied by a word, the most significant word of the result is put in the DX register, and the least significant word is put in the AX register.If the msbyte of a 16 bit result or the MSWord of a 32 bit result is 0, CF and OF will both be 0's.AF,PF,SF and ZF are undefined after a MUL instruction.AAM will result in 0405 (unpacked BCD) in AX;IMUL in 80186 can have an immediate operand

  • Arithmetic InstructionsExamples for IMUL ; AL=01000101=69D ; BL=00001110=14DIMUL BL ; AX =03C6H=966D ; SF=0,CF,OF=1; AL=11100100=-28D; BL=00111011=+59DIMUL BL ; AX=F98CH=-1652D; SF,CF,OF=1

    Property of Accel Technologies Ltd., Copyright protectedIf the magnitude of the product does not require all the bits of the destination,the unused bits will be filled with copies of the sign bit.If the upper byte of a 16 bit result or the upper word of a 32 bit result contains only copies of the sign bit then CF and OF will both be 0.If the upper byte of a 16 bit result or the upper word of a 32 bit result contains part of the product,CF and OF will both be 1.

  • Arithmetic Instructions

    AAM : ASCII Adjust after multiplyAL = 00000101BH = 00001001MUL BH : AL* BH result in AX :AX = 000000000 00101101 =002DHAAM : AX = 0405H

    Property of Accel Technologies Ltd., Copyright protectedIf the magnitude of the product does not require all the bits of the destination,the unused bits will be filled with copies of the sign bit.If the upper byte of a 16 bit result or the upper word of a 32 bit result contains only copies of the sign bit then CF and OF will both be 0.If the upper byte of a 16 bit result or the upper word of a 32 bit result contains part of the product,CF and OF will both be 1.

  • Arithmetic Instructions DIV : Divide unsigned word by byte or unsigned double word by word IDIV : Divide signed word by byte or signed double word by word AAD : ASCII adjust before division; converts two unpacked BCD digits in AH &AL to a binary in AL CBW : Fill upper byte of word with copies of sign bit of lower byte; Applicable to AX register; CWD : Fill upper word of double word with sign bit of lower word ; Sign bit of AX will be copied to all bits of the DX register

    Property of Accel Technologies Ltd., Copyright protectedAX =0607H unpacked BCD (43H)CH=09HAADDIV CH will result in quotient 07 in AL and remainder 04 in AH.AF,CF and OF are undefined after AAD

  • Arithmetic Instructions DIV BL : Divide word in AX by byte in BL. Quotient in AL and the remainder in AHDIV CX : Divide double word in DX and AX by word in CX.Quotient in AX, remainder in DX If an attempt is made to divide by 0 or if the quotient is too large to fit in AX the 8086 will do a type 0 interrupt.

    Property of Accel Technologies Ltd., Copyright protectedAX =0607H unpacked BCD (43H)CH=09HAADDIV CH will result in quotient 07 in AL and remainder 04 in AH.AF,CF and OF are undefined after AAD

  • Arithmetic InstructionsExamples for IDIV1) AX=00000011 10100111 =935D BL=11010011=-45DIDIV BL ; will put ECH(quotient=-20D) in AL and 27H (remainder 35D) in AH 2) AL=11011010=-26H=-38D CH=00000011=+3H=+3DCBW ; AX =11111111 11011010IDIV CH ; AL=11110100 =-12D ; AH=11111110=-2DNote: The remainder has the same sign as that of the dividend

    Property of Accel Technologies Ltd., Copyright protected

    For the MOV instruction,the destination can be a register or a memory location.The source can be a register,a memory location or an immediate data. The source and destination both can not be memory locations.MOV RESULTS[BP],AX : copies AX to 2 memory locations;EA of the first location is the sum of the displacement RESULTS and the contents of BP.Physical address is EA + SSPUSH Source and POP Destination are the common formats.Suppose the SP contains 4002 and the SS contains 1000 then BH would be moved to 14001 and BL to 14000.

    PUSH AL is invalid as it is trying to push a byte rather than a word.XCHG exchanges the contents of aregister with the contents of another register or the contents of a register with the contents of a memory location.It cannot exchange the contents of two memory locations. The memory location can be specified in any one of the 24 addressing modes. No flags are affected and no segment registers can be used.XLATB is used for code conversion. It can be used to convert any code of 8 bits or less to any other code of 8 bits or less.No flags are altered.For e.g. replacing ASCII with EBCDIC from a table.These are some more data transfer instructions .It has two formats: fixed port and variable port type For the fixed port type the 8 bit address of the port is specified directlyFor the variable port type,the port address is loaded into the DX register.The variable port IN instruction has the advantage that the port address can be computed or dynamically determined in the program.The IN instruction does not change the flag.It has two formats: fixed port and variable port type For the fixed port type the 8 bit address of the port is specified directlyFor the variable port type,the port address is loaded into the DX registerThe OUT instruction does not affect any flags.Say PRICES is an array of bytes.The instruction LEA BX,PRICES will load the displacement of the first element of PRICES directly into BX.The instruction MOV AL,[BX] can then be used to bring an element from the array into AL.LDS instruction is useful for pointing SI and DS at the start of a string before using one of the string instructions.This instruction also does not affect the flagsLES loads the specified register with the word from the first two memory locations and the word from the next two memory locations is copied into the ES register.LES affects no flags.LES loads the specified register with the word from the first two memory locations and the word from the next two memory locations is copied into the ES register.LES affects no flags.The lower byte of the 8086 flag register is the same as the flag byte for the 8085. LAHF followed by PUSH AX has the same effect as PUSH PSW in 8085.LAHF changes no flags.Similarly an 8085 POP PSW instruction will be translated to a POP AX - SAHF sequence to run on an 8086.SAHF changes the flags in the lower byte of the flag register.Next,we move on to the arithmetic instructions.Some of the arithmetic instructions have been given here.For the ADD and ADDC instructions the flags affected :AF,CF,OF,PF,SF,ZFAAA instruction:E.g: AL=00110101,ASCII 5 BL=00111001,ASCII 9ADD AL,BLAAA will put 04 in AL and a 1 in the carry flag. OF,PF,SF and ZF are undefinedCF indicates the carry out of bit7.PF =0 if the result has odd parity.(It is meaningful only for an 8 bit result)AF = 1 if a carry is generated out of bit 3.ZF =1 if the result in the destination is zero.SF reflects the MSB of the result.OF =1 is used to indicate whether the result of additionof signed numbers is too large to be fit in to 7 bits ADD DX,[SI] : Add word from memory at offset [SI] in DS to contents of DX.For an INC instruction, AF,OF,PF,SF and ZF are affected but the carry flag is not affected.ie, if an 8 bit destination containing FF or a 16 bit destination containing FFFF is incremented the result will be all zeroes with no carry.AAA instruction works only on the AL register.It updates AF and CF but OF,PF,SF and ZF are left undefined.A decimal counter can be implemented using a DAA instruction.AAS leaves the correct unpacked BCD in lower nibble of AL and resets the upper nibble of AL. Updates AF and CF.CMP affects all the flags.CF,SF,ZF are important.DEC does not affect the carry flagAll the arithmetic flags are modified by the SUB instruction.AAS leaves the correct unpacked BCD in lower nibble of AL and resets the upper nibble of AL. Updates AF and CF.CMP affects all the flags.CF,SF,ZF are important.DEC does not affect the carry flagAll the arithmetic flags are modified by the SUB instruction.AAS leaves the correct unpacked BCD in lower nibble of AL and resets the upper nibble of AL. Updates AF and CF.The NEG instruction updates AF,CF,SF,PF,ZF and OF.CMP affects all the flags.CF,SF,ZF are important.DEC does not affect the carry flagAF,OF,SF,ZF,PF and CF are updated by the CMP instruction.CF ZF SF0 1 0 : result of subtraction is 00 0 0 : when CX > BX in CMP CX,BX1 0 1 : CX < BXAF,OF,SF,ZF,PF and CF are updated by the CMP instruction.CF ZF SF0 1 0 : result of subtraction is 00 0 0 : when CX > BX in CMP CX,BX1 0 1 : CX < BXThis instruction is used for subtracting two packed BCD numbers to make sure the result is correct packed BCD.It works only for AL register.It subtracts 6 from the lower nibble of the result whenever the lower nibble in AL after a subtraction is greater than 9 or the AF was set by the subtraction.If the result in the upper nibble is now greater than 9 or if the carry flag was set the DAS instruction will subtract 60 from AL A Decimal down counter could be implemented using this instructionAL=00000101; BH=00001001MUL BH ; result in AXIf a word is multiplied by a word, the most significant word of the result is put in the DX register, and the least significant word is put in the AX register.If the msbyte of a 16 bit result or the MSWord of a 32 bit result is 0, CF and OF will both be 0's.AF,PF,SF and ZF are undefined after a MUL instruction.AAM will result in 0405 (unpacked BCD) in AX;IMUL in 80186 can have an immediate operandIf the magnitude of the product does not require all the bits of the destination,the unused bits will be filled with copies of the sign bit.If the upper byte of a 16 bit result or the upper word of a 32 bit result contains only copies of the sign bit then CF and OF will both be 0.If the upper byte of a 16 bit result or the upper word of a 32 bit result contains part of the product,CF and OF will both be 1.If the magnitude of the product does not require all the bits of the destination,the unused bits will be filled with copies of the sign bit.If the upper byte of a 16 bit result or the upper word of a 32 bit result contains only copies of the sign bit then CF and OF will both be 0.If the upper byte of a 16 bit result or the upper word of a 32 bit result contains part of the product,CF and OF will both be 1.AX =0607H unpacked BCD (43H)CH=09HAADDIV CH will result in quotient 07 in AL and remainder 04 in AH.AF,CF and OF are undefined after AADAX =0607H unpacked BCD (43H)CH=09HAADDIV CH will result in quotient 07 in AL and remainder 04 in AH.AF,CF and OF are undefined after AAD