0% found this document useful (0 votes)
48 views15 pages

Lecture 4. Main Unprivileged Commands - II: Command: Purpose: Command: Purpose: Command: Purpose

This document summarizes several unprivileged commands in x86 assembly including: 1) bit manipulation commands like BTS, BTR, and BTC; 2) conditional jump commands like LOOP and LOOPE; 3) procedure calls and returns with CALL, RET, ENTER, and LEAVE; and 4) interrupt handling with INT and IRET. It provides examples of using commands like LOOP for iterative processing and ENTER/LEAVE for procedure stack frame management.

Uploaded by

Anna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views15 pages

Lecture 4. Main Unprivileged Commands - II: Command: Purpose: Command: Purpose: Command: Purpose

This document summarizes several unprivileged commands in x86 assembly including: 1) bit manipulation commands like BTS, BTR, and BTC; 2) conditional jump commands like LOOP and LOOPE; 3) procedure calls and returns with CALL, RET, ENTER, and LEAVE; and 4) interrupt handling with INT and IRET. It provides examples of using commands like LOOP for iterative processing and ENTER/LEAVE for procedure stack frame management.

Uploaded by

Anna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Lecture 4.

Main unprivileged
commands - II

Command: ROR receiver, counter


Purpose: Cyclic shift to the right

Command: ROL receiver, counter


Purpose: Cyclic shift to the left

Command: RCR receiver, counter


Purpose: Cyclic shift to the right through the
carryover flag

Command: RCL receiver, counter


Purpose: Cyclic shift to the left through the
carryover flag
Lecture 4. Main unprivileged
commands - II

Figure 9. Cyclic shifts


Lecture 4. Main unprivileged
commands - II
Operations with bits and bytes
Command: BTS base, shift
Purpose: Checking and installing bit

Command: BTR base, shift


Purpose: Checking and resetting bit

Command: BTC base, shift


Purpose: Checking and inverting bit

Command: BSF receiver, source


Purpose: Direct search of bit

Command: BSR base, shift


Purpose: Inverse search of bit
Lecture 4. Main unprivileged
commands - II

Command: SETcc receiver


Purpose: Byte installation on a condition
Lecture 4. Main unprivileged
commands - II
Table 6. SETcc commands
Lecture 4. Main unprivileged
commands - II

Commands of control transfer


Command: JMP operand
Purpose: Unconditional transition
Depending on transition type there distinguish:
transition of short type (short transition) — if transition address is ranging from -127 to +128 bytes form the JMP
command;
transition of near type (near transition) — if transition address is in the same segment as the JMP command;
transition of far type (far transition) — if transition address is in the other segment. Also far transition may be
executed in the same segment, if in segment part of operand there is a number, coinciding with the CS current
value;
transition with task switching — control transfer to other task in the multitask environment.

Command: Jcc label


Purpose: Conditional transition
Lecture 4. Main unprivileged
commands - II
Table 7. Options of the Jcc command
Lecture 4. Main unprivileged
commands - II
Command: JCXZ label
Purpose: Transition, if CX = 0

Command: JECXZ label


Purpose: Transition, if ECX = 0

Command: LOOP label


Purpose: Loop

mov cx,0Ah
loop_start: add ax,cx
loop loop_start

The LOOP command is completely equivalent to the couple of


commands
dec ecx
jz label
Lecture 4. Main unprivileged
commands - II
Command: LOOPE label
Purpose: Cycle, while there is equal

Command: LOOPZ label


Purpose: Cycle, while there is zero

Command: LOOPNE label


Purpose: Cycle, while there is not equal

Command: LOOPNZ label


Purpose: Cycle, while there is not zero

mov cx,str_length
move_loop: stosb
lodsb
cmp al,13
loopnz move_loop
Lecture 4. Main unprivileged
commands - II

Command: CALL operand


Purpose: Procedure call

Command: RET number


RETN number
RETF number
Purpose: Return from procedure

Command: INT number


Purpose: Interruption call

Command: IRET
IRETD
Purpose: Return from the interruption handler
Lecture 4. Main unprivileged
commands - II

Command: INT3
Purpose: Call of interruption 3

Command: INTO
Purpose: Call interruption 4 at overflow

Command: BOUND index, boundaries


Purpose: Checking exit from massive boundaries

Command: ENTER size, level


Purpose: Entrance to procedure
Lecture 4. Main unprivileged
commands - II

Figure 10. Stack frame of procedure of the 0th level (MAIN)


Lecture 4. Main unprivileged
commands - II

Figure 11. Stack frame of procedure of the 1st level (PROCA)


Lecture 4. Main unprivileged
commands - II

Figure 12. Stack frame of procedure of the 2nd level (PROCB)


Lecture 4. Main unprivileged
commands - II

Command: LEAVE
Purpose: Exit from procedure

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy