1 / 23

Symbolic Instructions: Assembly Guide for Arithmetic, ASCII-BCD Conversion, Bit Shifting, Comparison, Data Transfer, Fla

This assembly guide provides instructions for various symbolic instructions including arithmetic operations, ASCII-BCD conversion, bit shifting, comparison, data transfer, flag operations, input/output, logical operations, looping, stack operations, string operators, transfer (conditional/unconditional), and type conversion.

warfel
Download Presentation

Symbolic Instructions: Assembly Guide for Arithmetic, ASCII-BCD Conversion, Bit Shifting, Comparison, Data Transfer, Fla

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. CS 301 Fall 2002Assembly Instructions Slide Set 4

  2. Symbolic Instructions 1Arithmetic • ADD: Add • ADC: Add with carry • SUB: Subtract • SBB: Subtract with borrow • NEG: Negate • XADD: Exchange and add • INC: Increment by 1 • DEC: Decrement by 1 • MUL: Unsigned multiply • DIV: Unsigned divide • IMUL: Signed multiply • IDIV: Signed divide

  3. Symbolic Instructions 2ASCII-BCD conversion • AAA: ASCII Adjust After Addition • AAS: ASCII Adjust After Subtraction • AAM: ASCII Adjust After Multiplication • AAD: ASCII Adjust Before Division • DAA: Decimal Adjust After Addition • DAS: Decimal Adjust After Subtraction

  4. Symbolic Instructions 3Bit Shifting • RCL: Rotate Left Through Carry • RCR: Rotate Right Through Carry • ROL: Rotate Left • ROR: Rotate Right • SAL: Shift Algebraic Left (=SHL) • SAR: Shift Algebraic Right • SHL: Shift Logical Left (=SAL) • SHR: Shift Logical Right • SHLD: Shift Left Double • SHRD: Shift Right Double

  5. Symbolic Instructions 4Comparison • BSF/BSR: Bit Scan • BT/BTC/BTR/BTS: Bit Test • CMP: Compare • CMPSn: Compare String • CMPXCHG: Compare and Exchange • CMPXCHG8B: Compare and Exchange • TEST: Test bits

  6. Symbolic Instructions 5Data Transfer • LDS: Load DS register • LEA: Load Effective Address • LnS: Load nS register • LODS: Load String • MOV: Move Data • MOVSn: Move String • MOVSX: Move with Sign-Extend • MOVZX: Move with Zero-Extend • STOS: Store String • XCHG: Exchange • XLAT: Translate

  7. Symbolic Instructions 6Flag Operations • CLC/STC: Clear/Set CF • CLD/STD: Clear/Set DF • CLI/STI: Clear/Set IF • CMC: Complement CF • LAHF: Load AH from Flags • SAHF: Store AH in Flags • POPF: Pop Flags Off Stack • PUSH: Push Flags On Stack

  8. Symbolic Instructions 7Input/Output • IN: Input Byte or Word • OUT: Output Byte or Word • INSn: Input String • OUTSn: Output String

  9. Symbolic Instructions 8Logical Operations • AND: Logical And • OR: Logical Or • NOT: Logical Not • XOR: Logical XOR

  10. Symbolic Instructions 9Looping • LOOP: Loop Until Complete • LOOPE: Loop While Equal • LOOPZ: Loop While Zero • LOOPNE: Loop While Not Equal • LOOPNZ: Loop While Not Zero

  11. Symbolic Instructions 10Stack Operations • ENTER: Make Stack Frame • LEAVE: Terminate Stack Frame • POP: Pop Word Off Stack • PUSH: Push Word On Stack • POPF: Pop Flags Off Stack • PUSHF: Push Flags On Stack • POPA: Pop All General Registers • PUSHA: Push All General Registers

  12. Symbolic Instructions 11String Operators • CMPS: Compare String • LODS: Load String • MOVS: Move String • REP: Repeat String • REPE: Repeat While Equal • REPZ: Repeat While Zero • REPNE: Repeat While Not Equal • REPNZ: Repeat While Not Zero • SCAS: Scan String • STOS: Store String

  13. Symbolic Instructions 12Transfer (Conditional) 1 • INTO: Interrupt On Overflow • JA: Jump if Above • JAE: Jump if Above/Equal • JB: Jump if Below • JBE: Jump if Below/Equal • JC: Jump if Carry • JCXZ: Jump if CX is Zero • JE: Jump if Equal • JG: Jump if Greater • JGE: Jump if Greater/Equal • JL: Jump if Less

  14. Symbolic Instructions 13Transfer (Conditional) 2 • JLE: Jump if Less/Equal • JNA: Jump if Not Above • JNAE: Jump if Not Above/Equal • JNB: Jump if Not Below • JNBE: Jump if Not Below/Equal • JNC: Jump if No Carry • JNE: Jump if Not Equal • JNG: Jump if Not Greater • JNGE: Jump if Not Greater/Equal • JNL: Jump if Not Less

  15. Symbolic Instructions 14Transfer (Conditional) 3 • JNLE: Jump if Not Less/Equal • JNO: Jump if No Overflow • JNP: Jump if No Parity • JNS: Jump if No Sign • JNZ: Jump if Not Zero • JO: Jump if Overflow • JP: Jump if Parity • JPE: Jump if Parity Is Even • JPO: Jump if Parity Is Odd • JS: Jump if Sign • JZ: Jump if Zero

  16. Symbolic Instructions 15Transfer (Unconditional) • CALL: Call a Procedure • INT: Interrupt • IRET: Interrupt Return • JMP: Jump • RET: Return • RETN/RETF: Return Near/Far

  17. Symbolic Instructions 16Type Conversion • CBW: Convert Byte To Word • CDQ: Convert Doubleword to Quadword • CWD: Convert Word to DoubleWord • CWDE: Convert Word to Extended DoubleWord

  18. MOV – Move Data • Flags: Affects no flags • MOV reg/mem,reg/mem/imm

  19. ADD (and ADC/SUB/SBB) • Add, Add with Carry, Subtract, Subtract with borrow. • Flags: All affect AF,CF,OF,PF,SF, and ZF • ADD reg/mem, reg/mem/imm • ADC reg/mem, reg/mem/imm • SBB reg/mem, reg/mem/imm • SUB reg/mem, reg/mem/imm

  20. MUL - Multiply Unsigned Integers • Flags: Affects CF and OF. (AF,PF,SF, and ZF are undefined) • MUL reg/mem

  21. DIV - Divide Unsigned IntegersIDIV – Divide Signed Integers • Flags: Affect AF,CF,OF,PF,SF, and ZF (all undefined) • DIV reg/mem • IDIV reg/mem

  22. IMUL – Multiply Signed Integers • Flags: Affects CF and OF. (AF,PF,SF, and ZF are undefined)

  23. Some Examples • Assembled ADD instructions • math.asm • prime.asm

More Related