1 / 8

4.4 Bit Manipulation Instructions

4.4 Bit Manipulation Instructions. Shift instructions: SHL/SAL, SHR, SAR. Examples: initial value in AX= 0110111100000001B. 0. CF=0. AX= 1101111000000010B. SAL AX,1. lost. AX= 1111110111100000B. SAR AX,4. CF=0. Shift instructions: SHLD, SHRD. Examples: CX=0BC3H; AX= 5678H. CF=1.

jui
Download Presentation

4.4 Bit Manipulation Instructions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 4.4 Bit Manipulation Instructions Shift instructions: SHL/SAL, SHR, SAR Examples: initial value in AX= 0110111100000001B 0 CF=0 AX=1101111000000010B SAL AX,1 lost AX=1111110111100000B SAR AX,4 CF=0 Shift instructions: SHLD, SHRD Examples: CX=0BC3H; AX= 5678H CF=1 SHRD AX,CX,4 CX=0BC3H; AX= 3567H unchanged

  2. 4.4 Bit Manipulation Instructions Rotate instructions: ROL, ROR, RCL, RCR Examples: initial value in AX= 0110111100000001B CF=0 AX=1101111000000010B ROL AX,1 AX=0010110111100000B ROR AX,4 CF=0 Examples: initial value in AX= 0110111100000001B and CF=1 AX=1101111000000011B CF= 0 RCL AX,1 AX=0110110111100000B CF=0 RCR AX,4

  3. 4.5 Program Transfer Instructions JMP Short jump address is computed adding the signed byte operand to the address of the first byte following the JMP instruction. LOOP, LOOPE/LOOPZ, LOOPNE/LOOPNZ JCXZ, JECXZ

  4. 4.5 Program Transfer Instructions Jcc The terms “less” and “greater” are used for comparisons of signed integers. The terms “above” and “below” are used for comparisons of unsigned integers.

  5. 4.5 Program Transfer Instructions CALL … 0100 CALL EXSUB 0103 ADD AX, 1 … 0204 CALL EXSUB 0207 ADD AX,2 RET … 0500 EXSUB PROCNEAR ... 0550 RET EXSUB ENDP Assembler directives specifying the begin and the end of a NEAR or FAR procedure (subroutine) Stack: 1FFE ?? 1FFF ?? 2000 ?? Stack: 1FFE 03 1FFF 01 2000 ?? Stack: 1FFE 07 1FFF 02 2000 ?? SP SP SP SP SP

  6. 4.5 Program Transfer Instructions INT … 0000:0084 B4 0000:0085 16 0000:0086 26 0000:0087 07 IPT= Interrupt Pointer Table 4*21H=84H IRET,IRETD … 0100:00FF MOV AH, 2CH; 0100:0101 INT 21H 0100:0103 ADD AX, 1 … 0726:16B4 ISR for INT 21 ... … IRET Stack: 1FFA ?? 1FFB ?? 1FFC ?? 1FFD ?? 1FFE ?? 1FFF ?? 2000 ?? Stack: 1FFA 03 1FFB 01 1FFC 00 1FFD 01 1FFE 08 1FFF 41 2000 ?? INTO,BOUND SP SP SP FLAGS=4108H

  7. 4.5 Program Transfer Instructions ENTER, LEAVE ENTER 6,0 … 00F8 ?? 00F9 ?? 00FA ?? 00FB ?? 00FC ?? 00FD ?? 00FE ?? 00FF ?? 0100 ?? … 00F8 ?? 00F9 ?? 00FA ?? 00FB ?? 00FC ?? 00FD ?? 00FE 34 00FF 12 0100 ?? SP BP SP SP If Level=0, BP is saved on stack, BP is loaded with the content of SP, Reserved memory space SP is decremented by Space16. SP old value =0100H BP old value =1234H BP new value =00FEH SP intermediate value =00FEH SP final value =00F8H LEAVE SP is loaded with the content of BP, BP is popped from stack.=> values before ENTER restored. Stack Frame Frame pointer SP back to old value =0100H BP back to old value =1234H

  8. 4.6 Processor Control Instructions

More Related