{"id":372915,"date":"2024-05-21T05:23:50","date_gmt":"2024-05-21T05:23:50","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=372915"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=372915","title":{"rendered":"<span>\u0421\u043a\u0430\u0437 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044f \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 Intel 4004 \u043d\u0430 Python \u043f\u0438\u0441\u0430\u043b (\u0447\u0430\u0441\u0442\u044c 2)<\/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><strong>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0434\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/strong>: \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 <a href=\"https:\/\/habr.com\/ru\/articles\/775686\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e<\/a>, \u0434\u0430\u0431\u044b \u0432\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432 \u0441\u0443\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e. \u0416\u0435\u043b\u0430\u044e \u0432\u0430\u043c \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f \ud83d\ude42<\/p>\n<h3>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0421\u0438\u0434\u0435\u043b \u044f \u0442\u0443\u0442 \u043d\u0430 \u0434\u043d\u044f\u0445 \u0438 \u0434\u0443\u043c\u0430\u043b, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043c\u043e\u0439 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 &#171;<a href=\"https:\/\/ru.wikipedia.org\/wiki\/Intel_4004\" rel=\"noopener noreferrer nofollow\">Intel 4004<\/a>&#187; \u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043f\u043e\u0434 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e, \u044f \u043e\u0441\u043e\u0437\u043d\u0430\u043b \u043e\u0434\u043d\u0443 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0432\u0435\u0449\u044c &#8212; \u043c\u043e\u0451 \u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0435 \u043d\u0430 4004-\u044b\u0439 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0442\u043e \u0438 \u043f\u043e\u0445\u043e\u0436\u0435.. \u0410\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u044b\u0435 \u043e\u043f\u043a\u043e\u0434\u044b, \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 \u043e\u0442\u0440\u043e\u0434\u044f\u0441\u044c \u043d\u0435 \u0431\u044b\u043b\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 HLT, AND \u0438 OR (HLT \u0442\u0430\u043a \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Intel_4040\" rel=\"noopener noreferrer nofollow\">Intel 4040<\/a>).<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0437\u0434\u0443\u043c\u0438\u0439 \u044f \u043f\u0440\u0438\u043d\u044f\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 &#8212; \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u0441 \u043d\u0443\u043b\u044f, \u0441 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c\u0438 \u043e\u043f\u043a\u043e\u0434\u0430\u043c\u0438, \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435 \ud83d\ude09<\/p>\n<h3>\u041a\u0430\u043a \u0432\u0441\u0451 \u043f\u0438\u0441\u0430\u043b\u043e\u0441\u044c?<\/h3>\n<p>\u042f \u043d\u0430\u0447\u0430\u043b \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c datasheet, \u0441\u0442\u0430\u043b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u043f\u043e \u0442\u0435\u043c\u0435 4004-\u0433\u043e, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f <a href=\"https:\/\/github.com\/markablov\/i40xx\" rel=\"noopener noreferrer nofollow\">\u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f markablov<\/a>, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 JavaScript (\u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0442\u0442\u0443\u0434\u0430 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0431\u044b\u043b\u0438 \u0432\u0437\u044f\u0442\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043e\u043f\u043a\u043e\u0434\u044b).<\/p>\n<p>\u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437, \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043a\u043b\u0430\u0441\u0441 CPU \u0438 \u043d\u0430\u0447\u0430\u043b \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 (\u043d\u0430\u0441\u0443\u0449\u043d\u044b\u0435 256 \u0431\u0430\u0439\u0442), \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0438 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 (\u043f\u0430\u043c\u044f\u0442\u044c \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u044f \u0437\u0430\u043f\u0438\u0445\u0430\u043b \u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430):<\/p>\n<pre><code class=\"python\">class CPU:     def __init__(self):          # 256 bytes of memory         self.memory = bytearray(256)          # accumulator         self.acc = 0          # program counter         self.pc = 0<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0432 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e 7 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0438\u0437 46 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 (\u0442\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u043c \u0435\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f, \u0441\u043a\u043e\u0440\u0435\u0435 \u0443\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u043c, \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u0431\u044b\u043b\u043e \u0442\u0430\u043a\u0436\u0435).<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0dd\/a53\/c8b\/0dda53c8b8891d34a72e7549ce763c60.png\" alt=\"\u0421\u043f\u0438\u0441\u043e\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0438\u0437 datasheet\" title=\"\u0421\u043f\u0438\u0441\u043e\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0438\u0437 datasheet\" width=\"487\" height=\"653\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0dd\/a53\/c8b\/0dda53c8b8891d34a72e7549ce763c60.png\"\/><\/p>\n<div><figcaption>\u0421\u043f\u0438\u0441\u043e\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0438\u0437 datasheet<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\"><strong>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">NOP<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u0437 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">INC<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">ISZ<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u043e\u043f\u0443\u0441\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430, \u0435\u0441\u043b\u0438 \u043e\u043d \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">ADD<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u043a \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0443 \u0441 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u043e\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">SUB<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0438\u0437 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0441 \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">LD<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0432 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">XCH<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0431\u043c\u0435\u043d \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0438 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0418\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u044b\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043f\u0443\u0442\u0451\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<pre><code class=\"python\">    # NOP instruction (No Operation)     def NOP(self):         self.pc += 1      # INC instruction (Increment index register)     def INC(self):         self.acc = (self.acc + 1) % 256         self.pc += 1      # ISZ instruction (Increment index register skip if zero)     def ISZ(self, address):         self.memory[address] = (self.memory[address] + 1) % 256          if self.memory[address] == 0:             self.pc += 2         else:             self.pc += 1      # ADD instruction (Add index register to accumulator with carry)     def ADD(self, address):         self.acc = (self.acc + self.memory[address]) % 256         self.pc += 2      # SUB instruction (Subtract index register to accumulator with borrow)     def SUB(self, address):         self.acc = (self.acc - self.memory[address]) % 256         self.pc += 2      # LD instruction (Load index register to Accumulator)     def LD(self, address):         self.acc = self.memory[address]         self.pc += 2      # XCH instruction (Exchange index register and accumulator)     def XCH(self, address):         temp = self.acc         self.acc = self.memory[address]         self.memory[address] = temp         self.pc += 2<\/code><\/pre>\n<p>\u041e\u0431\u043e \u0432\u0441\u0451\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n<ul>\n<li>\n<p>NOP \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 (pc) \u043d\u0430 1, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435.  <\/p>\n<\/li>\n<li>\n<p>INC \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 (acc) \u043d\u0430 1, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044f \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u043e 0-255, \u0438 \u0437\u0430\u0442\u0435\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 pc \u043d\u0430 1.  <\/p>\n<\/li>\n<li>\n<p>ISZ \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u044f\u0447\u0435\u0439\u043a\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u043d\u0430 1, \u0441\u043d\u043e\u0432\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044f \u0435\u0433\u043e \u0434\u043e 0-255. \u0415\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u044f\u0447\u0435\u0439\u043a\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u044b\u043c 0, pc \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 2, \u0438\u043d\u0430\u0447\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 1.  <\/p>\n<\/li>\n<li>\n<p>ADD \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u044f\u0447\u0435\u0439\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u043e 0-255 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 pc \u043d\u0430 2.  <\/p>\n<\/li>\n<li>\n<p>SUB \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u044f\u0447\u0435\u0439\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u043e 0-255 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 pc \u043d\u0430 2.  <\/p>\n<\/li>\n<li>\n<p>LD \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u044f\u0447\u0435\u0439\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u0432 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 pc \u043d\u0430 2.  <\/p>\n<\/li>\n<li>\n<p>XCH \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u044f\u0447\u0435\u0439\u043a\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 pc \u043d\u0430 2.  <\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f run, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u044b \u043e\u043f\u043a\u043e\u0434\u044b \u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"python\">    def run(self):         while self.pc &lt; len(self.memory):             opcode = self.memory[self.pc]              # NOP instruction opcode             if opcode == 0x0:                 self.NOP()              # INC instruction opcode             elif opcode == 0x6:                 self.INC()              # ISZ instruction opcode             elif opcode == 0x7:                 self.ISZ(self.memory[self.pc + 1])              # ADD instruction opcode             elif opcode == 0x8:                 self.ADD(self.memory[self.pc + 1])              # SUB instruction opcode             elif opcode == 0x9:                 self.SUB(self.memory[self.pc + 1])              # LD instruction opcode             elif opcode == 0xA:                 self.LD(self.memory[self.pc + 1])              # XCH instruction opcode             elif opcode == 0xB:                 self.XCH(self.memory[self.pc + 1])              else:                 print('Unknown opcode!!!')                 return              self.pc += 1<\/code><\/pre>\n<h3>\u041a\u0430\u043a \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430?<\/h3>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430\u0434\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u044f\u043c\u043e \u0432 \u043a\u043e\u0434\u0435, \u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0432 <a href=\"https:\/\/github.com\/YuraFX\/i4004-py\/blob\/main\/src\/program.py\" rel=\"noopener noreferrer nofollow\">program.py<\/a>. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 12 \u0447\u0438\u0441\u043b\u043e 5 \u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0447\u0438\u0441\u043b\u043e 2:<\/p>\n<pre><code class=\"python\">from cpu import CPU  cpu = CPU()  # Write the numbers 12, 5 and 2 to memory at arbitrary addresses (e.g. 0x10, 0x11 and 0x12) cpu.memory[0x10] = 12 cpu.memory[0x11] = 5 cpu.memory[0x12] = 2  # Execute the commands to subtract the numbers 12 and 5, and then add the number 2 to the resulting number cpu.LD(0x10) cpu.SUB(0x11) cpu.ADD(0x12) cpu.NOP()  # The result of the program will be stored in the accumulator print('') print(f'  Result: {cpu.acc}') print('')<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/030\/277\/79d\/03027779d277010e41dd89adc7d82f23.png\" alt=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b  \" title=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b  \" width=\"684\" height=\"141\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/030\/277\/79d\/03027779d277010e41dd89adc7d82f23.png\"\/><\/p>\n<div><figcaption>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b  <\/figcaption><\/div>\n<\/figure>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u044f \u0443\u0447\u0451\u043b \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0438 \u0432 \u044d\u0442\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0451 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u0435\u0440\u043d\u044b\u043c.<\/p>\n<p>\u0423 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u0434\u0435\u0438 \u043f\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 4004-\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 tkinter, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u043a\u043d\u043e, \u0433\u0434\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0438 \u0435\u043c\u0443 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (\u0434\u0430\u0431\u044b \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u0430\u043c Python, \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 IDE \u043a \u043d\u0435\u043c\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438 \u0442\u0435\u0441\u0442\u0430 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430).<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043c\u043e\u0451\u043c <a href=\"https:\/\/github.com\/YuraFX\/i4004-py\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>.<\/p>\n<p>\u0421 \u0432\u0430\u043c\u0438 \u0431\u044b\u043b Yura_FX. \u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u0434\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043c\u043d\u0435\u043d\u0438\u0435\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \ud83d\ude42  <\/p>\n<\/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\/805825\/\"> https:\/\/habr.com\/ru\/articles\/805825\/<\/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><strong>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0434\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/strong>: \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 <a href=\"https:\/\/habr.com\/ru\/articles\/775686\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e<\/a>, \u0434\u0430\u0431\u044b \u0432\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432 \u0441\u0443\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e. \u0416\u0435\u043b\u0430\u044e \u0432\u0430\u043c \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f \ud83d\ude42<\/p>\n<h3>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0421\u0438\u0434\u0435\u043b \u044f \u0442\u0443\u0442 \u043d\u0430 \u0434\u043d\u044f\u0445 \u0438 \u0434\u0443\u043c\u0430\u043b, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043c\u043e\u0439 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 &#171;<a href=\"https:\/\/ru.wikipedia.org\/wiki\/Intel_4004\" rel=\"noopener noreferrer nofollow\">Intel 4004<\/a>&#187; \u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043f\u043e\u0434 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e, \u044f \u043e\u0441\u043e\u0437\u043d\u0430\u043b \u043e\u0434\u043d\u0443 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0432\u0435\u0449\u044c &#8212; \u043c\u043e\u0451 \u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0435 \u043d\u0430 4004-\u044b\u0439 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0442\u043e \u0438 \u043f\u043e\u0445\u043e\u0436\u0435.. \u0410\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u044b\u0435 \u043e\u043f\u043a\u043e\u0434\u044b, \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 \u043e\u0442\u0440\u043e\u0434\u044f\u0441\u044c \u043d\u0435 \u0431\u044b\u043b\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 HLT, AND \u0438 OR (HLT \u0442\u0430\u043a \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Intel_4040\" rel=\"noopener noreferrer nofollow\">Intel 4040<\/a>).<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0437\u0434\u0443\u043c\u0438\u0439 \u044f \u043f\u0440\u0438\u043d\u044f\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 &#8212; \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u0441 \u043d\u0443\u043b\u044f, \u0441 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c\u0438 \u043e\u043f\u043a\u043e\u0434\u0430\u043c\u0438, \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435 \ud83d\ude09<\/p>\n<h3>\u041a\u0430\u043a \u0432\u0441\u0451 \u043f\u0438\u0441\u0430\u043b\u043e\u0441\u044c?<\/h3>\n<p>\u042f \u043d\u0430\u0447\u0430\u043b \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c datasheet, \u0441\u0442\u0430\u043b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u043f\u043e \u0442\u0435\u043c\u0435 4004-\u0433\u043e, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f <a href=\"https:\/\/github.com\/markablov\/i40xx\" rel=\"noopener noreferrer nofollow\">\u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f markablov<\/a>, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 JavaScript (\u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0442\u0442\u0443\u0434\u0430 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0431\u044b\u043b\u0438 \u0432\u0437\u044f\u0442\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043e\u043f\u043a\u043e\u0434\u044b).<\/p>\n<p>\u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437, \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043a\u043b\u0430\u0441\u0441 CPU \u0438 \u043d\u0430\u0447\u0430\u043b \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 (\u043d\u0430\u0441\u0443\u0449\u043d\u044b\u0435 256 \u0431\u0430\u0439\u0442), \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0438 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 (\u043f\u0430\u043c\u044f\u0442\u044c \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u044f \u0437\u0430\u043f\u0438\u0445\u0430\u043b \u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430):<\/p>\n<pre><code class=\"python\">class CPU:     def __init__(self):          # 256 bytes of memory         self.memory = bytearray(256)          # accumulator         self.acc = 0          # program counter         self.pc = 0<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0432 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e 7 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0438\u0437 46 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 (\u0442\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u043c \u0435\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f, \u0441\u043a\u043e\u0440\u0435\u0435 \u0443\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u043c, \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437 \u0431\u044b\u043b\u043e \u0442\u0430\u043a\u0436\u0435).<\/p>\n<figure class=\"\">\n<div><figcaption>\u0421\u043f\u0438\u0441\u043e\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0438\u0437 datasheet<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\"><strong>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">NOP<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0435\u0437 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">INC<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">ISZ<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u043e\u043f\u0443\u0441\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430, \u0435\u0441\u043b\u0438 \u043e\u043d \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">ADD<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u043a \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0443 \u0441 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u043e\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">SUB<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0438\u0437 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0441 \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">LD<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0432 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"107\" width=\"107\">\n<p align=\"left\">XCH<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0431\u043c\u0435\u043d \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0438 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0418\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u044b\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043f\u0443\u0442\u0451\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<pre><code class=\"python\">    # NOP instruction (No Operation)     def NOP(self):         self.pc += 1      # INC instruction (Increment index register)     def INC(self):         self.acc = (self.acc + 1) % 256         self.pc += 1      # ISZ instruction (Increment index register skip if zero)     def ISZ(self, address):         self.memory[address] = (self.memory[address] + 1) % 256          if self.memory[address] == 0:             self.pc += 2         else:             self.pc += 1      # ADD instruction (Add index register to accumulator with carry)     def ADD(self, address):         self.acc = (self.acc + self.memory[address]) % 256         self.pc += 2      # SUB instruction (Subtract index register to accumulator with borrow)     def SUB(self, address):         self.acc = (self.acc - self.memory[address]) % 256         self.pc += 2      # LD instruction (Load index register to Accumulator)     def LD(self, address):         self.acc = self.memory[address]         self.pc += 2      # XCH instruction (Exchange index register and accumulator)     def XCH(self, address):         temp = self.acc         self.acc = self.memory[address]         self.memory[address] = temp         self.pc += 2<\/code><\/pre>\n<p>\u041e\u0431\u043e \u0432\u0441\u0451\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n<ul>\n<li>\n<p>NOP \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 (pc) \u043d\u0430 1, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435.  <\/p>\n<\/li>\n<li>\n<p>INC \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 (acc) \u043d\u0430 1, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044f \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u043e 0-255, \u0438 \u0437\u0430\u0442\u0435\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 pc \u043d\u0430 1.  <\/p>\n<\/li>\n<li>\n<p>ISZ \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u044f\u0447\u0435\u0439\u043a\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u043d\u0430 1, \u0441\u043d\u043e\u0432\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044f \u0435\u0433\u043e \u0434\u043e 0-255. \u0415\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u044f\u0447\u0435\u0439\u043a\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u044b\u043c 0, pc \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 2, \u0438\u043d\u0430\u0447\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 1.  <\/p>\n<\/li>\n<li>\n<p>ADD \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u044f\u0447\u0435\u0439\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u043e 0-255 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 pc \u043d\u0430 2.  <\/p>\n<\/li>\n<li>\n<p>SUB \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u044f\u0447\u0435\u0439\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u043e 0-255 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 pc \u043d\u0430 2.  <\/p>\n<\/li>\n<li>\n<p>LD \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u044f\u0447\u0435\u0439\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u0432 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 pc \u043d\u0430 2.  <\/p>\n<\/li>\n<li>\n<p>XCH \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u044f\u0447\u0435\u0439\u043a\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 pc \u043d\u0430 2.  <\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f run, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u044b \u043e\u043f\u043a\u043e\u0434\u044b \u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"python\">    def run(self):         while self.pc &lt; len(self.memory):             opcode = self.memory[self.pc]              # NOP instruction opcode             if opcode == 0x0:                 self.NOP()              # INC instruction opcode             elif opcode == 0x6:                 self.INC()              # ISZ instruction opcode             elif opcode == 0x7:                 self.ISZ(self.memory[self.pc + 1])              # ADD instruction opcode             elif opcode == 0x8:                 self.ADD(self.memory[self.pc + 1])              # SUB instruction opcode             elif opcode == 0x9:                 self.SUB(self.memory[self.pc + 1])              # LD instruction opcode             elif opcode == 0xA:                 self.LD(self.memory[self.pc + 1])              # XCH instruction opcode             elif opcode == 0xB:                 self.XCH(self.memory[self.pc + 1])              else:                 print('Unknown opcode!!!')                 return              self.pc += 1<\/code><\/pre>\n<h3>\u041a\u0430\u043a \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430?<\/h3>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430\u0434\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u044f\u043c\u043e \u0432 \u043a\u043e\u0434\u0435, \u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0432 <a href=\"https:\/\/github.com\/YuraFX\/i4004-py\/blob\/main\/src\/program.py\" rel=\"noopener noreferrer nofollow\">program.py<\/a>. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 12 \u0447\u0438\u0441\u043b\u043e 5 \u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0447\u0438\u0441\u043b\u043e 2:<\/p>\n<pre><code class=\"python\">from cpu import CPU  cpu = CPU()  # Write the numbers 12, 5 and 2 to memory at arbitrary addresses (e.g. 0x10, 0x11 and 0x12) cpu.memory[0x10] = 12 cpu.memory[0x11] = 5 cpu.memory[0x12] = 2  # Execute the commands to subtract the numbers 12 and 5, and then add the number 2 to the resulting number cpu.LD(0x10) cpu.SUB(0x11) cpu.ADD(0x12) cpu.NOP()  # The result of the program will be stored in the accumulator print('') print(f'  Result: {cpu.acc}') print('')<\/code><\/pre>\n<figure class=\"full-width\">\n<div><figcaption>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b  <\/figcaption><\/div>\n<\/figure>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u044f \u0443\u0447\u0451\u043b \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0438 \u0432 \u044d\u0442\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0451 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u0435\u0440\u043d\u044b\u043c.<\/p>\n<p>\u0423 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u0434\u0435\u0438 \u043f\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 4004-\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 tkinter, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u043a\u043d\u043e, \u0433\u0434\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0438 \u0435\u043c\u0443 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (\u0434\u0430\u0431\u044b \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u0430\u043c Python, \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 IDE \u043a \u043d\u0435\u043c\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438 \u0442\u0435\u0441\u0442\u0430 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430).<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043c\u043e\u0451\u043c <a href=\"https:\/\/github.com\/YuraFX\/i4004-py\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>.<\/p>\n<p>\u0421 \u0432\u0430\u043c\u0438 \u0431\u044b\u043b Yura_FX. \u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u0434\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043c\u043d\u0435\u043d\u0438\u0435\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \ud83d\ude42  <\/p>\n<\/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\/805825\/\"> https:\/\/habr.com\/ru\/articles\/805825\/<\/a><br \/><\/br><\/br><\/p>\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-372915","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/372915","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=372915"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/372915\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=372915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=372915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=372915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}