Docsity

Introduction Part -Assembly Language Programming-Lecture Slides, Slides of Assembly Language Programming

Partial preview of the text

Download Introduction Part -Assembly Language Programming-Lecture Slides and more Slides Assembly Language Programming in PDF only on Docsity!

Introduction

Lab Lecture 1

Masm filename

Link filename

Books Textbook

Assembly Language for Intel-Based

Computers, 3rd Edition, Kip Irvine

Reference The Art of Assembly Language , Randy Hyde

Grading (subject to change)

Assignments (10%)

Quizzes (10%)

Class participation (40%)

Final (40%)

Why programming in assembly? It is all about lack of smart compilers Faster code, compiler is not good enough Smaller code , compiler is not good enough, e.g. mobile devices, embedded devices, also Smaller code โ†’ better cache performance โ†’ faster code

Syllabus Assembly Language Fundamentals Data Transfers, Addressing, and Arithmetic Procedures Conditional Processing Integer Arithmetic Strings and Arrays Code Optimization

High-Level Language Application-oriented languages Programs compile into assembly language X =(Y+4)*

Assembly Language Instruction mnemonics that have a one-to- one correspondence to machine language Programs are translated into machine language mov eax, Y add eax, 4 mov ebx, 3 imul ebx mov X, eax

Binary numbers Digits are 1 and 0 (a binary digit is called a bit) 1 = true 0 = false MSB โ€“ most significant bit LSB โ€“ least significant bit Bit numbering: A bit string could have different interpretations 15 0 1 0 1 1 0 0 1 0 1 0 0 1 1 1 0 0 MSB LSB

Unsigned binary integers Each digit (bit) is either 1 or 0 Each bit represents a power of 2: 1 1 1 1 1 1 1 1 27 26 25 24 23 22 21 20 Every binary number is a sum of powers of 2

Translating Unsigned Decimal to Binary Repeatedly divide the decimal integer by 2. Each remainder is a binary digit in the translated value: 37 = 100101

Binary addition Starting with the LSB, add each pair of digits, include the carry if present. 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 0

0 0 0 0 1 0 1 1 1 (4) (7) (11) carry: bit position: 7 6 5 4 3 2 1 0