All language subtitles for 001 Setting up a program skeleton-en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00.05 --> 00:00:01.04 - [Instructor] We've already seen 2 00:00:01.04 --> 00:00:03.09 a couple of simple programs in Assembler, 3 00:00:03.09 --> 00:00:05.08 so let's look at their structure. 4 00:00:05.08 --> 00:00:07.05 In our first MASM program, 5 00:00:07.05 --> 00:00:09.07 we can see that we start with an include file 6 00:00:09.07 --> 00:00:11.07 from the MASM32 folder. 7 00:00:11.07 --> 00:00:14.01 Let's see what this looks like. 8 00:00:14.01 --> 00:00:17.00 The file we've included starts after its initial comments 9 00:00:17.00 --> 00:00:20.05 by setting some key MASM configuration items. 10 00:00:20.05 --> 00:00:23.05 At line 32, we can see the library specifies 11 00:00:23.05 --> 00:00:25.05 a 486 architecture, 12 00:00:25.05 --> 00:00:28.09 which sets the assembler up for 32 bit code. 13 00:00:28.09 --> 00:00:31.09 It uses the flat 32 bit addressing memory model 14 00:00:31.09 --> 00:00:34.06 and establishes case sensitivity. 15 00:00:34.06 --> 00:00:39.01 It then brings in a set of include files 16 00:00:39.01 --> 00:00:42.01 and their corresponding libraries for Windows 17 00:00:42.01 --> 00:00:43.05 so that we're ready to make calls 18 00:00:43.05 --> 00:00:47.01 to the Windows application programming interface, 19 00:00:47.01 --> 00:00:49.00 Note that we have include statements 20 00:00:49.00 --> 00:00:53.06 for kernel32.lib and user32.lib. 21 00:00:53.06 --> 00:00:55.09 The next thing we see in our MASM program 22 00:00:55.09 --> 00:00:58.08 is that our code is divided into two sections. 23 00:00:58.08 --> 00:01:03.00 The first starting at line two with a .data declaration 24 00:01:03.00 --> 00:01:07.01 and the second starting at line four with .code. 25 00:01:07.01 --> 00:01:09.05 At line five, we have the start label 26 00:01:09.05 --> 00:01:10.04 and at line eight, 27 00:01:10.04 --> 00:01:11.06 the end start statement identifies 28 00:01:11.06 --> 00:01:16.03 start as the entry point for the program. 29 00:01:16.03 --> 00:01:18.06 So the basic structure for a program 30 00:01:18.06 --> 00:01:21.01 is to set up the processor and memory model 31 00:01:21.01 --> 00:01:22.09 and bring in any external files, 32 00:01:22.09 --> 00:01:28.02 which in this case we do by including masm32rt.inc, 33 00:01:28.02 --> 00:01:30.09 define data in a .data segment, 34 00:01:30.09 --> 00:01:33.08 define code in the .code segment, 35 00:01:33.08 --> 00:01:37.03 and then end the program with the name of the entry point. 36 00:01:37.03 --> 00:01:41.04 Let's close the project 37 00:01:41.04 --> 00:01:44.06 and select File, New Project. 38 00:01:44.06 --> 00:01:49.04 We'll again, make it a MASM project 39 00:01:49.04 --> 00:01:52.01 and the classic console application. 40 00:01:52.01 --> 00:01:57.01 And we'll take the default name. 41 00:01:57.01 --> 00:01:59.08 Easy Code has provided a program skeleton for us. 42 00:01:59.08 --> 00:02:03.02 This has a couple of extra sections that we didn't use. 43 00:02:03.02 --> 00:02:06.06 The .Const section is used to declare Constance. 44 00:02:06.06 --> 00:02:09.00 This allows us to have a named constant 45 00:02:09.00 --> 00:02:11.08 rather than just using the value in our code. 46 00:02:11.08 --> 00:02:16.08 For instance, we could add a line, answer 47 00:02:16.08 --> 00:02:18.08 EQU 48 00:02:18.08 --> 00:02:20.03 42, 49 00:02:20.03 --> 00:02:24.00 and note that you can also use equal sign instead of EQU, 50 00:02:24.00 --> 00:02:30.02 and then at line 18, we can put in mov, 51 00:02:30.02 --> 00:02:33.07 eax comma, 52 00:02:33.07 --> 00:02:35.03 answer. 53 00:02:35.03 --> 00:02:38.07 If we select Build, Compile Project1, 54 00:02:38.07 --> 00:02:41.07 it assembles just fine. 55 00:02:41.07 --> 00:02:44.08 The data question mark section at line five 56 00:02:44.08 --> 00:02:46.03 is used to declare variables 57 00:02:46.03 --> 00:02:48.04 that we don't need to initialize. 58 00:02:48.04 --> 00:02:51.05 This saves a significant amount of space in the program 59 00:02:51.05 --> 00:02:55.07 by not having to carry a pre-initialized data area. 60 00:02:55.07 --> 00:02:58.08 The skeleton is designed to allow us to use the Windows API 61 00:02:58.08 --> 00:03:02.08 and so starts by making a call at line 13 62 00:03:02.08 --> 00:03:04.07 to get module handle, 63 00:03:04.07 --> 00:03:06.07 which returns a handle to the program itself 64 00:03:06.07 --> 00:03:09.00 in the register Eax. 65 00:03:09.00 --> 00:03:11.04 This is then stored in hinst 66 00:03:11.04 --> 00:03:15.03 so that we can use it when we need to during our coding. 67 00:03:15.03 --> 00:03:17.07 The skeleton code uses an exit process 68 00:03:17.07 --> 00:03:20.06 as the preferred method of closing down the program 69 00:03:20.06 --> 00:03:23.01 which also ensures any attached DLLs 70 00:03:23.01 --> 00:03:25.02 are properly closed down. 71 00:03:25.02 --> 00:03:27.06 Setting zero on the exit process 72 00:03:27.06 --> 00:03:31.07 indicates that the program is exiting with no errors. 73 00:03:31.07 --> 00:03:36.08 Okay, I'll close this project. 74 00:03:36.08 --> 00:03:39.04 We'll not be focusing on the intricacies of creating 75 00:03:39.04 --> 00:03:42.07 fully featured Windows GUI programs in Assembler, 76 00:03:42.07 --> 00:03:45.02 but let's see what the program skeleton looks like 77 00:03:45.02 --> 00:03:48.06 when we do elect to build a standard Windows executable. 78 00:03:48.06 --> 00:03:54.00 We'll select File, New Project, 79 00:03:54.00 --> 00:03:59.07 and we'll select a MASM Windows executable. 80 00:03:59.07 --> 00:04:07.01 MASM Windows executable file. 81 00:04:07.01 --> 00:04:09.07 The program skeleton is somewhat more complicated 82 00:04:09.07 --> 00:04:14.05 as this provides the code necessary to create a window. 83 00:04:14.05 --> 00:04:16.03 Note in particular that at line 18 84 00:04:16.03 --> 00:04:18.05 it invokes to get command line 85 00:04:18.05 --> 00:04:20.08 and then invokes its own WinMain function 86 00:04:20.08 --> 00:04:23.03 which appears further down. 87 00:04:23.03 --> 00:04:26.04 We'll learn more about Windows calls later in the course. 6876

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.