Download presentation
Presentation is loading. Please wait.
1
Arithmetic Instructions
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 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
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.