Download presentation
Presentation is loading. Please wait.
1
4.4 Bit Manipulation Instructions
Shift instructions: SHL/SAL, SHR, SAR Examples: initial value in AX= B CF=0 SAL AX,1 AX= B lost AX= B SAR AX,4 CF=0 Shift instructions: SHLD, SHRD Examples: CX=0BC3H; AX= 5678H SHRD AX,CX,4 CF=1 CX=0BC3H; AX= 3567H unchanged
2
4.4 Bit Manipulation Instructions
Rotate instructions: ROL, ROR, RCL, RCR Examples: initial value in AX= B CF=0 ROL AX,1 AX= B AX= B ROR AX,4 CF=0 Examples: initial value in AX= B and CF=1 RCL AX,1 AX= B CF= 0 AX= B 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 PROC NEAR ... 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 07 1FFF 02 2000 ?? Stack: 1FFE 03 1FFF 01 2000 ?? SP SP SP SP SP
6
4.5 Program Transfer Instructions
INT … 0000: B4 0000: 0000: 0000: IPT= Interrupt Pointer Table 4*21H=84H IRET,IRETD … 0100:00FF MOV AH, 2CH; 0100: INT 21H 0100: ADD AX, 1 … 0726:16B4 ISR for INT 21 ... … IRET INTO,BOUND Stack: 1FFA ?? 1FFB ?? 1FFC ?? 1FFD ?? 1FFE ?? 1FFF ?? 2000 ?? Stack: 1FFA 03 1FFB 01 1FFC 00 1FFD 01 1FFE 08 1FFF 41 2000 ?? 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 SP BP 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. BP old value =1234H SP old value =0100H 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.