{"id":463,"date":"2009-04-10T18:09:42","date_gmt":"2009-04-10T15:09:42","guid":{"rendered":"http:\/\/pblog.ru\/?p=463"},"modified":"2009-04-12T12:01:24","modified_gmt":"2009-04-12T09:01:24","slug":"slozhenie-vychitanie-i-umnozhenie-na-flat-assembler","status":"publish","type":"post","link":"http:\/\/pblog.ru\/?p=463","title":{"rendered":"\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 Flat Assembler"},"content":{"rendered":"<p>\u041a\u043e\u0434:<\/p>\n<p>format PE GUI 4.0<br \/>\nentry start ;\u0422\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443<br \/>\nINCLUDE &#8216;INCLUDE\\win32ax.inc&#8217;<br \/>\nINCLUDE &#8216;INCLUDE\\encoding\\win1251.inc&#8217;<br \/>\nINCLUDE &#8216;INCLUDE\\api\\user32.inc&#8217;<\/p>\n<p>section &#8216;.data&#8217; data readable writable<\/p>\n<p>formats db &#171;%d&#187;,0<br \/>\nresult db 256 dup(?) ;\u041a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u043e\u043a\u0443, \u0441\u044e\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/p>\n<p>section &#8216;.code&#8217; code readable executable<\/p>\n<p>start:<br \/>\n;\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b 1 \u0438 2<br \/>\nmov eax,1 ;\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0432 eax \u0447\u0438\u0441\u043b\u043e 1<br \/>\nmov edx,2 ;\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0432 edx \u0447\u0438\u0441\u043b\u043e 2<br \/>\nadd eax,edx ;\u0421\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 eax \u0438 edx (1+2). \u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 eax.<br \/>\ninvoke wsprintf,result,formats,eax ;\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0447\u0438\u0441\u043b\u043e(\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442) \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d.<br \/>\ninvoke MessageBox,0,result,&#187;Plus&#187;,MB_OK ;\u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d.<\/p>\n<p>;\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u044f 4 \u0438\u0437 10<br \/>\nmov eax,10 ;\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0432 eax \u0447\u0438\u0441\u043b\u043e 10<br \/>\nmov edx,4 ;\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0432 edx \u0447\u0438\u0441\u043b\u043e 4<br \/>\nsub eax,edx ;\u0412\u044b\u0447\u0438\u0442\u0430\u0435\u043c \u0438\u0437 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e eax edx (10-4). \u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 eax.<br \/>\ninvoke wsprintf,result,formats,eax ;\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0447\u0438\u0441\u043b\u043e(\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442) \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d.<br \/>\ninvoke MessageBox,0,result,&#187;Minus&#187;,MB_OK ;\u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d.<\/p>\n<p>;\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f 2 \u043d\u0430 6<br \/>\nmov ax,2 ;\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0432 ax \u0447\u0438\u0441\u043b\u043e 2<br \/>\nimul ax,6 ;\u0423\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 ax \u043d\u0430 6 (2*6). \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 eax.<br \/>\ninvoke wsprintf,result,formats,eax ;\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0447\u0438\u0441\u043b\u043e(\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442) \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d.<br \/>\ninvoke MessageBox,0,result,&#187;Umnojenie&#187;,MB_OK ;\u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d.<\/p>\n<p>invoke ExitProcess,0 ;\u0412\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/p>\n<p>section &#8216;.idata&#8217; import data readable<\/p>\n<p>library kernel32,&#8217;KERNEL32.DLL&#8217;,user32,&#8217;USER32.DLL&#8217;<br \/>\nINCLUDE &#8216;INCLUDE\\api\\kernel32.inc&#8217;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u043e\u0434: format PE GUI 4.0 entry start ;\u0422\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 INCLUDE &#8216;INCLUDE\\win32ax.inc&#8217; INCLUDE &#8216;INCLUDE\\encoding\\win1251.inc&#8217; INCLUDE &#8216;INCLUDE\\api\\user32.inc&#8217; section &#8216;.data&#8217; data readable writable formats db &#171;%d&#187;,0 result db 256 dup(?) ;\u041a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u043e\u043a\u0443, \u0441\u044e\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 section &#8216;.code&#8217; code readable executable start: ;\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b 1 \u0438 2 mov eax,1 ;\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0432 eax \u0447\u0438\u0441\u043b\u043e [&hellip;]<\/p>\n","protected":false},"author":1204,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[8],"tags":[],"_links":{"self":[{"href":"http:\/\/pblog.ru\/index.php?rest_route=\/wp\/v2\/posts\/463"}],"collection":[{"href":"http:\/\/pblog.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pblog.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pblog.ru\/index.php?rest_route=\/wp\/v2\/users\/1204"}],"replies":[{"embeddable":true,"href":"http:\/\/pblog.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=463"}],"version-history":[{"count":11,"href":"http:\/\/pblog.ru\/index.php?rest_route=\/wp\/v2\/posts\/463\/revisions"}],"predecessor-version":[{"id":500,"href":"http:\/\/pblog.ru\/index.php?rest_route=\/wp\/v2\/posts\/463\/revisions\/500"}],"wp:attachment":[{"href":"http:\/\/pblog.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pblog.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=463"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pblog.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}