{"id":387671,"date":"2024-06-29T07:27:32","date_gmt":"2024-06-29T07:27:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=387671"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=387671","title":{"rendered":"<span>\u041f\u0438\u0448\u0435\u043c \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0438\u0437 \u0438\u0433\u0440\u044b Clock Tower (PS1\/PC) \u0434\u043b\u044f IDA Pro<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0422\u0443\u0442 \u0442\u0430\u043a\u043e\u0435 \u0434\u0435\u043b\u043e: \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u043c\u043e\u044f \u0440\u0435\u0432\u0435\u0440\u0441\u0435\u0440\u0441\u043a\u0430\u044f \u043c\u0435\u0447\u0442\u0430 \u0441\u0431\u044b\u043b\u0430\u0441\u044c &#8212; \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f <em>IDA Pro<\/em> \u0441 \u043d\u0443\u043b\u044f, \u0437\u0430 \u0434\u0432\u0430 \u0434\u043d\u044f! \u0415\u0441\u043b\u0438 \u0432\u044b \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0442\u043e\u0436\u0435 \u0445\u043e\u0442\u0435\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u043d\u043e \u0431\u043e\u044f\u043b\u0438\u0441\u044c \u043d\u0430\u0447\u0430\u0442\u044c &#8212; \u0434\u0443\u043c\u0430\u044e, \u043c\u043e\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u0438\u0437\u0430\u0441\u0435\u043c\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a\u043e\u0434 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0438\u0437 \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u0442\u043e\u0433\u043e \u0445\u043e\u0440\u0440\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0445\u043e\u0434\u0438\u043b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430 <em>SNES<\/em>, \u043f\u043e\u0442\u043e\u043c \u043d\u0430 <em>PS1<\/em>, <em>PC<\/em> \u0438 <em>Wonderswan<\/em> &#8212; &#171;<em>Clock Tower &#8212; The First Fear<\/em>&#171;. \u0412 \u0438\u0433\u0440\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f <em>9<\/em> \u043a\u043e\u043d\u0446\u043e\u0432\u043e\u043a (<em>sic!<\/em>), \u0430\u0442\u043c\u043e\u0441\u0444\u0435\u0440\u0430 \u0433\u043d\u0435\u0442\u0443\u0449\u0430\u044f, \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0437\u043b\u043e\u0434\u0435\u044f \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 &#171;<em>Scissorman<\/em>&#187; (\u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0441 \u0440\u0443\u043a\u0430\u043c\u0438-\u043d\u043e\u0436\u043d\u0438\u0446\u0430\u043c\u0438). \u0417\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b? \u0422\u043e\u0433\u0434\u0430 \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c&#8230;<\/p>\n<figure class=\"bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1ae\/9e2\/3e7\/1ae9e23e78b00ceab2dd7eb6250ba974.png\" width=\"549\" height=\"491\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1ae\/9e2\/3e7\/1ae9e23e78b00ceab2dd7eb6250ba974.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u041e \u0441\u0430\u043c\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435<\/h3>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u0430\u043c \u043a\u043e\u0434, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0439 \u043e\u043f\u043a\u043e\u0434\u044b \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b, \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043d\u043e, \u0432\u043e\u0442 \u043a\u0440\u0430\u0442\u043a\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043d\u0451\u043c:<\/p>\n<ul>\n<li>\n<p><em>115<\/em> \u043e\u043f\u043a\u043e\u0434\u043e\u0432 \u043d\u0430 \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0436\u0438\u0437\u043d\u0438<\/p>\n<\/li>\n<li>\n<p>\u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 <em>VM<\/em> \u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f <em>PS1<\/em> \u0438 <em>PC<\/em>, \u043d\u0430 <em>SNES<\/em> \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043d\u0435\u0442<\/p>\n<\/li>\n<li>\n<p>\u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440-\u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0434\u043b\u044f <em>Ghidra<\/em> (\u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438)<\/p>\n<\/li>\n<\/ul>\n<figure class=\"bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6b9\/3db\/93a\/6b93db93a82dc9b2062d2f94d68eddd7.png\" width=\"524\" height=\"692\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6b9\/3db\/93a\/6b93db93a82dc9b2062d2f94d68eddd7.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h3>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043a\u043e\u0434\u0430. \u042f \u043f\u0438\u0441\u0430\u043b \u0432 <em>Visual Studio<\/em> \u043d\u0430 <em>C\/C++<\/em>, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043d\u0430 <em>Python<\/em>.<\/p>\n<h4>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h4>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0443\u0441\u0442\u043e\u044f\u0432\u0448\u0438\u043c\u0441\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0434\u043b\u044f <em>IDA Pro<\/em> (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <em>IDA SDK<\/em>), \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u043a\u0430 \u0435\u0449\u0451 \u043f\u0443\u0441\u0442\u044b\u0435 \u0444\u0430\u0439\u043b\u044b:<\/p>\n<p>\u0418\u043d\u043a\u043b\u0443\u0434\u044b:<\/p>\n<ul>\n<li>\n<p><code>cpu_name.hpp<\/code> (\u0433\u0434\u0435 <em>cpu_name<\/em> &#8212; \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u0438\u043c\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f, \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e <em>adc<\/em>)<\/p>\n<\/li>\n<li>\n<p><code>ins.hpp<\/code> (\u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c <em>enum<\/em> \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0432\u0441\u0435\u0445 \u043e\u043f\u043a\u043e\u0434\u043e\u0432)<\/p>\n<\/li>\n<\/ul>\n<p>\u0424\u0430\u0439\u043b\u044b \u0441 \u043a\u043e\u0434\u043e\u043c:<\/p>\n<ul>\n<li>\n<p><code>ana.cpp<\/code> (\u0437\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043a\u043e\u0434 <em>\u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/em> (<s>\u0445\u043e\u0440\u043e\u0448\u043e, \u0447\u0442\u043e \u043d\u0435 \u043a\u0430\u043a \u0443 radare2 &#8212; anal<\/s>)<\/p>\n<\/li>\n<li>\n<p><code>emu.cpp<\/code> (\u0441\u044e\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 <em>\u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430<\/em>)<\/p>\n<\/li>\n<li>\n<p><code>ins.cpp<\/code> (<em>\u0438\u043c\u0435\u043d\u0430 \u043e\u043f\u043a\u043e\u0434\u043e\u0432<\/em> \u0438 \u0438\u0445 <em>feature-\u0444\u043b\u0430\u0433\u0438<\/em> &#8212; \u0437\u0434\u0435\u0441\u044c)<\/p>\n<\/li>\n<li>\n<p><code>out.cpp<\/code> (\u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0441\u0430\u043c <em>\u0432\u044b\u0432\u043e\u0434<\/em> \u043c\u043d\u0435\u043c\u043e\u043d\u0438\u043a\/\u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432 \u0438 \u043f\u0440\u043e\u0447\u0435\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u043a\u0438, \u0442\u0438\u043f\u0430 \u0437\u0430\u043f\u044f\u0442\u044b\u0445, \u0441\u043a\u043e\u0431\u043e\u043a \u0438 \u0442.\u0434.)<\/p>\n<\/li>\n<li>\n<p><code>reg.cpp<\/code> (\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b, \u043d\u043e \u043d\u0435\u0442 &#8212; \u044d\u0442\u043e \u043f\u0440\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u043c\u043e\u0434\u0443\u043b\u044f, \u0435\u0433\u043e \u0444\u043b\u0430\u0433\u0438 \u0438 \u043f\u0440\u043e\u0447\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e. \u0418\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c <em>\u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f<\/em> \u043c\u043e\u0434\u0443\u043b\u044c)<\/p>\n<\/li>\n<\/ul>\n<figure class=\"bordered\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/395\/5de\/640\/3955de64004f20bc79573852f2b766f6.png\" width=\"285\" height=\"373\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/395\/5de\/640\/3955de64004f20bc79573852f2b766f6.png\"\/><figcaption><\/figcaption><\/figure>\n<h4>\u041e\u0431 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0435, \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 \u0438 \u0432\u044b\u0432\u043e\u0434\u0435<\/h4>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0449\u0435 \u0431\u044b\u043b\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438, \u0441\u0442\u043e\u0438\u0442 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0436\u0435 \u0442\u0430\u043a\u043e\u0435 <em>\u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440<\/em> (<em>ana<\/em>), <em>\u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440<\/em> (<em>emu<\/em>) \u0438 <em>\u0432\u044b\u0432\u043e\u0434<\/em> (<em>out<\/em>). \u041d\u0430\u0447\u043d\u0451\u043c \u0441 <em>ana<\/em>.<\/p>\n<p><strong>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 (ana)<\/strong><\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0438 <em>\u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/em>: \u0447\u0442\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u043a\u043e\u0434\u043e\u0432 \u0438 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432 \u0434\u043b\u044f \u043d\u0438\u0445. \u041e\u0431\u044b\u0447\u043d\u043e, \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: \u0447\u0438\u0442\u0430\u0435\u043c \u0431\u0430\u0439\u0442\/\u0432\u043e\u0440\u0434\/\u0434\u0432\u043e\u0440\u0434, \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u043e\u043f\u043a\u043e\u0434\u043e\u0432, \u0437\u0430\u0442\u0435\u043c \u0447\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0430 (\u0438\u043d\u0434\u0435\u043a\u0441 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\/\u0430\u0434\u0440\u0435\u0441 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438\/\u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u044b\u0436\u043a\u0430 \u0438 \u0442.\u043f.). \u041f\u043e\u043a\u0430 \u0447\u0438\u0442\u0430\u0435\u043c, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0434\u043b\u0438\u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438.<\/p>\n<p><strong>\u042d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 (emu)<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0432 \u0434\u0435\u043b\u043e \u0432\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440. \u0415\u0433\u043e \u0437\u0430\u0434\u0430\u0447\u0430: \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043e\u043a \u0438 \u043f\u043e\u0441\u0442-\u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430. \u0421\u0441\u044b\u043b\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 <em>return<\/em>, <em>jump<\/em> \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438: \u0447\u0442\u0435\u043d\u0438\u0435\/\u0437\u0430\u043f\u0438\u0441\u044c\/\u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430 \u0441\u0442\u0435\u043a \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0434 \u043f\u043e\u0441\u0442-\u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043f\u043e\u0440\u0442\u043e\u0432, \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438. \u0415\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 \u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432, \u0433\u0434\u0435 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\/\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<\/p>\n<p><strong>\u0412\u044b\u0432\u043e\u0434 (out)<\/strong><\/p>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u0442\u0430\u043f \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f &#8212; \u043a\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u0445 (<em>out<\/em>). \u0414\u0430\u043d\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0418\u0434\u043e\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0430. \u0418 \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u043a\u0440\u043e\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430, \u043f\u043e\u0447\u0435\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0413\u0438\u0434\u0440\u044b \u0443\u043c\u0435\u0435\u0442 \u0432 \u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438, \u0430 \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u0437 \u0418\u0434\u044b &#8212; \u043d\u0435\u0442. \u0412\u044b\u0432\u043e\u0434\u0438\u043b\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 &#8212; \u044d\u0442\u043e, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043f\u0440\u043e\u0441\u0442\u0430\u044f <em>printf<\/em> \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u044b \u0435\u0439 \u0443\u043a\u0430\u0436\u0435\u0442\u0435, \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0442\u0441\u0442\u0443\u043f\u044b, \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0446\u0432\u0435\u0442\u043d\u044b\u043c \u0438 \u0442.\u0434. \u041d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0442\u0435\u0431\u0435 IR (<em>Intermediate Representation<\/em>). \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0448\u044c \u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0434\u043b\u044f \u044d\u043a\u0437\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u0443 \u0442\u0435\u0431\u044f \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:<\/p>\n<ol>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>Ghidra<\/em><\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>Ghidra<\/em>. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u043e\u0449\u0440\u044f\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <em>\u0412\u044b\u0432\u043e\u0434<\/em>. \u0413\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b, \u043a\u0430\u043a\u043e\u0432\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <em>VM<\/em> \u0438\u0437 <em>Clock Tower<\/em>, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043f\u0441\u0435\u0432\u0434\u043e-\u0441\u0438\u0448\u043d\u044b\u0439 \u043a\u043e\u0434 (\u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442). \u042f \u0442\u0430\u043a \u0438 \u0441\u0434\u0435\u043b\u0430\u043b.<\/p>\n<h3>\u041f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c<\/h3>\n<p>\u0425\u0432\u0430\u0442\u0438\u0442 \u0440\u0430\u0437\u0433\u043b\u0430\u0433\u043e\u043b\u044c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0436\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <em>Visual Studio<\/em>, \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 <em>DLL<\/em>, \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u0438 \u043a \u0438\u043d\u043a\u043b\u0443\u0434\u0430\u043c \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c <em>IDA SDK<\/em>. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b (\u0432\u0441\u0435 \u0442\u0440\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438):<\/p>\n<pre><code class=\"cpp\">__NT__ __IDP__ __X64__<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0418\u0434\u043e\u0439 \u0441 64-\u0431\u0438\u0442\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043d\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e\u043c, \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0444\u043b\u0430\u0433:<\/p>\n<pre><code class=\"cpp\">__EA64__<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <code>reg.cpp<\/code> \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0431\u043b\u043e\u043d:<\/p>\n<pre><code class=\"cpp\">#include \"adc.hpp\" \/\/ your main VM include  processor_t LPH = {   IDP_INTERFACE_VERSION,   0x8000 + 666, \/\/ proc ID   PR_USE32 | PR_DEFSEG32 | PRN_HEX | PR_WORD_INS | PR_BINMEM | PR_NO_SEGMOVE | PR_CNDINSNS, \/\/ flags   0, \/\/ flags2   8, 8, \/\/ bits in a byte (code\/data)   shnames, \/\/ short processor names   lnames, \/\/ long processor names   asms, \/\/ assembler definitions    notify, \/\/ callback to create our proc module instance    regnames, \/\/ register names   qnumber(regnames), \/\/ registers count    rVcs, rVds, \/\/ number of first\/last segment register   0, \/\/ segment register size   rVcs, rVds, \/\/ virtual code\/data segment register    NULL, \/\/ typical code start sequences   retcodes, \/\/ return opcodes bytes    0, ADCVM_last, \/\/ indices of first\/last opcodes (in enum)   Instructions, \/\/ array of instructions };<\/code><\/pre>\n<p>\u0412 \u0444\u0430\u0439\u043b <code>adc.hpp<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0438\u043d\u043a\u043b\u0443\u0434\u044b:<\/p>\n<pre><code class=\"cpp\">#pragma once  #include \"..\/idaidp.hpp\" \/\/ this file is located in IDA_SDK\/module\/ dir #include \"ins.hpp\"<\/code><\/pre>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432 \u0437\u0434\u0435\u0441\u044c <em>3<\/em>:<\/p>\n<ol>\n<li>\n<p><code>proc ID<\/code> &#8212; \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u0412\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u043d\u043e\u043c\u0435\u0440 >= <em>0x8000<\/em><\/p>\n<\/li>\n<li>\n<p><code>\u0424\u043b\u0430\u0433\u0438<\/code> &#8212; \u0438\u0445 \u043c\u043d\u043e\u0433\u043e, \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u043d\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u043d\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u0421\u043f\u0438\u0441\u043e\u043a \u0444\u043b\u0430\u0433\u043e\u0432 \u0438 \u0438\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f <a href=\"https:\/\/hex-rays.com\/products\/ida\/support\/sdkdoc\/group___p_r__.html\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a><\/p>\n<\/li>\n<li>\n<p><code>rVcs<\/code>\/<code>rVds<\/code> &#8212; \u0432 \u043c\u043e\u0435\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f, \u043d\u043e \u0418\u0434\u0435 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b. \u0418\u043c\u0438 \u043c\u044b \u0437\u0430\u0439\u043c\u0451\u043c\u0441\u044f \u043f\u043e\u0437\u0434\u043d\u0435\u0435<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0438\u0434\u0451\u0442 <code>shnames<\/code>:<\/p>\n<pre><code class=\"cpp\">static const char* const shnames[] = { \"ADCVM\", NULL };<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u0448 \u043c\u043e\u0434\u0443\u043b\u044c (\u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c <code>NULL<\/code>.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u043c <code>lnames<\/code>:<\/p>\n<pre><code class=\"cpp\">static const char* const lnames[] = { \"Clock Tower: Clock Tower ADC VM\", NULL };<\/code><\/pre>\n<p>\u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0438\u043c\u044f. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u0430\u043c\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 &#8212; \u0432\u0441\u0451, \u0447\u0442\u043e \u0432 \u043d\u0435\u0439 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043e \u0434\u043e \u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u044f, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <em>\u0438\u043c\u0435\u043d\u0435\u043c \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432<\/em>. \u0418\u0442\u043e\u0433\u043e, \u0432\u0441\u044f \u044d\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432 \u0418\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<figure class=\"bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cfb\/4e7\/228\/cfb4e7228d28549e7a83fdb8ef2e485e.png\" width=\"653\" height=\"520\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cfb\/4e7\/228\/cfb4e7228d28549e7a83fdb8ef2e485e.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043d\u043e\u0433\u0438\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u044f \u043a\u043e\u0433\u0434\u0430-\u0442\u043e) &#8212; \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430. \u0427\u0442\u043e \u043e\u043d \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u0418\u0434\u044b? \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u0438, \u044d\u0442\u043e &#8212; \u0441\u043e\u043b\u044f\u043d\u043a\u0430 \u0438\u0437 \u043d\u0438\u043a\u0435\u043c \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0438 \u043d\u0438\u043a\u043e\u043c\u0443 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u0441\u0430\u043c\u043e\u0439 \u0418\u0434\u043e\u0439 (\u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435) \u0431\u0435\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u0438\u044f. \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u044d\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432 (\u0442\u0438\u043f\u0430: <code>org<\/code>, <code>end<\/code>, <code>equ<\/code>, <code>public<\/code>, <code>xref<\/code>).<\/p>\n<p>\u041d\u0443\u0436\u043d\u044b \u043e\u043d\u0438, \u0438\u043b\u0438 \u043d\u0435\u0442, \u0430 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f. \u041b\u0443\u0447\u0448\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u044f\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0438\u0437 \u043a\u0430\u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c <em>SDK<\/em>-\u0448\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c. \u0423 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"cpp\">static const asm_t adcasm = {   AS_COLON | ASH_HEXF3,   0,   \"Clock Tower Virtual Machine Bytecode\",   0,   NULL,         \/\/ header lines   \"org\",        \/\/ org   \"end\",        \/\/ end    \";\",          \/\/ comment string   '\"',          \/\/ string delimiter   '\\'',         \/\/ char delimiter   \"\\\"'\",        \/\/ special symbols in char and string constants    \"dc\",         \/\/ ascii string directive   \"dcb\",        \/\/ byte directive   \"dc\",         \/\/ word directive   NULL,         \/\/ double words   NULL,         \/\/ qwords   NULL,         \/\/ oword  (16 bytes)   NULL,         \/\/ float  (4 bytes)   NULL,         \/\/ double (8 bytes)   NULL,         \/\/ tbyte  (10\/12 bytes)   NULL,         \/\/ packed decimal real   \"bs#s(c,) #d, #v\", \/\/ arrays (#h,#d,#v,#s(...)   \"ds %s\",      \/\/ uninited arrays   \"equ\",        \/\/ equ   NULL,         \/\/ 'seg' prefix (example: push seg seg001)   \"*\",          \/\/ current IP (instruction pointer)   NULL,         \/\/ func_header   NULL,         \/\/ func_footer   \"global\",     \/\/ \"public\" name keyword   NULL,         \/\/ \"weak\"   name keyword   \"xref\",       \/\/ \"extrn\"  name keyword                 \/\/ .extern directive requires an explicit object size   NULL,         \/\/ \"comm\" (communal variable)   NULL,         \/\/ get_type_name   NULL,         \/\/ \"align\" keyword   '(', ')',     \/\/ lbrace, rbrace   \"%\",          \/\/ mod   \"&amp;\",          \/\/ and   \"|\",          \/\/ or   \"^\",          \/\/ xor   \"!\",          \/\/ not   \"&lt;&lt;\",         \/\/ shl   \">>\",         \/\/ shr   \"sizeof\",         \/\/ sizeof   AS2_BYTE1CHAR,\/\/ One symbol per processor byte };<\/code><\/pre>\n<p>\u0418\u0437 \u0432\u0441\u0435\u0433\u043e, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u043b\u0430\u0433\u0438 (\u043e\u043d\u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0437\u0430 \u0442\u043e, \u043a\u0430\u043a \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0447\u0438\u0441\u043b\u0430, \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f), \u0438 \u0438\u043c\u044f \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <code>asm_t<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/hex-rays.com\/products\/ida\/support\/sdkdoc\/structasm__t.html\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u043d\u0443 \u0430 \u043c\u044b \u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, <code>notify<\/code>-\u043a\u043e\u043b\u0431\u044d\u043a \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0418\u0434\u0435. \u0421\u043c\u044b\u0441\u043b\u0430 \u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u043a\u043e\u0434 \u043d\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0435\u0440\u0451\u043c \u043a\u0430\u043a \u0435\u0441\u0442\u044c:<\/p>\n<pre><code class=\"cpp\">static int data_id;  ssize_t idaapi notify(void* user_data, int notification_code, va_list va) {   if (notification_code == processor_t::ev_get_procmod) {     data_id = 0;     return size_t(SET_MODULE_DATA(adcvm_t));   }    return 0; }<\/code><\/pre>\n<p>\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e <code>adcvm_t<\/code> \u043d\u0430 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0432\u0430\u0448\u0435\u0433\u043e \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u0422\u0430\u043a\u0436\u0435, \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043c\u0430\u043a\u0440\u043e\u0441 <code>SET_MODULE_DATA<\/code>. \u041e\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>set_module_data<\/code> \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430. \u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 <code>int data_id;<\/code>.  \u0422\u0443\u0448\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044f \u0437\u0430\u0439\u043c\u0451\u043c\u0441\u044f \u0447\u0443\u0442\u043e\u0447\u043a\u0443 \u043f\u043e\u0437\u0436\u0435, \u0430 \u043f\u043e\u043a\u0430 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u043c.<\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0438\u0437 <em>Clock Tower<\/em>, \u0432\u043c\u0435\u0441\u0442\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441\u0430 \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 (<em>work<\/em>) \u043f\u0430\u043c\u044f\u0442\u0438. \u041d\u043e \u0418\u0434\u0430, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0438 \u0445\u043e\u0447\u0435\u0442 \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 <code>cs<\/code> \u0438 <code>ds<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, <code>regnames<\/code> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">static const char* const regnames[] = {   \"cs\", \"ds\" };<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u043c\u0435\u0441\u0442\u043e <code>NULL<\/code> \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u043f\u0438\u0441\u043a\u0430, \u0418\u0434\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043c\u0430\u043a\u0440\u043e\u0441: <code>qnumber(regnames)<\/code>. \u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c enum \u0441 \u0441\u0430\u043c\u0438\u043c\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u043c\u0438 (\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u0442):<\/p>\n<pre><code class=\"cpp\">static enum adcvm_regs {   rVcs, rVds };<\/code><\/pre>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u044d\u0442\u043e\u0433\u043e <em>enum<\/em>-\u0430  \u043c\u044b \u0438 \u0441\u043e\u0441\u043b\u0430\u043b\u0438\u0441\u044c \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435. \u0421 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u043c\u0438 \u043f\u043e\u043a\u043e\u043d\u0447\u0435\u043d\u043e, \u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u043f\u043e\u043c\u043e\u0449\u0438 \u0418\u0434\u0435 \u0432 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0438 \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u0443\u0447\u0430\u0441\u0442\u043a\u043e\u0432 \u043a\u043e\u0434\u0430. \u041f\u0440\u043e\u043b\u043e\u0433\u043e\u0432 \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c <code>NULL<\/code>, \u0430 \u0432\u043e\u0442 \u043a\u043e\u0434\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0435\u0441\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0438\u0448\u0435\u043c:<\/p>\n<pre><code class=\"cpp\">static const uchar retcode[] = { 0x00, 0xFF };  static const bytes_t retcodes[] = {   { sizeof(retcode), retcode },   { 0, NULL } };<\/code><\/pre>\n<p>\u0412 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u043e\u0439 \u043c\u043d\u043e\u0439 <em>VM<\/em>, \u0432\u0441\u0435 \u043e\u043f\u043a\u043e\u0434\u044b \u0438\u043c\u0435\u044e\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043b\u0438\u043d\u0443 \u0434\u0432\u0430 \u0431\u0430\u0439\u0442\u0430, \u0430 \u043a\u043e\u0434 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <code>return<\/code> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>{ 0x00, 0xFF }<\/code>. \u0418\u0442\u0430\u043a, \u043c\u044b \u043f\u043b\u0430\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u043a \u0441\u0430\u043c\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c.<\/p>\n<h4>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/h4>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u043e\u043f\u043a\u043e\u0434\u043e\u0432 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 <em>Clock Tower VM<\/em> \u0440\u043e\u0432\u043d\u043e <em><u>115<\/u><\/em>. \u0418\u0445 \u0438\u043c\u0435\u043d\u0430 \u0431\u044b\u043b\u0438 \u0437\u0430\u0431\u043e\u0442\u043b\u0438\u0432\u043e \u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438 \u043f\u0440\u044f\u043c\u043e \u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 (\u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0432 \u0438\u0442\u043e\u0433\u0435 \u0432\u044b\u043f\u0438\u043b\u0435\u043d). \u0412 \u043e\u0431\u0449\u0435\u043c, \u0431\u0435\u0440\u0451\u043c \u044d\u0442\u0438 \u0438\u043c\u0435\u043d\u0430, \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a \u043d\u0438\u043c \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u0432 \u0432\u0438\u0434\u0435 \u0438\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f: <code>ADCVM<\/code>, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c <em>enum<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 <code>ins.hpp<\/code>. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0438\u043c\u0435\u0435\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u043f\u043e\u0440\u0442\u044f\u043d\u043a\u0443:<\/p>\n<details class=\"spoiler\">\n<summary>\u041c\u043e\u0439 ins.hpp<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#pragma once  extern const instruc_t Instructions[]; \/\/ to reference it from reg.cpp  enum nameNum {   ADCVM_null = 0,   ADCVM_ret,   ADCVM_div,   ADCVM_mul,   ADCVM_sub,   ADCVM_add,   ADCVM_dec,   ADCVM_inc,   ADCVM_mov,   ADCVM_equ,   ADCVM_neq,   ADCVM_gre,   ADCVM_lwr,   ADCVM_geq,   ADCVM_leq,   ADCVM_cmp_end,   ADCVM_allend,   ADCVM_jmp,   ADCVM_call,   ADCVM_evdef,   ADCVM_end,   ADCVM_if,   ADCVM_while,   ADCVM_nop,   ADCVM_endif,   ADCVM_endwhile,   ADCVM_else,   ADCVM_msginit,   ADCVM_msgattr,   ADCVM_msgout,   ADCVM_setmark,   ADCVM_msgwait,   ADCVM_evstart,   ADCVM_bgload,   ADCVM_palload,   ADCVM_bgmreq,   ADCVM_sprclr,   ADCVM_absobjanim,   ADCVM_objanim,   ADCVM_allsprclr,   ADCVM_msgclr,   ADCVM_screenclr,   ADCVM_screenon,   ADCVM_screenoff,   ADCVM_screenin,   ADCVM_screenout,   ADCVM_bgdisp,   ADCVM_bganim,   ADCVM_bgscroll,   ADCVM_palset,   ADCVM_bgwait,   ADCVM_wait,   ADCVM_bwait,   ADCVM_boxfill,   ADCVM_bgclr,   ADCVM_setbkcol,   ADCVM_msgcol,   ADCVM_msgspd,   ADCVM_mapinit,   ADCVM_mapload,   ADCVM_mapdisp,   ADCVM_sprent,   ADCVM_setproc,   ADCVM_sceinit,   ADCVM_userctl,   ADCVM_mapattr,   ADCVM_mappos,   ADCVM_sprpos,   ADCVM_spranim,   ADCVM_sprdir,   ADCVM_gameinit,   ADCVM_continit,   ADCVM_sceend,   ADCVM_mapscroll,   ADCVM_sprlmt,   ADCVM_sprwalkx,   ADCVM_allsprdisp,   ADCVM_mapwrt,   ADCVM_sprwait,   ADCVM_sereq,   ADCVM_sndstop,   ADCVM_sestop,   ADCVM_bgmstop,   ADCVM_doornoset,   ADCVM_rand,   ADCVM_btwait,   ADCVM_fawait,   ADCVM_sclblock,   ADCVM_evstop,   ADCVM_sereqpv,   ADCVM_sereqspr,   ADCVM_scereset,   ADCVM_bgsprent,   ADCVM_bgsprpos,   ADCVM_bgsprset,   ADCVM_slantset,   ADCVM_slantclr,   ADCVM_dummy,   ADCVM_spcfunc,   ADCVM_sepan,   ADCVM_sevol,   ADCVM_bgdisptrn,   ADCVM_debug,   ADCVM_trace,   ADCVM_tmwait,   ADCVM_bgspranim,   ADCVM_abssprent,   ADCVM_nextcom,   ADCVM_workclr,   ADCVM_bgbufclr,   ADCVM_absbgsprent,   ADCVM_aviplay,   ADCVM_avistop,   ADCVM_sprmark,   ADCVM_bgmattr,   ADCVM_last, \/\/ required item }; <\/code><\/pre>\n<\/div>\n<\/details>\n<h4>ins.cpp<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0441\u0430\u043c\u0430\u044f \u043c\u0443\u0442\u043e\u0440\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0451\u043d\u043a\u0430, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e &#8212; \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u043c\u0451\u043d \u043e\u043f\u043a\u043e\u0434\u043e\u0432 \u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 <em>feature-\u0444\u043b\u0430\u0433\u043e\u0432<\/em> \u0434\u043b\u044f \u043d\u0438\u0445 (\u0447\u0442\u043e \u044d\u0442\u043e &#8212; \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u043e\u0437\u0434\u043d\u0435\u0435). \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <code>ins.cpp<\/code>, \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0431\u043b\u043e\u043d, \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c:<\/p>\n<pre><code class=\"cpp\">#include \"adc.hpp\" \/\/ your main VM include  const instruc_t Instructions[] = {   { \"\", 0 }, \/\/ dummy empty instruction };  CASSERT(qnumber(Instructions) == ADCVM_last);<\/code><\/pre>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <em>instruc_t<\/em> \u0441 \u043f\u043e\u043b\u044f\u043c\u0438: <em>\u0438\u043c\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/em>, <em>feature-\u0444\u043b\u0430\u0433\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/em>.<\/p>\n<p><em>Feature-\u0444\u043b\u0430\u0433\u0438<\/em> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043d\u0430 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435, \u0442\u0438\u043f\u0430:<\/p>\n<ol>\n<li>\n<p><code>CF_STOP<\/code> &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e<\/p>\n<\/li>\n<li>\n<p><code>CF_USE1<\/code>&#8212;<code>CF_USE8<\/code> &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u044b 1-8<\/p>\n<\/li>\n<li>\n<p><code>CF_CHG1<\/code>&#8212;<code>CF_CHG8<\/code> &#8212; \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u044b 1-8<\/p>\n<\/li>\n<li>\n<p><code>CF_CALL<\/code> &#8212; \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><code>CF_JUMP<\/code> &#8212; \u043f\u0440\u044b\u0436\u043e\u043a \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e<\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435, \u0447\u0442\u043e \u044d\u0442\u0438 \u0444\u043b\u0430\u0433\u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u0418\u0434\u0435 (<em>\u0430 \u0437\u0430\u0447\u0435\u043c, \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043c\u044b \u0438\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c?<\/em>). \u041e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u043c\u0438 (\u0434\u0430\u043b\u0435\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e), \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0434\u0430\u043d\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0431\u043b\u044e\u0441\u0442\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0432\u043e\u0442 \u0432\u0430\u043c \u043f\u0430\u0440\u043e\u0447\u043a\u0430 &#171;<em>\u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0445<\/em>&#187; \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0438 \u0438\u0445 \u0444\u043b\u0430\u0433\u043e\u0432:<\/p>\n<pre><code class=\"cpp\">{ \"return\", CF_STOP },<\/code><\/pre>\n<pre><code class=\"cpp\">{ \"jmp\", CF_USE1 | CF_JUMP | CF_STOP },<\/code><\/pre>\n<pre><code class=\"cpp\">{ \"call\", CF_USE1 | CF_JUMP | CF_CALL },<\/code><\/pre>\n<pre><code class=\"cpp\">{ \"mul\", CF_USE1 | CF_USE2 | CF_CHG1 },<\/code><\/pre>\n<p>\u0414\u0443\u043c\u0430\u044e, \u0444\u043b\u0430\u0433\u0438 \u0432 \u044d\u0442\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0441\u0430\u043c\u0438 \u0437\u0430 \u0441\u0435\u0431\u044f. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432 \u043d\u0435\u0442, \u0432\u043c\u0435\u0441\u0442\u043e \u0444\u043b\u0430\u0433\u043e\u0432 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c <code>0<\/code>.<\/p>\n<h4>\u041a\u043b\u0430\u0441\u0441 procmod_t<\/h4>\n<p>\u041f\u043e\u043a\u043e\u043d\u0447\u0438\u0432 \u0441 \u0440\u0443\u0442\u0438\u043d\u043e\u0439 \u0432 \u0432\u0438\u0434\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u044f\u0434\u0440\u043e\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <code>adc.hpp<\/code> \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u043a\u043b\u0443\u0434\u043e\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0431\u043b\u043e\u043d:<\/p>\n<pre><code class=\"cpp\">struct adcvm_t : public procmod_t {   virtual ssize_t idaapi on_event(ssize_t msgid, va_list va) override;   int idaapi ana(insn_t* _insn);   int idaapi emu(const insn_t&amp; insn) const;   void handle_operand(const insn_t&amp; insn, const op_t&amp; op, bool isload) const; };<\/code><\/pre>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u0441\u0451 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u0439\u0442\u0438\u043a\u043e\u0432 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0432 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 (<em>\u0430 \u043c\u043e\u0436\u043d\u043e \u0438 \u043f\u0441\u0435\u0432\u0434\u043e-\u0441\u0438\u0448\u043d\u044b\u0439<\/em>) \u043b\u0438\u0441\u0442\u0438\u043d\u0433.  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <code>reg.cpp<\/code>, \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cpp\">ssize_t idaapi adcvm_t::on_event(ssize_t msgid, va_list va) {   int retcode = 1;    switch (msgid) {   case processor_t::ev_init: {     inf_set_be(false); \/\/ our vm uses little endian     inf_set_gen_lzero(true); \/\/ we want to align every hex-value with zeroes   } break;   case processor_t::ev_term: {     clr_module_data(data_id);   } break;   case processor_t::ev_newfile: {     auto* fname = va_arg(va, char*); \/\/ here we can load additional data from a current dir   } break;   case processor_t::ev_is_cond_insn: {     const auto* insn = va_arg(va, const insn_t*);     return is_cond_insn(insn->itype);   } break;   case processor_t::ev_is_ret_insn: {     const auto* insn = va_arg(va, const insn_t*);     return (insn->itype == ADCVM_ret) ? 1 : -1;   } break;   case processor_t::ev_is_call_insn: {     const auto* insn = va_arg(va, const insn_t*);     return (insn->itype == ADCVM_call) ? 1 : -1;   } break;   case processor_t::ev_ana_insn: {     auto* out = va_arg(va, insn_t*);     return ana(out);   } break;   case processor_t::ev_emu_insn: {     const auto* insn = va_arg(va, const insn_t*);     return emu(*insn);   } break;   case processor_t::ev_out_insn: {     auto* ctx = va_arg(va, outctx_t*);     out_insn(*ctx);   } break;   case processor_t::ev_out_operand: {     auto* ctx = va_arg(va, outctx_t*);     const auto* op = va_arg(va, const op_t*);     return out_opnd(*ctx, *op) ? 1 : -1;   } break;   default:     return 0;   }    return retcode; }<\/code><\/pre>\n<p>\u0418\u043c\u0435\u043d\u0430 \u0438\u0432\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0448 \u043a\u043e\u043b\u0431\u044d\u043a \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f\u0449\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0430\u0437\u0431\u0435\u0440\u0443 \u043b\u0438\u0448\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445:<\/p>\n<ol>\n<li>\n<p><code>ev_init<\/code> &#8212; \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0437\u0430\u0434\u0430\u0451\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u0434\u0430\u0442\u044c \u0444\u043b\u0430\u0433\u0430\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u0430\u0439\u0442 (<em>endianness<\/em>)<\/p>\n<\/li>\n<li>\n<p><code>ev_term<\/code> &#8212; \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0448\u043b\u043e \u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c<code>clr_module_data<\/code>\u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0418\u0434\u044b \u0441 \u043d\u0430\u0448\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0435 \u0432\u0441\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u043b\u0431\u044d\u043a\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0443 \u043d\u0430\u0441 \u043f\u043e\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043a\u0430\u043a \u0440\u0430\u0437 \u0438 \u0437\u0430\u0439\u043c\u0451\u043c\u0441\u044f. \u0418 \u043f\u0435\u0440\u0432\u044b\u043c \u0443 \u043d\u0430\u0441 \u0438\u0434\u0451\u0442 <em>\u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440<\/em> (<em>ana<\/em>).<\/p>\n<h4>ana() \u0438 ana.cpp<\/h4>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b <code>ana.cpp<\/code>, \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0448\u0430\u0431\u043b\u043e\u043d:<\/p>\n<pre><code class=\"cpp\">#include \"adc.hpp\"  int idaapi adcvm_t::ana(insn_t* _insn) {   if (_insn == NULL) {     return 0;   }    insn_t&amp; insn = *_insn;      uint16 code = insn.get_next_word();      switch (code) {     case 0: {            } break;     default: {       return 0;     } break;   }      return insn.size; }<\/code><\/pre>\n<p>\u041d\u0430\u0447\u0430\u043b\u043e\u0441\u044c&#8230; \u0418\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <code>insn_t<\/code> (\u0441\u0430\u043c\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f) \u0438 <code>op_t<\/code> (\u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432). \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0442\u043e\u043a\u0435\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043c\u043e\u0436\u0435\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430\u043c, \u0447\u0442\u043e \u0437\u0430 \u043e\u043f\u043a\u043e\u0434 \u0443 \u043d\u0430\u0441 \u043d\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0438. \u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u0438\u043d\u0443, \u043d\u043e \u0441\u0430\u043c \u043e\u043f\u043a\u043e\u0434 \u0431\u0435\u0437 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432 \u0438\u043c\u0435\u0435\u0442 \u0434\u043b\u0438\u043d\u0443 2 \u0431\u0430\u0439\u0442\u0430, \u0442.\u0435. <code>word<\/code>. \u0415\u0433\u043e \u0438 \u0447\u0438\u0442\u0430\u0435\u043c. \u0427\u0442\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u0431\u0430\u0439\u0442. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u0447\u0442\u0435\u043d\u0438\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <em>insn.get_next_xxxx()<\/em> \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u043d\u044b \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>0xFF00<\/code>. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0451 \u0432 \u043d\u0430\u0448 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>switch(code)<\/code>, \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0437\u0430\u043e\u0434\u043d\u043e \u043e\u0434\u043d\u043e \u0438\u0437 \u043f\u043e\u043b\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 (<code>insn_t<\/code>):<\/p>\n<pre><code class=\"cpp\">switch (code) {   \/\/ ...   case 0xFF00: {     insn.itype = ADCVM_ret;   } break;   \/\/ ... }<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0435 <code>itype<\/code> &#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u043e\u043c\u0435\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a enum-\u0443 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u043e\u043f\u043a\u043e\u0434\u0430\u043c\u0438). \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u043f\u043e\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043e\u043f\u043a\u043e\u0434 <code>div<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0430: <code>dest<\/code> (<em>\u0434\u0435\u043b\u0438\u043c\u043e\u0435<\/em>) \u0438 <code>src<\/code> (<em>\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c<\/em>) \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 <code>dest<\/code>. \u0422\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432 (\u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430, \u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c):<\/p>\n<pre><code class=\"cpp\">static void op_var(insn_t&amp; insn, op_t&amp; x) {   x.offb = (char)insn.size;    uint16 ref = insn.get_next_word();   x.addr = x.value = get_var_addr(ref); \/\/ convert short value to a mem address   x.dtype = dt_word;   x.type = o_mem; }  static void op_var_or_val(insn_t&amp; insn, op_t&amp; x) {   x.offb = (char)insn.size;    uint16 ref = x.value = insn.get_next_word();   bool isvar = is_var(ref); \/\/ mem variable or just a word value    if (isvar) {     x.addr = x.value = get_var_addr(ref);   }      x.dtype = dt_word;   x.type = isvar ? o_mem : o_imm; }  \/\/ ... switch (code) {   \/\/ ...   case 0xFF0A: {     insn.itype = ADCVM_div; op_var(insn, insn.Op1);     op_var_or_val(insn, insn.Op2);   } break;   \/\/ ... }<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0439\u0434\u0451\u043c\u0441\u044f \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043f\u043e\u043b\u044f\u043c \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0434\u0435\u0441\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f:<\/p>\n<ol>\n<li>\n<p><code>offb<\/code> &#8212; \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u043d\u0434 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438. \u0415\u0441\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u044b \u043a\u043e\u0434\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0431\u0438\u0442\u0430\u043c\u0438, \u0438\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>0<\/code>. \u0414\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u043c (\u0442.\u0435. \u043d\u0430\u043c\u0438), \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c hex-\u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0430<\/p>\n<\/li>\n<li>\n<p><code>addr<\/code> &#8212; \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0430\u0434\u0440\u0435\u0441, \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u043d\u0434 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0441\u044b\u043b\u043a\u0443<\/p>\n<\/li>\n<li>\n<p><code>value<\/code> &#8212; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u043d\u0434 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0447\u0438\u0441\u043b\u043e. \u0421\u044e\u0434\u0430 \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u044c\u0442\u0430 \u0434\u043b\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 <code>addr<\/code><\/p>\n<\/li>\n<li>\n<p><code>dtype<\/code> &#8212; \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0446\u0435\u043b\u0435\u0432\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443 \u0432 <code>addr<\/code>, \u043b\u0438\u0431\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 <code>value<\/code>. \u0412\u0441\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043e\u043f\u0438\u0441\u0430\u043d\u044b <a href=\"https:\/\/hex-rays.com\/products\/ida\/support\/sdkdoc\/group__dt__.html\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a><\/p>\n<\/li>\n<li>\n<p><code>type<\/code> &#8212; \u0442\u0438\u043f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c: <em>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435<\/em> (<code>o_mem<\/code>), <em>\u0447\u0438\u0441\u043b\u043e<\/em> (<code>o_imm<\/code>), <em>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u043e\u0434<\/em> (<code>o_near<\/code>). \u0414\u0440\u0443\u0433\u0438\u0435 \u0442\u0438\u043f\u044b \u043e\u043f\u0438\u0441\u0430\u043d\u044b <a href=\"https:\/\/hex-rays.com\/products\/ida\/support\/sdkdoc\/group__o__.html\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a><\/p>\n<\/li>\n<\/ol>\n<p>\u0415\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0435 <code>reg<\/code>, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b. \u0415\u0441\u043b\u0438 \u0438\u0445 \u043d\u0435\u0442, \u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u0441\u0432\u043e\u0438 \u043d\u0443\u0436\u0434\u044b. \u0415\u0449\u0451 \u043f\u043e\u0434 \u044d\u0442\u0438 \u0441\u0430\u043c\u044b\u0435 \u043d\u0443\u0436\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u043e\u043b\u044f: <code>specval<\/code>, <code>specflag1<\/code>&#8212;<code>specflag4<\/code>.<\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f &#8212; \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c 8 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432. \u0423 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a (<code>9<\/code>). \u0420\u0435\u0448\u0438\u043b \u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043a\u0430\u043a \u0440\u0430\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u0435\u0439 <code>reg<\/code> \u0438 <code>specval<\/code>. \u0415\u0449\u0451 \u0443 \u043c\u0435\u043d\u044f \u043f\u0440\u044f\u043c\u043e \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u044b: \u0441\u0442\u0440\u043e\u043a\u0438 (\u043d\u0435 \u0441\u0441\u044b\u043b\u043a\u0438, \u0430 \u0441\u0430\u043c\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u044b), \u043c\u0430\u0441\u0441\u0438\u0432\u044b. \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0445 \u0432\u0441\u0435 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435, \u0430 \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043c \u0432 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 \u0438 \u0432\u044b\u0432\u043e\u0434\u0435: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0434\u043b\u0438\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0442.\u0434.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430 \u0438 \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u043a\u043e\u0434 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<h4>emu() \u0438 emu.cpp<\/h4>\n<p>\u0415\u0449\u0451 \u043e\u0434\u0438\u043d \u0448\u0430\u0431\u043b\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c (\u043a\u0438\u0434\u0430\u0442\u044c \u0432 \u043e\u0434\u043d\u043e\u0438\u043c\u0451\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b):<\/p>\n<pre><code class=\"cpp\">#include \"adc.hpp\"  void adcvm_t::handle_operand(const insn_t&amp; insn, const op_t&amp; op, bool isload) const {   switch (op.type) {   case o_imm: { \/\/ val     set_immd(insn.ea);     op_num(insn.ea, op.n);   } break;   case o_mem: { \/\/ var     insn.create_op_data(op.addr, op);     insn.add_dref(op.addr, op.offb, isload ? dr_R : dr_W);   } break;   case o_near: { \/\/ code     switch (insn.itype) {     case ADCVM_call: {     insn.add_cref(op.addr, op.offb, fl_CN);     } break;     case ADCVM_jmp: {       insn.add_cref(op.addr, op.offb, fl_JN);     } break;     default: {       insn.add_dref(op.addr, op.offb, dr_O);     } break;     }   } break;   } }  int adcvm_t::emu(const insn_t&amp; insn) const {   uint32 feature = insn.get_canon_feature(ph);   bool flow = ((feature &amp; CF_STOP) == 0);    if (feature &amp; CF_USE1) handle_operand(insn, insn.Op1, 1);   if (feature &amp; CF_USE2) handle_operand(insn, insn.Op2, 1);   if (feature &amp; CF_USE3) handle_operand(insn, insn.Op3, 1);   if (feature &amp; CF_USE4) handle_operand(insn, insn.Op4, 1);   if (feature &amp; CF_USE5) handle_operand(insn, insn.Op5, 1);   if (feature &amp; CF_USE6) handle_operand(insn, insn.Op6, 1);   if (feature &amp; CF_USE7) handle_operand(insn, insn.Op7, 1);   if (feature &amp; CF_USE8) handle_operand(insn, insn.Op8, 1);    if (feature &amp; CF_CHG1) handle_operand(insn, insn.Op1, 0);   if (feature &amp; CF_CHG2) handle_operand(insn, insn.Op2, 0);   if (feature &amp; CF_CHG3) handle_operand(insn, insn.Op3, 0);   if (feature &amp; CF_CHG4) handle_operand(insn, insn.Op4, 0);   if (feature &amp; CF_CHG5) handle_operand(insn, insn.Op5, 0);   if (feature &amp; CF_CHG6) handle_operand(insn, insn.Op6, 0);   if (feature &amp; CF_CHG7) handle_operand(insn, insn.Op7, 0);   if (feature &amp; CF_CHG8) handle_operand(insn, insn.Op8, 0);    if (flow) {     add_cref(insn.ea, insn.ea + insn.size, fl_F);   }    return 1; }<\/code><\/pre>\n<p>\u0418\u043c\u0435\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 <em>API<\/em>-\u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u0437 <em>IDA SDK<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u044f\u0441\u043d\u0438\u0442\u044c.<\/p>\n<ul>\n<li>\n<p><code>set_immd<\/code> &#8212; \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0418\u0434\u0435, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e. \u0417\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u0435\u0439 \u043d\u0443\u0436\u043d\u043e, \u043d\u0435 \u0437\u043d\u0430\u044e<\/p>\n<\/li>\n<li>\n<p><code>op_num<\/code> &#8212; \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0418\u0434\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e, \u0447\u0442\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b\u0437\u043e\u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u0430\u043a\u0436\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 \u0433\u043e\u0440\u044f\u0447\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0448\u0438<\/p>\n<\/li>\n<li>\n<p><code>create_op_data<\/code> &#8212; \u043a\u043b\u0430\u0441\u0441\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043e\u043f\u043a\u043e\u0434 mov \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 word \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0442\u043e \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043d\u0435\u0451 \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043a\u0430\u043a <code>word<\/code><\/p>\n<\/li>\n<li>\n<p><code>insn.add_dref<\/code> &#8212; \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0438 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0430. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c, \u044d\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 <em>\u0447\u0442\u0435\u043d\u0438\u0435<\/em> (<code>dr_R<\/code>) \u0438\u043b\u0438 \u043d\u0430 <em>\u0437\u0430\u043f\u0438\u0441\u044c<\/em> (<code>dr_W<\/code>), \u043b\u0438\u0431\u043e <em>\u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430<\/em> (<code>dr_O<\/code>)<\/p>\n<\/li>\n<li>\n<p><code>insn.add_cref<\/code> &#8212; \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043a\u043e\u0434. \u042d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0440\u044b\u0436\u043a\u043e\u0432 (<em>jump<\/em>) &#8212; <em>fl_JN<\/em>, \u0432\u044b\u0437\u043e\u0432\u043e\u0432 (<em>call<\/em>) &#8212; <code>fl_CN<\/code>, \u043b\u0438\u0431\u043e \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (<em>codeflow<\/em>) &#8212; <code>fl_F<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u0432 <code>ins.cpp<\/code> \u0444\u043b\u0430\u0433\u0438 (<em>\u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0433\u0434\u0435<\/em>). \u0422\u0430\u043a\u0436\u0435, \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0441 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430\u043c\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043d\u0438\u0445 \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438 (\u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 <em>\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/em> \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u043f\u0435\u0440\u0432\u0430\u044f &#8212; \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 <em>\u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u0438<\/em>).<\/p>\n<h4>out_insn() \u0438 out.cpp<\/h4>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u0435\u043b\u043e \u0437\u0430 \u043c\u0430\u043b\u044b\u043c &#8212; \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0441 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0430\u043c\u0438 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0448\u0430\u0431\u043b\u043e\u043d:<\/p>\n<details class=\"spoiler\">\n<summary>\u0428\u0430\u0431\u043b\u043e\u043d out.cpp<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#include \"adc.hpp\"  class out_adcvm_t : public outctx_t {   out_adcvm_t(void) = delete; \/\/ not used public:   bool out_operand(const op_t&amp; x);   void out_insn(void); }; CASSERT(sizeof(out_adcvm_t) == sizeof(outctx_t));  DECLARE_OUT_FUNCS_WITHOUT_OUTMNEM(out_adcvm_t);  bool out_adcvm_t::out_operand(const op_t&amp; x) {   switch (x.type) {   case o_void: {     return false;   } break;   case o_imm: {     out_value(x, OOFS_IFSIGN | OOFW_IMM);   } break;   case o_near:   case o_mem: {     if (!out_name_expr(x, x.addr)) {       out_tagon(COLOR_ERROR);       out_btoa(x.addr, 16);       out_tagoff(COLOR_ERROR);       remember_problem(PR_NONAME, insn.ea);     }   } break;   }    return true; }  void out_adcvm_t::out_insn(void) {   out_mnemonic();    int n = 0;   while (n &lt; UA_MAXOP) {     if (!insn.ops[n].shown()) {       n++;       continue;     }      if (insn.ops[n].type == o_void) {       break;     }      out_one_operand(n);      if (n + 1 &lt; UA_MAXOP &amp;&amp; insn.ops[n + 1].type != o_void) {       out_symbol(',');       out_char(' ');     }      n++;   }    flush_outbuf(); }<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041d\u0435 \u0432\u0441\u0451 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0441\u0440\u0430\u0437\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u043a\u043b\u0430\u0441\u0441 <code>out_adcvm_t<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 <code>outctx_t<\/code>, \u0430 \u0437\u0430 \u043d\u0438\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043a\u0430\u043a\u043e\u043c\u0443-\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u043c\u0443 \u043c\u0430\u043a\u0440\u043e\u0441\u0443 <code>DECLARE_OUT_FUNCS_WITHOUT_OUTMNEM<\/code>. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u0437\u0434\u0435\u0441\u044c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 <code>out_insn(void)<\/code>, \u0431\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0431\u0438\u0442\u044c \u0441 \u0442\u043e\u043b\u043a\u0443, \u0442.\u043a. \u0432 \u0444\u0430\u0439\u043b\u0435 <code>reg.cpp<\/code> \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043c\u0435\u0442\u043e\u0434\u0443 <code>out_insn<\/code>:<\/p>\n<pre><code class=\"cpp\">switch (msgid) { case processor_t::ev_out_insn: {     auto* ctx = va_arg(va, outctx_t*);     out_insn(*ctx);   } break; }<\/code><\/pre>\n<p>\u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0443 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0435\u0441\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442. \u0412 \u043e\u0431\u0449\u0435\u043c, \u0435\u0441\u043b\u0438 \u0432\u043a\u0440\u0430\u0442\u0446\u0435, \u0442\u043e \u0432\u0441\u044f \u043c\u0430\u0433\u0438\u044f \u043a\u0430\u043a \u0440\u0430\u0437 \u0432 \u043c\u0430\u043a\u0440\u043e\u0441\u0435 <code>DECLARE_OUT_FUNCS_WITHOUT_OUTMNEM<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0434\u043b\u044f \u043d\u0430\u0441 \u0432\u0441\u043f\u043e\u043c\u0430\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b <code>out_insn<\/code> \u0438 <code>out_opnd<\/code> \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043b\u0438\u0441\u0442\u0438\u043d\u0433, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0430 <code>outctx_t<\/code>. \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 <code>idaidp.hpp<\/code> \u0432\u0430\u0448\u0435\u0433\u043e <em>IDA SDK<\/em>.<\/p>\n<h3>\u0424\u0438\u043d\u0430\u043b<\/h3>\n<p>\u0427\u0442\u043e, \u0443\u0436\u0435? \u0414\u0430, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f <em>IDA Pro<\/em> \u0434\u043b\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0438\u0437 \u0438\u0433\u0440\u044b <em>Clock Tower &#8212; The First Fear<\/em>. \u041d\u0430 \u0434\u0435\u043b\u0435, \u044d\u0442\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0435 \u0442\u0430\u043a \u0438 \u0441\u043b\u043e\u0436\u043d\u043e.<\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u0442\u044c \u043d\u044e\u0430\u043d\u0441\u044b, \u043a\u0443\u0434\u0430 \u0431\u0435\u0437 \u043d\u0438\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f  \u0432 \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0441\u0442\u0440\u043e\u043a \u0432 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435 <code>SHIFT-JIS<\/code>), \u0441 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u043e\u043b\u044c\u0448\u0435 <em>8<\/em>, \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438. \u041d\u043e, \u0432\u0441\u0451 \u044d\u0442\u043e \u0443\u0436\u0435 \u043f\u043e\u0437\u0430\u0434\u0438: \u043c\u043e\u0434\u0443\u043b\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u0435\u0441\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u0431\u0438\u043d\u0430\u0440\u044c, \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a <em>VM<\/em> \u0438\u0437 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u043b\u044f <em>PS1<\/em>, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f <em>PC<\/em>.<\/p>\n<p>\u0414\u0430, \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u043e\u0439 \u0438, \u0432 \u0432\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442\u00a0\u0431\u044b\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u0442\u044c \u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440. \u0422\u043e\u0433\u0434\u0430, \u0432\u0430\u0440\u0438\u0430\u043d\u0442 (\u043f\u043e\u043a\u0430) \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d &#8212; <em>Ghidra<\/em> (\u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u043d\u0435\u0451 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437). \u042f \u0436\u0435 \u043c\u043e\u0433\u0443 \u0441\u0435\u0431\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u043a\u043e\u043b\u043e-\u0441\u0438\u0448\u043d\u044b\u0439 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u043f\u0440\u044f\u043c\u043e \u0432 \u043e\u043a\u043d\u043e \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430 \u0418\u0434\u044b.<\/p>\n<figure class=\"bordered\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8ef\/47c\/793\/8ef47c7933c24e8ca2daba6c33f6865b.png\" width=\"502\" height=\"784\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8ef\/47c\/793\/8ef47c7933c24e8ca2daba6c33f6865b.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"bordered\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aa0\/86f\/3c2\/aa086f3c21f102e8eaac1f3fb3f9c44e.png\" width=\"351\" height=\"678\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aa0\/86f\/3c2\/aa086f3c21f102e8eaac1f3fb3f9c44e.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<h3>\u0421\u0441\u044b\u043b\u043a\u0438<\/h3>\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/lab313ru\/clock_tower_vm\" rel=\"noopener noreferrer nofollow\">\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/hex-rays.com\/products\/ida\/support\/sdkdoc\/index.html\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e IDA SDK<\/a><\/p>\n<\/li>\n<\/ul>\n<h4>P.S.<\/h4>\n<p>\u041f\u0440\u043e\u0448\u0443 \u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043a\u0443\u0441\u043a\u0438 \u043a\u043e\u0434\u0430 \u043d\u0435 \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c &#8212; \u0425\u0430\u0431\u0440 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u0432 \u0441\u043f\u043e\u0439\u043b\u0435\u0440 (\u043d\u0430 \u043d\u043e\u0432\u043e\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435) \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0438\u0441\u043d\u0435\u0442.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/573830\/\"> https:\/\/habr.com\/ru\/articles\/573830\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u0422\u0443\u0442 \u0442\u0430\u043a\u043e\u0435 \u0434\u0435\u043b\u043e: \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u043c\u043e\u044f \u0440\u0435\u0432\u0435\u0440\u0441\u0435\u0440\u0441\u043a\u0430\u044f \u043c\u0435\u0447\u0442\u0430 \u0441\u0431\u044b\u043b\u0430\u0441\u044c &#8212; \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f <em>IDA Pro<\/em> \u0441 \u043d\u0443\u043b\u044f, \u0437\u0430 \u0434\u0432\u0430 \u0434\u043d\u044f! \u0415\u0441\u043b\u0438 \u0432\u044b \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0442\u043e\u0436\u0435 \u0445\u043e\u0442\u0435\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, \u043d\u043e \u0431\u043e\u044f\u043b\u0438\u0441\u044c \u043d\u0430\u0447\u0430\u0442\u044c &#8212; \u0434\u0443\u043c\u0430\u044e, \u043c\u043e\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u0438\u0437\u0430\u0441\u0435\u043c\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a\u043e\u0434 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0438\u0437 \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u0442\u043e\u0433\u043e \u0445\u043e\u0440\u0440\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0445\u043e\u0434\u0438\u043b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430 <em>SNES<\/em>, \u043f\u043e\u0442\u043e\u043c \u043d\u0430 <em>PS1<\/em>, <em>PC<\/em> \u0438 <em>Wonderswan<\/em> &#8212; &#171;<em>Clock Tower &#8212; The First Fear<\/em>&#171;. \u0412 \u0438\u0433\u0440\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f <em>9<\/em> \u043a\u043e\u043d\u0446\u043e\u0432\u043e\u043a (<em>sic!<\/em>), \u0430\u0442\u043c\u043e\u0441\u0444\u0435\u0440\u0430 \u0433\u043d\u0435\u0442\u0443\u0449\u0430\u044f, \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0437\u043b\u043e\u0434\u0435\u044f \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 &#171;<em>Scissorman<\/em>&#187; (\u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0441 \u0440\u0443\u043a\u0430\u043c\u0438-\u043d\u043e\u0436\u043d\u0438\u0446\u0430\u043c\u0438). \u0417\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b? \u0422\u043e\u0433\u0434\u0430 \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c&#8230;<\/p>\n<figure class=\"bordered full-width\"><figcaption><\/figcaption><\/figure>\n<h3>\u041e \u0441\u0430\u043c\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435<\/h3>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u0430\u043c \u043a\u043e\u0434, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0439 \u043e\u043f\u043a\u043e\u0434\u044b \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b, \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043d\u043e, \u0432\u043e\u0442 \u043a\u0440\u0430\u0442\u043a\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043d\u0451\u043c:<\/p>\n<ul>\n<li>\n<p><em>115<\/em> \u043e\u043f\u043a\u043e\u0434\u043e\u0432 \u043d\u0430 \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0436\u0438\u0437\u043d\u0438<\/p>\n<\/li>\n<li>\n<p>\u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 <em>VM<\/em> \u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f <em>PS1<\/em> \u0438 <em>PC<\/em>, \u043d\u0430 <em>SNES<\/em> \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043d\u0435\u0442<\/p>\n<\/li>\n<li>\n<p>\u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440-\u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0434\u043b\u044f <em>Ghidra<\/em> (\u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438)<\/p>\n<\/li>\n<\/ul>\n<figure class=\"bordered full-width\"><figcaption><\/figcaption><\/figure>\n<h3>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h3>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043a\u043e\u0434\u0430. \u042f \u043f\u0438\u0441\u0430\u043b \u0432 <em>Visual Studio<\/em> \u043d\u0430 <em>C\/C++<\/em>, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043d\u0430 <em>Python<\/em>.<\/p>\n<h4>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h4>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0443\u0441\u0442\u043e\u044f\u0432\u0448\u0438\u043c\u0441\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0434\u043b\u044f <em>IDA Pro<\/em> (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <em>IDA SDK<\/em>), \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u043a\u0430 \u0435\u0449\u0451 \u043f\u0443\u0441\u0442\u044b\u0435 \u0444\u0430\u0439\u043b\u044b:<\/p>\n<p>\u0418\u043d\u043a\u043b\u0443\u0434\u044b:<\/p>\n<ul>\n<li>\n<p><code>cpu_name.hpp<\/code> (\u0433\u0434\u0435 <em>cpu_name<\/em> &#8212; \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u0438\u043c\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f, \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e <em>adc<\/em>)<\/p>\n<\/li>\n<li>\n<p><code>ins.hpp<\/code> (\u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c <em>enum<\/em> \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0432\u0441\u0435\u0445 \u043e\u043f\u043a\u043e\u0434\u043e\u0432)<\/p>\n<\/li>\n<\/ul>\n<p>\u0424\u0430\u0439\u043b\u044b \u0441 \u043a\u043e\u0434\u043e\u043c:<\/p>\n<ul>\n<li>\n<p><code>ana.cpp<\/code> (\u0437\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043a\u043e\u0434 <em>\u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/em> (<s>\u0445\u043e\u0440\u043e\u0448\u043e, \u0447\u0442\u043e \u043d\u0435 \u043a\u0430\u043a \u0443 radare2 &#8212; anal<\/s>)<\/p>\n<\/li>\n<li>\n<p><code>emu.cpp<\/code> (\u0441\u044e\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 <em>\u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430<\/em>)<\/p>\n<\/li>\n<li>\n<p><code>ins.cpp<\/code> (<em>\u0438\u043c\u0435\u043d\u0430 \u043e\u043f\u043a\u043e\u0434\u043e\u0432<\/em> \u0438 \u0438\u0445 <em>feature-\u0444\u043b\u0430\u0433\u0438<\/em> &#8212; \u0437\u0434\u0435\u0441\u044c)<\/p>\n<\/li>\n<li>\n<p><code>out.cpp<\/code> (\u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0441\u0430\u043c <em>\u0432\u044b\u0432\u043e\u0434<\/em> \u043c\u043d\u0435\u043c\u043e\u043d\u0438\u043a\/\u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432 \u0438 \u043f\u0440\u043e\u0447\u0435\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u043a\u0438, \u0442\u0438\u043f\u0430 \u0437\u0430\u043f\u044f\u0442\u044b\u0445, \u0441\u043a\u043e\u0431\u043e\u043a \u0438 \u0442.\u0434.)<\/p>\n<\/li>\n<li>\n<p><code>reg.cpp<\/code> (\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b, \u043d\u043e \u043d\u0435\u0442 &#8212; \u044d\u0442\u043e \u043f\u0440\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u043c\u043e\u0434\u0443\u043b\u044f, \u0435\u0433\u043e \u0444\u043b\u0430\u0433\u0438 \u0438 \u043f\u0440\u043e\u0447\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e. \u0418\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c <em>\u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f<\/em> \u043c\u043e\u0434\u0443\u043b\u044c)<\/p>\n<\/li>\n<\/ul>\n<figure class=\"bordered\"><figcaption><\/figcaption><\/figure>\n<h4>\u041e\u0431 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0435, \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 \u0438 \u0432\u044b\u0432\u043e\u0434\u0435<\/h4>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0449\u0435 \u0431\u044b\u043b\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438, \u0441\u0442\u043e\u0438\u0442 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0436\u0435 \u0442\u0430\u043a\u043e\u0435 <em>\u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440<\/em> (<em>ana<\/em>), <em>\u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440<\/em> (<em>emu<\/em>) \u0438 <em>\u0432\u044b\u0432\u043e\u0434<\/em> (<em>out<\/em>). \u041d\u0430\u0447\u043d\u0451\u043c \u0441 <em>ana<\/em>.<\/p>\n<p><strong>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 (ana)<\/strong><\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0438 <em>\u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/em>: \u0447\u0442\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u043a\u043e\u0434\u043e\u0432 \u0438 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432 \u0434\u043b\u044f \u043d\u0438\u0445. \u041e\u0431\u044b\u0447\u043d\u043e, \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: \u0447\u0438\u0442\u0430\u0435\u043c \u0431\u0430\u0439\u0442\/\u0432\u043e\u0440\u0434\/\u0434\u0432\u043e\u0440\u0434, \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u043e\u043f\u043a\u043e\u0434\u043e\u0432, \u0437\u0430\u0442\u0435\u043c \u0447\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u0430 (\u0438\u043d\u0434\u0435\u043a\u0441 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\/\u0430\u0434\u0440\u0435\u0441 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438\/\u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u044b\u0436\u043a\u0430 \u0438 \u0442.\u043f.). \u041f\u043e\u043a\u0430 \u0447\u0438\u0442\u0430\u0435\u043c, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0434\u043b\u0438\u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438.<\/p>\n<p><strong>\u042d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 (emu)<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0432 \u0434\u0435\u043b\u043e \u0432\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440. \u0415\u0433\u043e \u0437\u0430\u0434\u0430\u0447\u0430: \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043e\u043a \u0438 \u043f\u043e\u0441\u0442-\u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430. \u0421\u0441\u044b\u043b\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 <em>return<\/em>, <em>jump<\/em> \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438: \u0447\u0442\u0435\u043d\u0438\u0435\/\u0437\u0430\u043f\u0438\u0441\u044c\/\u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430 \u0441\u0442\u0435\u043a \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0434 \u043f\u043e\u0441\u0442-\u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043f\u043e\u0440\u0442\u043e\u0432, \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438. \u0415\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 \u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432, \u0433\u0434\u0435 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\/\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<\/p>\n<p><strong>\u0412\u044b\u0432\u043e\u0434 (out)<\/strong><\/p>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u0442\u0430\u043f \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f &#8212; \u043a\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u0445 (<em>out<\/em>). \u0414\u0430\u043d\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0418\u0434\u043e\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0430. \u0418 \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c \u043a\u0440\u043e\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430, \u043f\u043e\u0447\u0435\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0413\u0438\u0434\u0440\u044b \u0443\u043c\u0435\u0435\u0442 \u0432 \u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438, \u0430 \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u0437 \u0418\u0434\u044b &#8212; \u043d\u0435\u0442. \u0412\u044b\u0432\u043e\u0434\u0438\u043b\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 &#8212; \u044d\u0442\u043e, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043f\u0440\u043e\u0441\u0442\u0430\u044f <em>printf<\/em> \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u044b \u0435\u0439 \u0443\u043a\u0430\u0436\u0435\u0442\u0435, \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0442\u0441\u0442\u0443\u043f\u044b, \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0446\u0432\u0435\u0442\u043d\u044b\u043c \u0438 \u0442.\u0434. \u041d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0442\u0435\u0431\u0435 IR (<em>Intermediate Representation<\/em>). \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0448\u044c \u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0434\u043b\u044f \u044d\u043a\u0437\u043e\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u0443 \u0442\u0435\u0431\u044f \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:<\/p>\n<ol>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>Ghidra<\/em><\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>Ghidra<\/em>. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u043e\u0449\u0440\u044f\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <em>\u0412\u044b\u0432\u043e\u0434<\/em>. \u0413\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b, \u043a\u0430\u043a\u043e\u0432\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <em>VM<\/em> \u0438\u0437 <em>Clock Tower<\/em>, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043f\u0441\u0435\u0432\u0434\u043e-\u0441\u0438\u0448\u043d\u044b\u0439 \u043a\u043e\u0434 (\u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442). \u042f \u0442\u0430\u043a \u0438 \u0441\u0434\u0435\u043b\u0430\u043b.<\/p>\n<h3>\u041f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c<\/h3>\n<p>\u0425\u0432\u0430\u0442\u0438\u0442 \u0440\u0430\u0437\u0433\u043b\u0430\u0433\u043e\u043b\u044c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0436\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <em>Visual Studio<\/em>, \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 <em>DLL<\/em>, \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u0438 \u043a \u0438\u043d\u043a\u043b\u0443\u0434\u0430\u043c \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c <em>IDA SDK<\/em>. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b (\u0432\u0441\u0435 \u0442\u0440\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438):<\/p>\n<pre><code class=\"cpp\">__NT__ __IDP__ __X64__<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0418\u0434\u043e\u0439 \u0441 64-\u0431\u0438\u0442\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043d\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e\u043c, \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0444\u043b\u0430\u0433:<\/p>\n<pre><code class=\"cpp\">__EA64__<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <code>reg.cpp<\/code> \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0431\u043b\u043e\u043d:<\/p>\n<pre><code class=\"cpp\">#include \"adc.hpp\" \/\/ your main VM include  processor_t LPH = {   IDP_INTERFACE_VERSION,   0x8000 + 666, \/\/ proc ID   PR_USE32 | PR_DEFSEG32 | PRN_HEX | PR_WORD_INS | PR_BINMEM | PR_NO_SEGMOVE | PR_CNDINSNS, \/\/ flags   0, \/\/ flags2   8, 8, \/\/ bits in a byte (code\/data)   shnames, \/\/ short processor names   lnames, \/\/ long processor names   asms, \/\/ assembler definitions    notify, \/\/ callback to create our proc module instance    regnames, \/\/ register names   qnumber(regnames), \/\/ registers count    rVcs, rVds, \/\/ number of first\/last segment register   0, \/\/ segment register size   rVcs, rVds, \/\/ virtual code\/data segment register    NULL, \/\/ typical code start sequences   retcodes, \/\/ return opcodes bytes    0, ADCVM_last, \/\/ indices of first\/last opcodes (in enum)   Instructions, \/\/ array of instructions };<\/code><\/pre>\n<p>\u0412 \u0444\u0430\u0439\u043b <code>adc.hpp<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0438\u043d\u043a\u043b\u0443\u0434\u044b:<\/p>\n<pre><code class=\"cpp\">#pragma once  #include \"..\/idaidp.hpp\" \/\/ this file is located in IDA_SDK\/module\/ dir #include \"ins.hpp\"<\/code><\/pre>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432 \u0437\u0434\u0435\u0441\u044c <em>3<\/em>:<\/p>\n<ol>\n<li>\n<p><code>proc ID<\/code> &#8212; \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u0412\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u043d\u043e\u043c\u0435\u0440 >= <em>0x8000<\/em><\/p>\n<\/li>\n<li>\n<p><code>\u0424\u043b\u0430\u0433\u0438<\/code> &#8212; \u0438\u0445 \u043c\u043d\u043e\u0433\u043e, \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u043d\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u043e\u043d\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u0421\u043f\u0438\u0441\u043e\u043a \u0444\u043b\u0430\u0433\u043e\u0432 \u0438 \u0438\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f <a href=\"https:\/\/hex-rays.com\/products\/ida\/support\/sdkdoc\/group___p_r__.html\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a><\/p>\n<\/li>\n<li>\n<p><code>rVcs<\/code>\/<code>rVds<\/code> &#8212; \u0432 \u043c\u043e\u0435\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f, \u043d\u043e \u0418\u0434\u0435 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b. \u0418\u043c\u0438 \u043c\u044b \u0437\u0430\u0439\u043c\u0451\u043c\u0441\u044f \u043f\u043e\u0437\u0434\u043d\u0435\u0435<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0438\u0434\u0451\u0442 <code>shnames<\/code>:<\/p>\n<pre><code class=\"cpp\">static const char* const shnames[] = { \"ADCVM\", NULL };<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u0448 \u043c\u043e\u0434\u0443\u043b\u044c (\u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c <code>NULL<\/code>.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u043c <code>lnames<\/code>:<\/p>\n<pre><code class=\"cpp\">static const char* const lnames[] = { \"Clock Tower: Clock Tower ADC VM\", NULL };<\/code><\/pre>\n<p>\u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u0438\u043c\u044f. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u0430\u043c\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 &#8212; \u0432\u0441\u0451, \u0447\u0442\u043e \u0432 \u043d\u0435\u0439 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043e \u0434\u043e \u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u044f, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <em>\u0438\u043c\u0435\u043d\u0435\u043c \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432<\/em>. \u0418\u0442\u043e\u0433\u043e, \u0432\u0441\u044f \u044d\u0442\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432 \u0418\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<figure class=\"bordered full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043d\u043e\u0433\u0438\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u044f \u043a\u043e\u0433\u0434\u0430-\u0442\u043e) &#8212; \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430. \u0427\u0442\u043e \u043e\u043d \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u0418\u0434\u044b? \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u0438, \u044d\u0442\u043e &#8212; \u0441\u043e\u043b\u044f\u043d\u043a\u0430 \u0438\u0437 \u043d\u0438\u043a\u0435\u043c \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0438 \u043d\u0438\u043a\u043e\u043c\u0443 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u0441\u0430\u043c\u043e\u0439 \u0418\u0434\u043e\u0439 (\u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435) \u0431\u0435\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u0438\u044f. \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u044d\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432 (\u0442\u0438\u043f\u0430: <code>org<\/code>, <code>end<\/code>, <code>equ<\/code>, <code>public<\/code>, <code>xref<\/code>).<\/p>\n<p>\u041d\u0443\u0436\u043d\u044b \u043e\u043d\u0438, \u0438\u043b\u0438 \u043d\u0435\u0442, \u0430 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f. \u041b\u0443\u0447\u0448\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u044f\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0438\u0437 \u043a\u0430\u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c <em>SDK<\/em>-\u0448\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u0447\u0443\u0442\u044c-\u0447\u0443\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c. \u0423 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"cpp\">static const asm_t adcasm = {   AS_COLON | ASH_HEXF3,   0,   \"Clock Tower Virtual Machine Bytecode\",   0,   NULL,         \/\/ header lines   \"org\",        \/\/ org   \"end\",        \/\/ end    \";\",          \/\/ comment string   '\"',          \/\/ string delimiter   '\\'',         \/\/ char delimiter   \"\\\"'\",        \/\/ special symbols in char and string constants    \"dc\",         \/\/ ascii string directive   \"dcb\",        \/\/ byte directive   \"dc\",         \/\/ word directive   NULL,         \/\/ double words   NULL,         \/\/ qwords   NULL,         \/\/ oword  (16 bytes)   NULL,         \/\/ float  (4 bytes)   NULL,         \/\/ double (8 bytes)   NULL,         \/\/ tbyte  (10\/12 bytes)   NULL,         \/\/ packed decimal real   \"bs#s(c,) #d, #v\", \/\/ arrays (#h,#d,#v,#s(...)   \"ds %s\",      \/\/ uninited arrays   \"equ\",        \/\/ equ   NULL,         \/\/ 'seg' prefix (example: push seg seg001)   \"*\",          \/\/ current IP (instruction pointer)   NULL,         \/\/ func_header   NULL,         \/\/ func_footer   \"global\",     \/\/ \"public\" name keyword   NULL,         \/\/ \"weak\"   name keyword   \"xref\",       \/\/ \"extrn\"  name keyword                 \/\/ .extern directive requires an explicit object size   NULL,         \/\/ \"comm\" (communal variable)   NULL,         \/\/ get_type_name   NULL,         \/\/ \"align\" keyword   '(', ')',     \/\/ lbrace, rbrace   \"%\",          \/\/ mod   \"&amp;\",          \/\/ and   \"|\",          \/\/ or   \"^\",          \/\/ xor   \"!\",          \/\/ not   \"&lt;&lt;\",         \/\/ shl   \">>\",         \/\/ shr   \"sizeof\",         \/\/ sizeof   AS2_BYTE1CHAR,\/\/ One symbol per processor byte };<\/code><\/pre>\n<p>\u0418\u0437 \u0432\u0441\u0435\u0433\u043e, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u043b\u0430\u0433\u0438 (\u043e\u043d\u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0437\u0430 \u0442\u043e, \u043a\u0430\u043a \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0447\u0438\u0441\u043b\u0430, \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f), \u0438 \u0438\u043c\u044f \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <code>asm_t<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/hex-rays.com\/products\/ida\/support\/sdkdoc\/structasm__t.html\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u043d\u0443 \u0430 \u043c\u044b \u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, <code>notify<\/code>-\u043a\u043e\u043b\u0431\u044d\u043a \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0418\u0434\u0435. \u0421\u043c\u044b\u0441\u043b\u0430 \u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u043a\u043e\u0434 \u043d\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0435\u0440\u0451\u043c \u043a\u0430\u043a \u0435\u0441\u0442\u044c:<\/p>\n<pre><code class=\"cpp\">static int data_id;  ssize_t idaapi notify(void* user_data, int notification_code, va_list va) {   if (notification_code == processor_t::ev_get_procmod) {     data_id = 0;     return size_t(SET_MODULE_DATA(adcvm_t));   }    return 0; }<\/code><\/pre>\n<p>\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e <code>adcvm_t<\/code> \u043d\u0430 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0432\u0430\u0448\u0435\u0433\u043e \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u0422\u0430\u043a\u0436\u0435, \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043c\u0430\u043a\u0440\u043e\u0441 <code>SET_MODULE_DATA<\/code>. \u041e\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>set_module_data<\/code> \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430. \u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 <code>int data_id;<\/code>.  \u0422\u0443\u0448\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044f \u0437\u0430\u0439\u043c\u0451\u043c\u0441\u044f \u0447\u0443\u0442\u043e\u0447\u043a\u0443 \u043f\u043e\u0437\u0436\u0435, \u0430 \u043f\u043e\u043a\u0430 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u043c.<\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0438\u0437 <em>Clock Tower<\/em>, \u0432\u043c\u0435\u0441\u0442\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441\u0430 \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 (<em>work<\/em>) \u043f\u0430\u043c\u044f\u0442\u0438. \u041d\u043e \u0418\u0434\u0430, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0438 \u0445\u043e\u0447\u0435\u0442 \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 <code>cs<\/code> \u0438 <code>ds<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, <code>regnames<\/code> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">static const char* const regnames[] = {   \"cs\", \"ds\" };<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u043c\u0435\u0441\u0442\u043e <code>NULL<\/code> \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u043f\u0438\u0441\u043a\u0430, \u0418\u0434\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043c\u0430\u043a\u0440\u043e\u0441: <code>qnum<\/code><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-387671","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/387671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=387671"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/387671\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=387671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=387671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=387671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}