• Tidak ada hasil yang ditemukan

PDF Assembly Introduction to 8086 Behrooz Nasihatkon - KNTU

N/A
N/A
Protected

Academic year: 2025

Membagikan "PDF Assembly Introduction to 8086 Behrooz Nasihatkon - KNTU"

Copied!
38
0
0

Teks penuh

(1)

Introduction to 8086 Assembly

Lecture 1

Behrooz Nasihatkon

(2)

Introduction to 8086 Assembly Language

3 credits

Saturday, Wednesday 15:30-17:30 AM

Instructor: Behrooz Nasihatkon

Email: [email protected]

(3)

Roll call

(4)

What is considered cheating?

(5)

Special needs

(6)

COVID-19

(7)

Auditing the course

(8)

Recording the lectures

(9)
(10)

How to get help?

(11)

Asking questions!

(12)

Grading

Homework Assignments

Project(s)

Midterm Exam(s)

Final Exam

(13)

The exams

Tools you need a. A webcam b. A microphone

c. A screen recorder (preferably OBS-studio) d. An md5 checksum generator

For each question

a. Record a video of yourself solving the question b. Upload the solution

c. Record a video explaining your solution d. Upload the md5sums of the videos

(14)

How to give feedback?

Anonymous form:

https://goo.gl/zPxBAS

(15)

Join the Telegram Channel

https://t.me/asmkntus00

(16)

Course Website

https://wp.kntu.ac.ir/nasihatkon/teaching/asm/f2020/index.html

(17)

Resources

Carter, Paul A. PC Assembly Language, 2007

http://pacman128.github.io/pcasm/

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.

(18)

What is Assembly language?

(19)

What is Assembly language?

https://me.me/i/ssembly-gu-ge-cs-student-llove-programming-5644fb641baa4609aec4adc8ff5742cf

(20)

What is Assembly language?

(21)

What is Assembly language?

http://justcode.me/assembly/introduction-assembly-language-examples/

(22)

How many assembly languages are there?

(23)

How many assembly languages are there?

https://knowyourhandheld.weebly.com/blog/what-are-the-necessary-features-in-latest-smartphones

(24)

Why assembly?

(25)

Why assembly?

Going low-level!

Getting insight

How programming languages are implemented (code, variables, arrays, functions, etc.)!

How compilers work

Writing efficient programs (?)

System programming

Writing device drivers

Interfacing with high-level languages like C

Reverse engineering

New CPU features

(26)

x86 & x86-64 Assembly

(27)

AT&T vs Intel Syntax

https://en.wikipedia.org/wiki/X86_assembly_language#Syntax

(28)

What is an Assembler?

test.c

compiler (gcc)

executable

test.asm

assembler (gas, nasm)

executable

(29)

Major Assemblers

Microsoft Assembler (MASM)

GNU Assembler (GAS)

Flat Assembler (FASM)

Turbo Assembler (TASM)

Netwide Assembler (NASM)

(30)

Major Assemblers

Microsoft Assembler (MASM)

GNU Assembler (GAS)

Flat Assembler (FASM)

Turbo Assembler (TASM)

Netwide Assembler (NASM)

(31)

Backward compatibility

Look at

https://en.wikipedia.org/wiki/X86

(32)

Our platform

Hardware: 80x86 processor (32, 64 bit)

(33)

Our platform

Hardware: 80x86 processor (32, 64 bit)

OS:

(34)

Our platform

Hardware: 80x86 processor (32, 64 bit)

OS:

(35)

Our platform

Hardware: 80x86 processor (32, 64 bit)

OS:

(36)

Our platform

Hardware: 80x86 processor (32, 64 bit)

OS: Linux

(37)

Our platform

Hardware: 80x86 processor (32, 64 bit)

OS: Linux

Assembler: Netwide Assembler (NASM)

+ GNU Assembler (GAS)

C Compiler: GNU C Compiler (GCC)

Linker: GNU Linker (LD)

(38)

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)

Referensi

Dokumen terkait

● Does not matter when 2's complement signed integers are used ● Not the case for multiplication and division... Overflow ● carry flag CF: unsigned ● overflow flag OF:

Floating point operations ● Floating point libraries ● Math coprocessor floating point coprocessor, floating point unit FPU ○ add-on ○ Integrated... Intel x87 extended precision

Introduction to 8086 Assembly Lecture 5 Jump, Conditional Jump, Looping, Compare instructions... Practice: rem.asm

Introduction to 8086 Assembly Lecture 5 Jump, Conditional Jump, Looping, Compare instructions... Example: rem.asm

Clock cycle & instruction timing See ● 8086 Instruction Timing http://www.oocities.org/mc_introtocomputers/ ○ http://www.oocities.org/mc_introtocomputers/Instruction_Timing.PDF ●

Introduction to 8086 Assembly Lecture 6 Working with memory... Code labels

Example: Shift arithmetic right segment .data msg: db "shift must be... PC Assembly

– Example of procedure: C source file sample1.c assembly source file sample2.s linker ld assembler as object file sample1.o object file sample2.o C compiler gcc executable a.out