assembly introduction to 8086 behrooz nasihatkon · 2019-11-13 · how does an assembly code look...
TRANSCRIPT
![Page 1: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/1.jpg)
Introduction to 8086 Assembly Lecture 1
Behrooz Nasihatkon
![Page 2: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/2.jpg)
Introduction to 8086 Assembly Language● 3 credits● Saturday, Wednesday, 15:30-17:30 AM● Instructor: Behrooz Nasihatkon● Email: [email protected]● Room: EC building, level 3
![Page 3: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/3.jpg)
Grading● Homeworks● Quizzes● Project(s)● Midterm Exam● Final Exam
![Page 4: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/4.jpg)
What is considered cheating?
![Page 5: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/5.jpg)
Roll call
![Page 6: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/6.jpg)
Special needs
![Page 7: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/7.jpg)
Auditing the course
![Page 8: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/8.jpg)
Recording the lectures
![Page 9: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/9.jpg)
![Page 10: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/10.jpg)
How to get help?
![Page 11: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/11.jpg)
Asking questions!
![Page 14: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/14.jpg)
Resources● Carter, Paul A. PC Assembly Language, 2007
○ http://cs.dartmouth.edu/~spl/Academic/Organization/docs/NASM/PC_Assembly.pdf● NASM tutorial
○ http://cs.lmu.edu/~ray/notes/nasmtutorial/● TutorialsPoint
○ https://www.tutorialspoint.com/assembly_programming● GOOGLE!
Further study:
● Hyde, Randall. The art of assembly language. No Starch Press, 2010.○ Linux: http://www.plantation-productions.com/Webster/www.artofasm.com/Linux○ Windows: http://www.plantation-productions.com/Webster/www.artofasm.com/Windows/
● Blum, Richard. Professional assembly language. John Wiley & Sons, 2007.
![Page 15: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/15.jpg)
What is Assembly language?
http://justcode.me/assembly/introduction-assembly-language-examples/
![Page 16: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/16.jpg)
How many assembly languages are there?
https://knowyourhandheld.weebly.com/blog/what-are-the-necessary-features-in-latest-smartphones
![Page 17: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/17.jpg)
Why assembly?
● Going low-level!● How programming languages are implemented (code,
variables, arrays, functions, etc.)!● Writing efficient programs● System programming● Writing device drivers● Interfacing with high-level languages like C● Reverse engineering
![Page 18: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/18.jpg)
x86 & x86-64 Assembly
![Page 19: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/19.jpg)
AT&T vs Intel Syntaxhttps://en.wikipedia.org/wiki/X86_assembly_language#Syntax
![Page 20: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/20.jpg)
What is an Assembler?
test.ccompiler (gcc)
executable
test.asmassembler (gas, nasm)
executable
![Page 21: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/21.jpg)
Major Assemblers
● Microsoft Assembler (MASM)● GNU Assembler (GAS)● Flat Assembler (FASM)● Turbo Assembler (TASM)● Netwide Assembler (NASM)
![Page 22: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/22.jpg)
Backward compatibility
● Look at ○ https://en.wikipedia.org/wiki/X86
![Page 23: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/23.jpg)
Our platform
● Hardware: 80x86 processor (32, 64 bit)● OS: Linux● Assembler: Netwide Assembler (NASM)● C Compiler: GNU C Compiler (GCC)● Linker: GNU Linker (LD)
![Page 24: Assembly Introduction to 8086 Behrooz Nasihatkon · 2019-11-13 · How does an assembly code look like? Write a C program named test.c. Compile it to x86 assembly language, the AT&T](https://reader030.vdocuments.mx/reader030/viewer/2022040601/5e8f848d2e9cd855c36f100d/html5/thumbnails/24.jpg)
How does an assembly code look like?
Write a C program named test.c.
Compile it to x86 assembly language, the AT&T syntax
>>> gcc -S -o att.s test.c
Now compile to the Intel syntax:
>>> gcc -S -masm=intel -o intel.s test.c
Compare the two assembly syntaxes (output files att.s and intel.s)