Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
1
- [Instructor] Computers of all shapes and sizes
2
achieve their computational tasks
3
by manipulating binary data, zeros and ones,
4
using a set of instructions,
5
built into the hardware of their chip sets.
6
These instructions themselves
7
are represented as zeros and ones
8
in what's known as machine code.
9
For as humans it's a bit mind numbing
10
looking at just zeros and ones.
11
So we aggregate them into sets of four bits
12
and call them hexadecimal.
13
Represented by the numbers no to nine,
14
and the letters A to F 16 possible values in total.
15
Chip manufacturers will have their own set
16
of instructions for their chips.
17
The most popular instruction set
18
is that used with the Intel x86 chip.
19
Two of the commonly seen chip sets are they ARM chip
20
which is the most popular mobile phone chip,
21
and the Atmel chip,
22
which appears in many small IoT type devices.
23
For the purposes of this course,
24
we'll be focusing on the x86 chip set.
25
Instructions are executed in what's known as
26
the central processing unit of the chip
27
using a set of registers.
28
Special areas of the chip,
29
which are able to manipulate bits.
30
We'll look at what these registers are shortly
31
but as an example, the instruction
32
to add 28 to a register called ESP
33
will be coded in machine language as 83 C4 1C.
34
Even this is a bit tricky for us.
35
Although many low level programs
36
can write machine code directly.
37
It's more common however, to use mnemonics
38
to represent the various parts of the instruction.
39
And this is what's known as assembly language.
40
So we'd code this instruction
41
in assembly language as ADD ESP, 1C.
42
And then we'd use a program called an assembler
43
to convert this mnemonic form back to machine code
44
ready for the computer to execute it.
45
The general model that we can keep in the back of our minds
46
as we program in assembler starts with the processing unit.
47
This works most effectively
48
with its set of high performance registers.
49
However, we often need more
50
than just what can be stored in registers.
51
So we need to have a memory area
52
which can be used to store our data
53
and our program instructions.
54
We want to interact with the program.
55
So we need an input and output device
56
usually a screen and keyboard.
57
Of course, we also have other devices
58
such as track pads and the mouse and then embedded products,
59
we may display to an LED.
60
However these are just variations on the general theme.
61
While the internal memory of a computer
62
gives us what we need to operate, we need more.
63
While internal memory doesn't need to be
64
as fast as registers.
65
It needs to be fast enough.
66
This means it's volatile.
67
So its contents disappear when power is removed.
68
Consequently, we need to also have access
69
to backing storage of some sort.
70
Typically a solid state or magnetic surface hard disk.
71
The size of the instruction does matter.
72
For X 86 much of the assembler code we see
73
is written in 32 bit code.
74
However with the advent of 64 bit processes
75
more extensive instructions have been included
76
in the 64 bit versions of the assembler tools.
77
We'll cover both 32 and 64 bit instructions.
78
Microsoft includes both 32 bit and 64 bit assemblers
79
called ml.exe and ml64.exe
80
in their software development kits.
81
These tools can be accessed via visual studio
82
by including them in a C ++ project
83
or run directly in the command line.
84
The MASM32 SDK is project developed
85
around the Microsoft MASM32 product.
86
Intended as a simpler and easier introduction
87
to the Microsoft MASM32 bit programming environment.
88
And it comes with a simple IDE.
89
GoAsm is a very easy to use set of tools,
90
providing assembly and linking
91
of both 32 and 64 bits assembler programs.
92
We'll be focusing on GoASM
93
as our assembler of choice in this course.
94
We've described a basic architecture
95
with which we can process instructions that work on data.
96
Let's look at the general classes of instructions.
97
The first category of instructions
98
is the load and store instructions,
99
which move data between registers and memory locations.
100
These include basic move and store instructions
101
as well as some more esoteric instructions
102
such as sign extensions and data exchange instructions.
103
The second category is the set of instructions
104
used to add, subtract, multiply, and divide.
105
Which provide the computational capability of the chip.
106
These include signed and unsigned operations
107
Packed Decimal Format operations, floating point operations
108
and increment and decrement operations.
109
The third major category is bit wise or logical operations.
110
These are special forms of manipulation at the bit level
111
such as shifting, adding or calling and so on.
112
And they are used for a variety of purposes
113
including extracting parts of a memory location
114
a process known as masking.
115
The next category is that involving instructions
116
which change the flow of execution of the program.
117
The most basic form of coding is to perform an instruction
118
move to the next sequential instruction location
119
and perform that instruction and so on.
120
However, we also need to make decisions
121
on whether to move to the next instruction
122
or to take an alternative path.
123
We do this using a set of instructions
124
which change the Control flow.
125
This includes if statements,
126
looping instructions and sub program calls.
127
There's also a number of advanced capabilities of the chip
128
including AES hardware capability.
129
Packed decimal 128 bit instructions
130
and 256 and larger vector instructions.
131
We'll cover some of this advanced material in this course
132
but after the course, you might want to check the full range
133
of advanced instructions yourself.
134
With that as an introduction
135
let's get into learning how to write assembly code.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.