Assembly Programming
This guide covers basic arithmetic operations in assembly language, including addition, subtraction, multiplication, and division. You will learn how to perform these operations using assembly commands such as `mov`, `add`, `sub`, `imul`, and `idiv`. Examples illustrate each operation, showing their implementation in both assembly and Java. Practical exercises, such as generating the Fibonacci series and performing long division, provide hands-on experience. Dive deeper into assembly programming and enhance your skills with this comprehensive resource.
Assembly Programming
E N D
Presentation Transcript
Assembly Programming Notes for Practical 4 http://www.osdata.com/topic/language/asm/intarith.htm#integerarithmetic
Basic Arithmetic • Addition • Add destination, source • Subtraction • Sub destination, source • Multiplication • Division http://www.osdata.com/topic/language/asm/intarith.htm#integerarithmetic
Addition • 10 + 6 = 16 • mov ax, 10 • add ax, 6 • Java: ax = 10; ax = ax + 6; http://www.osdata.com/topic/language/asm/intarith.htm#integerarithmetic
Subtraction • 10 – 6 = 4 • mov ax, 10 • sub ax, 6 • Java: ax = 10; ax = ax - 6; http://www.osdata.com/topic/language/asm/intarith.htm#integerarithmetic
Multiplication • 4 * 5 (= 20) • mov ax, 4 • imul 5 • Java: ax = 4; ax = ax * 5; http://www.osdata.com/topic/language/asm/intarith.htm#integerarithmetic
Division • 13 ÷ 5 ( = 2 remainder 3) • mov ax, 13 • idiv 5 • ax would have the quotient value • dx has the remainder value http://www.osdata.com/topic/language/asm/intarith.htm#integerarithmetic
Prac 4 • 1. Fibonacci Series • Back-generate the series to 1. Ni = Ni-2 - Ni+1 ; N1 = 1 N2 = 1; for i>0 • 2. Long division • x divided by y, where x < y. • Use integer division to calculate decimals • 123 ÷ 100 = 1.23 http://www.osdata.com/topic/language/asm/intarith.htm#integerarithmetic
For more learning!!! • http://www.osdata.com/topic/language/asm/intarith.htm#integerarithmetic http://www.osdata.com/topic/language/asm/intarith.htm#integerarithmetic