6
Assembly Programming Assembly Programming Notes for Practical 6 Notes for Practical 6

Assembly Programming

Embed Size (px)

DESCRIPTION

Notes for Practical 6. Assembly Programming. Basic Arithmetic. Addition Add destination, source Subtraction Sub destination, source Multiplication Division. Addition. 10 + 6 = 16 mov ax, 10 add ax, 6 Java: ax = 10; ax = ax + 5;. Subtraction. 10 – 6 = 4 mov ax, 10 sub ax, 6 - PowerPoint PPT Presentation

Citation preview

Page 1: Assembly Programming

Assembly ProgrammingAssembly Programming

Notes for Practical 6Notes for Practical 6

Page 2: Assembly Programming

Basic ArithmeticBasic Arithmetic

• AdditionAddition– Add destination, sourceAdd destination, source

• SubtractionSubtraction– Sub destination, sourceSub destination, source

• MultiplicationMultiplication

• DivisionDivision

Page 3: Assembly Programming

AdditionAddition

• 10 + 6 = 1610 + 6 = 16

• mov ax, 10mov ax, 10

• add ax, 6 add ax, 6

• Java: ax = 10; ax = ax + 5;Java: ax = 10; ax = ax + 5;

Page 4: Assembly Programming

SubtractionSubtraction

• 10 – 6 = 410 – 6 = 4

• mov ax, 10mov ax, 10

• sub ax, 6 sub ax, 6

• Java: ax = 10; ax = ax - 6;Java: ax = 10; ax = ax - 6;

Page 5: Assembly Programming

MultiplicationMultiplication

4*5 = 204*5 = 20

•mov ax, 4mov ax, 4

•imul 5imul 5

•Java: ax = 4; ax = ax * 5;Java: ax = 4; ax = ax * 5;

Page 6: Assembly Programming

DivisionDivision

• 13 ÷ 5 ( = 2 remainder 3)13 ÷ 5 ( = 2 remainder 3)

• mov ax, 13mov ax, 13

• idiv 5 idiv 5

• ax would have the quotient value ax would have the quotient value

• dx has the remainder value dx has the remainder value