DOC PREVIEW
Princeton COS 217 - A Subset of IA-32 Assembly Language

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1. Instruction Operands1.1. Immediate Operands1.2. Register Operands1.3. Memory Operands2. Commonly Used Memory OperandsSyntaxSemanticsDescription3. Assembler MnemonicsSemanticsMove. Copy src to dest. Flags affected: NoneMove Sign-Extended Byte. Copy byte operand src to word or long operand dest, extending the sign of src.Flags affected: NoneMove Sign-Extended Word. Copy word operand src to long operand dest, extending the sign of src.Flags affected: NoneMove Zero-Extended Byte. Copy byte operand src to word or long operand dest, setting the high-order bytes of dest to 0.Flags affected: NoneMove Zero-Extended Word. Copy word operand src to long operand dest, setting the high-order bytes of dest to 0.Flags affected: NonePush. Push src onto the stack.Pop. Pop from the stack into dest.lea{l,w} srcM, destRLoad Effective Address. Assign the address of src to dest.Convert Long to Double Register. Sign extend the contents of register EAX into the register pair EDX:EAX, typically in preparation for idivl.Convert Word to Double Register. Sign extend the contents of register AX into the register pair DX:AX, typically in preparation for idivw.Convert Byte to Word. Sign extend the contents of register AL into register AX, typically in preparation for idivb.leavePop a stack frame in preparation for leaving a function.SemanticsAdd. Add src to dest.Add with Carry. Add src and the carry flag to dest.dest = dest - src;Subtract. Subtract src from dest.Increment. Increment dest.dest = dest - 1;Decrement. Decrement dest.Negate. Negate dest.Signed Multiply. Multiply the contents of register EAX by src, and store the product in registers EDX:EAX.Signed Multiply. Multiply the contents of register AX by src, and store the product in registers DX:AX.Signed Multiply. Multiply the contents of register AL by src, and store the product in AX.Signed Divide. Divide the contents of registers EDX:EAX by src, and store the quotient in register EAX and the remainder in register EDX.Signed Divide. Divide the contents of registers DX:AX by src, and store the quotient in register AX and the remainder in register DX.Signed Divide. Divide the contents of register AX by src, and store the quotient in register AL and the remainder in register AH.Unsigned Multiply. Multiply the contents of register EAX by src, and store the product in registers EDX:EAX.Unsigned Multiply. Multiply the contents of register AX by src, and store the product in registers DX:AX.Unsigned Multiply. Multiply the contents of register AL by src, and store the product in AX.Unsigned Divide. Divide the contents of registers EDX:EAX by src, and store the quotient in register EAX and the remainder in register EDX.Unsigned Divide. Divide the contents of registers DX:AX by src, and store the quotient in register AX and the remainder in register DX.Unsigned Divide. Divide the contents of register AX by src, and store the quotient in register AL and the remainder in register AH.SemanticsAnd. Bitwise and src into dest.Or. Bitwise or src nito dest.Exclusive Or. Bitwise exclusive or src into dest.Not. Bitwise not dest.Shift Arithmetic Left. Shift dest to the left src bits, filling with zeros.Shift Arithmetic Right. Shift dest to the right src bits, sign extending the number.Shift Left. (Same as sal.)Shift Right. Shift dest to the right src bits, filling with zeros.SemanticsCompare. Compute src2 - src1 and set flags in the EFLAGS register based upon the result.Test. Compute src2 & src1 and set flags in the EFLAGS register based upon the result.Jump. Jump to label.Conditional Jump. Jump to label iff the flags in the EFLAGS register indicate an equality or inequality (respectively) relationship between the most recently compared numbers.Signed Conditional Jump. Jump to label iff the condition codes in the EFLAGS register indicate a less than, less than or equal to, greater than, or greater than or equal to (respectively) relationship between the most recently compared numbers.Unsigned Conditional Jump. Jump to label iff the condition codes in the EFLAGS register indicate a below, below or equal to, above, or above or equal to (respectively) relationship between the most recently compared numbers.Call. Call the function that begins at label.Call. Call the function whose address is in src.Return. Return from the current function.Interrupt. Generate interrupt number src. Flags affected: None4. Assembler DirectivesSyntaxDescriptionPrinceton University COS 217: Introduction to Programming Systems A Subset of IA-32 Assembly Language 1. Instruction Operands 1.1. Immediate Operands Syntax: $i Semantics: Evaluates to i. Note that i could be a label... Syntax: $label Semantics: Evaluates to the memory address denoted by label. 1.2. Register Operands Syntax: %r Semantics: Evaluates to reg[r], that is, the contents of register r. 1.3. Memory Operands Syntax: disp(%base, %index, scale) Semantics: disp is a literal or label. base is a general purpose register. index is any general purpose register except EBP. scale is the literal 1, 2, 4, or 8. One of disp, base, or index is required. All other fields are optional. Evaluates to the contents of memory at a certain address. The address is computed using this formula: disp + reg[base] + (reg[index] * scale) The default disp is 0. The default scale is 1. If base is omitted, then reg[base] evaluates to 0. If index is omitted, then reg[index] evaluates to 0. Page 1 of 62. Commonly Used Memory Operands Syntax Semantics Description label disp: label base: (none) index: (none) scale: (none) mem[0+(0*0)+label] mem[label] Direct Addressing. The contents of memory at a certain address. The offset of that address is denoted by label. Often used to access a long, word, or byte in the bss, data, or rodata section. (%r) disp: (none) base: r index: (none) scale: (none) mem[reg[r]+(0*0)+0] mem[reg[r]] Indirect Addressing. The contents of memory at a certain address. The offset of that address is the contents of register r. Often used to access a long, word, or byte in the stack section. i(%r) disp: i base: r index: (none) scale: (none) mem[reg[r]+(0*0)+i] mem[reg[r]+i] Base-Pointer Addressing. The contents of memory at a certain address. The offset of that address is the sum of i and the contents of register r. Often used to access a long, word, or byte in the stack section. label(%r) disp: label base: r index: (none) scale:


View Full Document

Princeton COS 217 - A Subset of IA-32 Assembly Language

Documents in this Course
Summary

Summary

4 pages

Lecture

Lecture

4 pages

Generics

Generics

14 pages

Generics

Generics

16 pages

Lecture

Lecture

20 pages

Debugging

Debugging

35 pages

Types

Types

7 pages

Lecture

Lecture

21 pages

Assembler

Assembler

16 pages

Lecture

Lecture

20 pages

Lecture

Lecture

39 pages

Testing

Testing

44 pages

Pipeline

Pipeline

19 pages

Lecture

Lecture

6 pages

Signals

Signals

67 pages

Building

Building

17 pages

Lecture

Lecture

7 pages

Modules

Modules

12 pages

Generics

Generics

16 pages

Testing

Testing

22 pages

Signals

Signals

34 pages

Lecture

Lecture

19 pages

Load more
Download A Subset of IA-32 Assembly Language
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view A Subset of IA-32 Assembly Language and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view A Subset of IA-32 Assembly Language 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?