1 / 6

ICS312 Set 5

ICS312 Set 5. Arithmetic Instructions. Data Transfer Instructions MOV MOV destination, source destination operand can be register or memory operand. source operand can be register, memory, or immediate operand. source and destination operands cannot BOTH be memory operands.

felcia
Download Presentation

ICS312 Set 5

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. ICS312 Set 5 Arithmetic Instructions

  2. Data Transfer Instructions MOV MOV destination, source destination operand can be register or memory operand. source operand can be register, memory, or immediate operand. source and destination operands cannot BOTH be memory operands. Examples: mov cx, ax mov account, 3

  3. Arithmetic Instructions (ADD, SUB, INC, and DEC) • ADD and SUB Instructions • ADD destination, source • SUB destination, source • destination operand can be register or memory operand. • source operand can be register, memory operand, or immediate • source and destination operands cannot BOTH be memory operands. • INC and DEC Instructions • INC destination • DEC destination • destination operand can be register or memory operand. • Examples: inc ah • dec ebx • add number, 2

  4. NEG Instruction • NEG destination • destination operand can be register or memory operand. • Examples: neg di • Note:  Type Agreement of Operands • The operands of two-operand instructions must be of the same • type; • that is both operands must be bytes, words, or double words

  5. Translation of High-Level Language to Assembly Language Examples:  Translate the following high-level language statements to assembly language: 1.    B = A MOV AX, A MOV B, AX 2.    A = 5 - A First method: MOV CX, 5 SUB CX, A MOV A, CX Second method: NEG A ADD A, 5 3.    A = B - 2 * A MOV DX, A ADD DX, DX NEG DX ADD DX,B MOV A,DX

  6. Textbook Reading (Jones): • Section 4.1 Addition and Subtraction

More Related