Upload
jeremy-powers
View
24
Download
0
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
Assembly ProgrammingAssembly Programming
Notes for Practical 6Notes for Practical 6
Basic ArithmeticBasic Arithmetic
• AdditionAddition– Add destination, sourceAdd destination, source
• SubtractionSubtraction– Sub destination, sourceSub destination, source
• MultiplicationMultiplication
• DivisionDivision
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;
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;
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;
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