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] We've already seen
2
a couple of simple programs in Assembler,
3
so let's look at their structure.
4
In our first MASM program,
5
we can see that we start with an include file
6
from the MASM32 folder.
7
Let's see what this looks like.
8
The file we've included starts after its initial comments
9
by setting some key MASM configuration items.
10
At line 32, we can see the library specifies
11
a 486 architecture,
12
which sets the assembler up for 32 bit code.
13
It uses the flat 32 bit addressing memory model
14
and establishes case sensitivity.
15
It then brings in a set of include files
16
and their corresponding libraries for Windows
17
so that we're ready to make calls
18
to the Windows application programming interface,
19
Note that we have include statements
20
for kernel32.lib and user32.lib.
21
The next thing we see in our MASM program
22
is that our code is divided into two sections.
23
The first starting at line two with a .data declaration
24
and the second starting at line four with .code.
25
At line five, we have the start label
26
and at line eight,
27
the end start statement identifies
28
start as the entry point for the program.
29
So the basic structure for a program
30
is to set up the processor and memory model
31
and bring in any external files,
32
which in this case we do by including masm32rt.inc,
33
define data in a .data segment,
34
define code in the .code segment,
35
and then end the program with the name of the entry point.
36
Let's close the project
37
and select File, New Project.
38
We'll again, make it a MASM project
39
and the classic console application.
40
And we'll take the default name.
41
Easy Code has provided a program skeleton for us.
42
This has a couple of extra sections that we didn't use.
43
The .Const section is used to declare Constance.
44
This allows us to have a named constant
45
rather than just using the value in our code.
46
For instance, we could add a line, answer
47
EQU
48
42,
49
and note that you can also use equal sign instead of EQU,
50
and then at line 18, we can put in mov,
51
eax comma,
52
answer.
53
If we select Build, Compile Project1,
54
it assembles just fine.
55
The data question mark section at line five
56
is used to declare variables
57
that we don't need to initialize.
58
This saves a significant amount of space in the program
59
by not having to carry a pre-initialized data area.
60
The skeleton is designed to allow us to use the Windows API
61
and so starts by making a call at line 13
62
to get module handle,
63
which returns a handle to the program itself
64
in the register Eax.
65
This is then stored in hinst
66
so that we can use it when we need to during our coding.
67
The skeleton code uses an exit process
68
as the preferred method of closing down the program
69
which also ensures any attached DLLs
70
are properly closed down.
71
Setting zero on the exit process
72
indicates that the program is exiting with no errors.
73
Okay, I'll close this project.
74
We'll not be focusing on the intricacies of creating
75
fully featured Windows GUI programs in Assembler,
76
but let's see what the program skeleton looks like
77
when we do elect to build a standard Windows executable.
78
We'll select File, New Project,
79
and we'll select a MASM Windows executable.
80
MASM Windows executable file.
81
The program skeleton is somewhat more complicated
82
as this provides the code necessary to create a window.
83
Note in particular that at line 18
84
it invokes to get command line
85
and then invokes its own WinMain function
86
which appears further down.
87
We'll learn more about Windows calls later in the course.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.