{"id":27,"date":"2019-11-26T17:00:00","date_gmt":"2019-11-26T16:00:00","guid":{"rendered":"https:\/\/www.codemotion.com\/magazine\/how-to-build-an-emulator\/"},"modified":"2023-10-27T12:47:30","modified_gmt":"2023-10-27T10:47:30","slug":"how-to-build-an-emulator","status":"publish","type":"post","link":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/","title":{"rendered":"How to Build a Console Emulator"},"content":{"rendered":"\n<p>Here&#8217;s your quick guide to building your own console emulator! In the last decade, we have witnessed an increasing interest towards <b><a href=\"https:\/\/www.gameindustry.com\/news-industry-happenings\/retro-gaming-trends\/\" target=\"_blank\" aria-label=\"retrograming (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">retrograming<\/a><\/b>. We have of course great modern games nowadays, and impressive quality of graphics and AI behind them. However, many gamers cannot stop thinking about a Game Boy or <span id=\"urn:enhancement-e5a07d85\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/super_nintendo_entertainment_system\">Super Nintendo<\/span> Entertainment System (<span id=\"urn:enhancement-a0745043\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/super_nintendo_entertainment_system\">SNES<\/span>) with a certain degree of romanticism. It\u2019s first love &#8211; you never get over it.<\/p>\n\n\n\n<p>Although playing on an old console is usually much funnier, many consoles are not easily available nowadays, so gamers often rely on <b><span id=\"urn:enhancement-5a4b514d\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/emulator\">emulators<\/span><\/b>. But for the many gamers that are also developers, a question arises: <b>how are <span id=\"urn:enhancement-defbd67f\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/emulator\">emulators<\/span> developed<\/b>? Is it easy or not? Can I build an emulator?<\/p>\n\n\n\n<p>To answer these questions, <b>Marco Cuciniello<\/b>, <a class=\"ek-link wpil_keyword_link\" title=\"CTO\" data-wpil-keyword-link=\"linked\" href=\"https:\/\/www.codemotion.com\/magazine\/dev-hub\/cto\/how-to-become-cto\/\" target=\"_blank\" rel=\"noopener\">CTO<\/a> at Becreatives, delivered a very interesting speech during <b>Codemotion Rome 2019<\/b>, explaining how <span id=\"urn:enhancement-57d992c1\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/emulator\">emulators<\/span> work and how it is possible to implement them. While this usually requires performant low level languages like C or C++, for the sake of clarity he explained how to develop a very simple emulator in <b><span id=\"urn:enhancement-47d53d70\" class=\"textannotation disambiguated wl-creative-work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/python_programming_language\">Python<\/span><\/b>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-is-an-emulator\">What is an Emulator<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/01\/lorenzo-herrera-p0j-mE6mGo4-unsplash-1024x683.jpg\" alt=\"console emulators, retrogaming, build your emulator\" class=\"wp-image-16888\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/01\/lorenzo-herrera-p0j-mE6mGo4-unsplash-1024x683.jpg 1024w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/01\/lorenzo-herrera-p0j-mE6mGo4-unsplash-300x200.jpg 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/01\/lorenzo-herrera-p0j-mE6mGo4-unsplash-768x512.jpg 768w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2022\/01\/lorenzo-herrera-p0j-mE6mGo4-unsplash-1536x1024.jpg 1536w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>console emulators, retrogaming, build your emulator<\/figcaption><\/figure>\n\n\n\n<p>Basically, an emulator or console emulator is <span id=\"urn:enhancement-5ed09345\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">software<\/span> that is able to read and interpret the content of a game file, also known as a <b><span id=\"urn:enhancement-6419bfb4\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/read-only_memory\">ROM<\/span><\/b>, containing all the business logic of the game. Such ROMs are usually read from cartridges or CDs, and dumped on files to be easily portable and distributable. What a <span id=\"urn:enhancement-dc3ef9ba\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/read-only_memory\">ROM<\/span> contains is a set of instructions in machine code (easily converted in <b>Assembly<\/b>, if needed), representing the whole game.<\/p>\n\n\n\n<p>The role of the emulator is thus to act as a computer, implementing a virtual <span id=\"urn:enhancement-41b085c5\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/central_processing_unit\">CPU<\/span> (with the well-know <b>fetch-decode-execute cycle<\/b>), memory and registers (including both data register and the program counter). Memory can be implemented as an array, registers are variables and all the instructions need to be read and decoded, before finally being executed.<\/p>\n\n\n\n<center><br><figure><img decoding=\"async\" class=\"aligncenter size-full wp-image-5497\" style=\"max-width: 650px; height: auto;\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/emulator.png\" alt=\"Implementing fetch-decode-execute cycle in Python\"><\/figure><\/center>\n\n\n\n<p>When you have to develop an <span id=\"urn:enhancement-f53fd569\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/emulator\">emulator<\/span>, the first thing you have to do is thus to <b>understand the <span id=\"urn:enhancement-76b92b4d\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_architecture\">architecture<\/span><\/b> of the machine you are trying to emulate. This is not so easy, but a lot of information can be found by looking on the Internet. For instance, you will need to know the <span id=\"urn:enhancement-dcf95d0b\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/instruction_set\">instruction<\/span> set, the number and type of registers, as well as the size of the memory. All this information is crucial to correctly implement the final console <span id=\"urn:enhancement-8cbbdc57\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/emulator\">emulator<\/span>, since the <span id=\"urn:enhancement-923ddcad\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/instruction_set\">instructions<\/span> are all based on the same <span id=\"urn:enhancement-b05e4c6d\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_architecture\">architecture<\/span>.<\/p>\n\n\n\n<p>Of course, simple <span id=\"urn:enhancement-ae04c643\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_architecture\">architectures<\/span> like those of the first consoles are easier to implement. You cannot compare the complexity of a first-generation console like the Ping-O-Tronic with a Sony Playstation! For our purposes, in the following we will consider an extremely simple machine based on the <span id=\"urn:enhancement-740f98de\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_architecture\">architecture<\/span> of <b><span id=\"urn:enhancement-df5b61b1\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/chip-8\">CHIP-8<\/span><\/b>, a simple virtual machine that has been widely used for didactic purposes and that can run very simple games. A <span id=\"urn:enhancement-94af8b3e\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/chip-8\">CHIP-8<\/span> machine is based on 2-<span id=\"urn:enhancement-cdd97ad4\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/byte\">bytes<\/span> <span id=\"urn:enhancement-208e9f86\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/instruction_set\">instructions<\/span>, 16 <span id=\"urn:enhancement-53e733b5\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/8-bit\">8-bit<\/span> data registers named from V0 to VF and a memory of 4096 <span id=\"urn:enhancement-dfa8c1c7\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/8-bit\">8-bit<\/span> locations. The full technical reference for <span id=\"urn:enhancement-902a2234\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/chip-8\">CHIP-8<\/span>, including the <span id=\"urn:enhancement-f4afef20\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/instruction_set\">instruction<\/span> set, is available at <a href=\"http:\/\/devernay.free.fr\/hacks\/chip8\/C8TECH10.HTM\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">this link<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-a-chip-8-emulator-in-python\">A CHIP-8 Emulator in Python<\/h2>\n\n\n\n<p>During his talk, Marco Cuciniello explained how to implement an <span id=\"urn:enhancement-23b12fb7\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/emulator\">emulator<\/span> for the <span id=\"urn:enhancement-8f5bd1f8\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/chip-8\">CHIP-8<\/span> <span id=\"urn:enhancement-b7f20254\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_architecture\">architecture<\/span> using Python. Of course, a proper implementation would require a more efficient <span id=\"urn:local-annotation-917151\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/programming_languages\">programming language<\/span>, possibly compiled and not interpreted, like for instance <span id=\"urn:local-annotation-301647\" class=\"textannotation disambiguated\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/c\">C<\/span> or <span id=\"urn:local-annotation-555447\" class=\"textannotation disambiguated\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/c___2\">C++<\/span>. As explained in the introduction, the rationale behind choosing Python is to exploit its readability and simplicity.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-memory\">Memory<\/h3>\n\n\n\n<p>Implementing memory is probably the simplest thing to do here. We just need a list of 4096 values, which is just a single line of code in Python:<\/p>\n\n\n\n<center><br><figure><img decoding=\"async\" class=\"aligncenter size-full wp-image-5496\" style=\"max-width: 650px; height: auto;\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/memory.png\" alt=\"Implementing emulator's memory in Python\"><\/figure><\/center>\n\n\n\n<p>The previous scheme shows another interesting detail: software data is all stored between the memory addresses 0x200 and 0xFFF. Consequently, we need to load the content of a <span id=\"urn:enhancement-c6c98434\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/read-only_memory\">ROM<\/span> to the proper <span id=\"urn:enhancement-7f9352d8\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_memory\">memory<\/span> section.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">\ndef load_rom(<span class=\"hljs-keyword\">self<\/span>, path):\n    rom = open(path, <span class=\"hljs-string\">'rb'<\/span>).read()\n\n    <span class=\"hljs-keyword\">for<\/span> index, val in enumerate(rom):\n        <span class=\"hljs-keyword\">self<\/span>.memory&#91;<span class=\"hljs-number\">0x200<\/span> + index] = val\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-registers\">Registers<\/h3>\n\n\n\n<p>Once the use of <span id=\"urn:enhancement-2e4b7691\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_memory\">memory<\/span> is clarified, it is important to look at how to implement the registers. CHIP-8 requires 16 <span id=\"urn:enhancement-4b701dd7\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/8-bit\">8-bit<\/span> registers, which can be implemented as follows:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">\nV = &#91;0] * 16\n<\/code><\/span><\/pre>\n\n\n<p>In addition to these, there are other two registers: the <b><span id=\"urn:enhancement-fb6501bf\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/program_counter\">program counter<\/span><\/b> (PC) and an additional register (I) used for instructions that involve <span id=\"urn:enhancement-be9964e2\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_memory\">memory<\/span>:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">\nPC = 0\nI = 0\n<\/code><\/span><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-instructions\">Instructions<\/h3>\n\n\n\n<p>Now that we have clear how to implement <span id=\"urn:enhancement-4c71b7f5\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_memory\">memory<\/span> and registers, we can have a look at the console emulator instructions. The first problem to solve is how to retrieve the next instruction from the <span id=\"urn:enhancement-471c0e03\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_memory\">memory<\/span>. We can proceed as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">\n<span class=\"hljs-keyword\">self<\/span>.opcode = (<span class=\"hljs-keyword\">self<\/span>.memory&#91;<span class=\"hljs-keyword\">self<\/span>.PC] &lt;&lt; <span class=\"hljs-number\">8<\/span>) |\n<span class=\"hljs-keyword\">self<\/span>.memory&#91;<span class=\"hljs-keyword\">self<\/span>.PC + <span class=\"hljs-number\">1<\/span>]\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The instruction is thus saved in <i>self.opcode<\/i>. To use it properly, we need to <b>decode<\/b> it, which means that we have to understand what it means, and execute the proper actions. CHIP-8\u2019s instructions are made up of 2 <span id=\"urn:enhancement-e99819f5\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/byte\">bytes<\/span> and they can have different formats (again, you can find the full list at <a href=\"http:\/\/devernay.free.fr\/hacks\/chip8\/C8TECH10.HTM\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">this link<\/a>). Generally, the first <span id=\"urn:enhancement-f77905fd\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/bit\">bits<\/span> allow us to understand what the instruction should do, while the last <span id=\"urn:enhancement-ba053e70\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/bit\">bits<\/span> contain the <span id=\"urn:enhancement-99191e60\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/data\">data<\/span> (e.g. register numbers or addresses) that have to be used by such instruction.<\/p>\n\n\n\n<p>There are several formats for instructions. For instance, the format for a CALL is 0x2NNN (e.g. 0x22F6), where NNN is the address to be called. Assignment instructions have instead a different format, which 0xXY0, where X represents the destination register number and Y is the number of the register that contains <span id=\"urn:enhancement-ce339a70\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/data\">data<\/span> to be assigned. Other instructions have a format like 0x3XNN. The following <span id=\"urn:enhancement-f4393dcf\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/source_lines_of_code\">lines of code<\/span> allow us to split the instruction in the different fields that compose it:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">\n<span class=\"hljs-keyword\">self<\/span>.arg_x = (<span class=\"hljs-keyword\">self<\/span>.opcode &amp; <span class=\"hljs-number\">0x0f00<\/span>) &gt;&gt; <span class=\"hljs-number\">8<\/span>\n<span class=\"hljs-keyword\">self<\/span>.arg_y = (<span class=\"hljs-keyword\">self<\/span>.opcode &amp; <span class=\"hljs-number\">0x00f0<\/span>) &gt;&gt; <span class=\"hljs-number\">4<\/span>\n<span class=\"hljs-keyword\">self<\/span>.arg_xnnn = <span class=\"hljs-keyword\">self<\/span>.opcode &amp; <span class=\"hljs-number\">0xfff<\/span>\n<span class=\"hljs-keyword\">self<\/span>.arg_xxnn = <span class=\"hljs-keyword\">self<\/span>.opcode &amp; <span class=\"hljs-number\">0x00ff<\/span>\n<span class=\"hljs-keyword\">self<\/span>.arg_xxxn = <span class=\"hljs-keyword\">self<\/span>.opcode &amp; <span class=\"hljs-number\">0x000f<\/span>\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Based on the previous variables, we can for instance decode an assignment instruction like 0x8230 as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">\n<span class=\"hljs-keyword\">self<\/span>.V&#91;<span class=\"hljs-keyword\">self<\/span>.arg_x] = <span class=\"hljs-keyword\">self<\/span>.V&#91;<span class=\"hljs-keyword\">self<\/span>.arg_y]\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>You should see now that implementing all the different kinds of instructions is a very long process and also, if in principle it is not so difficult, it requires a lot of patience and attention, since bugs are around the corner.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-display\">Display<\/h3>\n\n\n\n<p>One of the most important parts of a game is the management of the display, since it represents the main interaction for the <span id=\"urn:enhancement-531805cc\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/gamer\">gamer<\/span>. <span id=\"urn:enhancement-1c847d37\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/chip-8\">CHIP-8<\/span> required a 64&#215;32 monochromatic display, which can be easily implemented with the help of an external library in our programming language. In the case of <span id=\"urn:enhancement-984af3ce\" class=\"textannotation disambiguated wl-creative-work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/python_programming_language\">Python<\/span>, we may decide to rely on <b>Pyxel<\/b>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">\ndef update(<span class=\"hljs-keyword\">self<\/span>):\n    <span class=\"hljs-keyword\">self<\/span>.display_change = <span class=\"hljs-keyword\">False<\/span>\n    <span class=\"hljs-keyword\">self<\/span>.fetch()\n    <span class=\"hljs-keyword\">self<\/span>.decode()\n    <span class=\"hljs-keyword\">self<\/span>.execute()\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-keyboard\">Keyboard<\/h3>\n\n\n\n<p>Last but not least, we need to provide the <span id=\"urn:enhancement-2476791e\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/gamer\">gamers<\/span> with a way to send <span id=\"urn:enhancement-78e48887\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command_computing\">commands<\/span> to the game. In other <span id=\"urn:enhancement-6a1ffd78\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/word_computer_architecture\">words<\/span>, we need to use the keyboard, integrating its use in our <span id=\"urn:enhancement-344503f8\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/emulator\">emulator<\/span>. <span id=\"urn:enhancement-1c061945\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/chip-8\">CHIP-8<\/span>\u2019s keyboard has <b>16 keys<\/b> (0-9, A-F) that we can map to the key codes available on Pyxel:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">\nkeys_dict = {\n    0x0: pyxel.KEY_KP_0,\n    0x1: pyxel.KEY_KP_1,\n    0x2: pyxel.KEY_KP_2,\n    0x3: pyxel.KEY_KP_3,\n    0x4: pyxel.KEY_KP_4,\n    0x5: pyxel.KEY_KP_5,\n    0x6: pyxel.KEY_KP_6,\n    0x7: pyxel.KEY_KP_7,\n    0x8: pyxel.KEY_KP_8,\n    0x9: pyxel.KEY_KP_9,\n    0xA: pyxel.KEY_A,\n    0xB: pyxel.KEY_B,\n    0xC: pyxel.KEY_C,\n    0xD: pyxel.KEY_D,\n    0xE: pyxel.KEY_E,\n    0xF: pyxel.KEY_F,\n}\n<\/code><\/span><\/pre>\n\n\n<p>Some of the <span id=\"urn:enhancement-b37fabe8\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/chip-8\">CHIP-8<\/span> <span id=\"urn:enhancement-3b4b82c1\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/instruction_set\">instructions<\/span> are aimed at allowing keyboard-based interaction. For instance, 0xE09E means that if a key with a value in V0 is pressed, the control must go to the next <span id=\"urn:enhancement-377cf62\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/instruction_set\">instruction<\/span>. Another example is 0xF00A, which stops the execution until a key is pressed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-the-best-architecture-for-a-console-emulator\">The best architecture for a console emulator<\/h2>\n\n\n\n<p>Now you should have a better overview of how a console emulator works and how to implement it. Of course, <span id=\"urn:enhancement-c8ca827d\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/chip-8\">CHIP-8<\/span> is probably the simplest architecture that you can implement on an <span id=\"urn:enhancement-dc290db8\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/emulator\">emulator<\/span>. However, while conceptually simple, creating a fully-working <span id=\"urn:enhancement-3f6875b2\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/chip-8\">CHIP-8<\/span> <span id=\"urn:enhancement-981e1b7b\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/emulator\">emulator<\/span> from scratch is far from straightforward; you will probably need to struggle with <span id=\"urn:enhancement-fb9d4f9f\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/debugging\">debugging<\/span> and implement a bunch of different <span id=\"urn:enhancement-e51dea9\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/instruction_set\">instructions<\/span>. Carrying out a simple project like this is not just a starting point, but it helps in understanding the wide range of issues that are behind the task of building any <span id=\"urn:enhancement-b2818509\" class=\"textannotation disambiguated wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/emulator\">emulator<\/span>.<\/p>\n\n\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s your quick guide to building your own console emulator! In the last decade, we have witnessed an increasing interest towards retrograming. We have of course great modern games nowadays, and impressive quality of graphics and AI behind them. However, many gamers cannot stop thinking about a Game Boy or Super Nintendo Entertainment System (SNES)&#8230; <a class=\"more-link\" href=\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":28,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":5,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[15],"tags":[4],"collections":[11388],"class_list":{"0":"post-27","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-gamedev","8":"tag-codemotion-rome","9":"collections-codemotion-guides","10":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Build a Console Emulator - Codemotion Magazine<\/title>\n<meta name=\"description\" content=\"Want to build an emulator? Here&#039;s a guide to getting your console emulator up and running in no time. It&#039;s retro gaming time!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Build a Console Emulator\" \/>\n<meta property=\"og:description\" content=\"Want to build an emulator? Here&#039;s a guide to getting your console emulator up and running in no time. It&#039;s retro gaming time!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/\" \/>\n<meta property=\"og:site_name\" content=\"Codemotion Magazine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Codemotion.Italy\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-26T16:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-27T10:47:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Vito Gentile\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ViGentile\" \/>\n<meta name=\"twitter:site\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vito Gentile\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/\"},\"author\":{\"name\":\"Vito Gentile\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/f9c99d8dfb99900d709bb8199225d313\"},\"headline\":\"How to Build a Console Emulator\",\"datePublished\":\"2019-11-26T16:00:00+00:00\",\"dateModified\":\"2023-10-27T10:47:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/\"},\"wordCount\":1235,\"publisher\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png\",\"keywords\":[\"Codemotion Rome\"],\"articleSection\":[\"Game Development\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/\",\"name\":\"How to Build a Console Emulator - Codemotion Magazine\",\"isPartOf\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png\",\"datePublished\":\"2019-11-26T16:00:00+00:00\",\"dateModified\":\"2023-10-27T10:47:30+00:00\",\"description\":\"Want to build an emulator? Here's a guide to getting your console emulator up and running in no time. It's retro gaming time!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#primaryimage\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png\",\"contentUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png\",\"width\":800,\"height\":600},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Frontend\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Game Development\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"How to Build a Console Emulator\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#website\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/\",\"name\":\"Codemotion Magazine\",\"description\":\"We code the future. Together\",\"publisher\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\",\"name\":\"Codemotion\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png\",\"contentUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png\",\"width\":225,\"height\":225,\"caption\":\"Codemotion\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Codemotion.Italy\/\",\"https:\/\/x.com\/CodemotionIT\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/f9c99d8dfb99900d709bb8199225d313\",\"name\":\"Vito Gentile\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ebcb5b885a4f1669578d08a55deb81064893c07c1b35b7b36eb059cce730ae90?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ebcb5b885a4f1669578d08a55deb81064893c07c1b35b7b36eb059cce730ae90?s=96&d=mm&r=g\",\"caption\":\"Vito Gentile\"},\"description\":\"I\u2019m a data scientist, tech writer, software developer with experience in mobile, web (full-stack) and Python programming, and former researcher with interests in human-computer interaction. I thus have a multi-faceted experience in the area of software development, and that\u2019s why I love my job(s)!\",\"sameAs\":[\"https:\/\/vitogentile.it\",\"https:\/\/www.linkedin.com\/in\/vitogentile\/en\",\"https:\/\/x.com\/ViGentile\"],\"url\":\"https:\/\/www.codemotion.com\/magazine\/author\/vito-gentile\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Build a Console Emulator - Codemotion Magazine","description":"Want to build an emulator? Here's a guide to getting your console emulator up and running in no time. It's retro gaming time!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/","og_locale":"en_US","og_type":"article","og_title":"How to Build a Console Emulator","og_description":"Want to build an emulator? Here's a guide to getting your console emulator up and running in no time. It's retro gaming time!","og_url":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/","og_site_name":"Codemotion Magazine","article_publisher":"https:\/\/www.facebook.com\/Codemotion.Italy\/","article_published_time":"2019-11-26T16:00:00+00:00","article_modified_time":"2023-10-27T10:47:30+00:00","og_image":[{"width":800,"height":600,"url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png","type":"image\/png"}],"author":"Vito Gentile","twitter_card":"summary_large_image","twitter_creator":"@ViGentile","twitter_site":"@CodemotionIT","twitter_misc":{"Written by":"Vito Gentile","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#article","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/"},"author":{"name":"Vito Gentile","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/f9c99d8dfb99900d709bb8199225d313"},"headline":"How to Build a Console Emulator","datePublished":"2019-11-26T16:00:00+00:00","dateModified":"2023-10-27T10:47:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/"},"wordCount":1235,"publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png","keywords":["Codemotion Rome"],"articleSection":["Game Development"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/","url":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/","name":"How to Build a Console Emulator - Codemotion Magazine","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#primaryimage"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png","datePublished":"2019-11-26T16:00:00+00:00","dateModified":"2023-10-27T10:47:30+00:00","description":"Want to build an emulator? Here's a guide to getting your console emulator up and running in no time. It's retro gaming time!","breadcrumb":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#primaryimage","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png","width":800,"height":600},{"@type":"BreadcrumbList","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/how-to-build-an-emulator\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codemotion.com\/magazine\/"},{"@type":"ListItem","position":2,"name":"Frontend","item":"https:\/\/www.codemotion.com\/magazine\/frontend\/"},{"@type":"ListItem","position":3,"name":"Game Development","item":"https:\/\/www.codemotion.com\/magazine\/frontend\/gamedev\/"},{"@type":"ListItem","position":4,"name":"How to Build a Console Emulator"}]},{"@type":"WebSite","@id":"https:\/\/www.codemotion.com\/magazine\/#website","url":"https:\/\/www.codemotion.com\/magazine\/","name":"Codemotion Magazine","description":"We code the future. Together","publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codemotion.com\/magazine\/#organization","name":"Codemotion","url":"https:\/\/www.codemotion.com\/magazine\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","width":225,"height":225,"caption":"Codemotion"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Codemotion.Italy\/","https:\/\/x.com\/CodemotionIT"]},{"@type":"Person","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/f9c99d8dfb99900d709bb8199225d313","name":"Vito Gentile","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ebcb5b885a4f1669578d08a55deb81064893c07c1b35b7b36eb059cce730ae90?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ebcb5b885a4f1669578d08a55deb81064893c07c1b35b7b36eb059cce730ae90?s=96&d=mm&r=g","caption":"Vito Gentile"},"description":"I\u2019m a data scientist, tech writer, software developer with experience in mobile, web (full-stack) and Python programming, and former researcher with interests in human-computer interaction. I thus have a multi-faceted experience in the area of software development, and that\u2019s why I love my job(s)!","sameAs":["https:\/\/vitogentile.it","https:\/\/www.linkedin.com\/in\/vitogentile\/en","https:\/\/x.com\/ViGentile"],"url":"https:\/\/www.codemotion.com\/magazine\/author\/vito-gentile\/"}]}},"featured_image_src":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong-600x400.png","featured_image_src_square":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong-600x600.png","author_info":{"display_name":"Vito Gentile","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/vito-gentile\/"},"uagb_featured_image_src":{"full":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png",800,600,false],"thumbnail":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong-150x150.png",150,150,true],"medium":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong-300x225.png",300,225,true],"medium_large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong-768x576.png",768,576,true],"large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png",800,600,false],"1536x1536":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png",800,600,false],"2048x2048":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png",800,600,false],"small-home-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong.png",100,75,false],"sidebar-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong-180x128.png",180,128,true],"genesis-singular-images":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong-800x504.png",800,504,true],"archive-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong-400x225.png",400,225,true],"gb-block-post-grid-landscape":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong-600x400.png",600,400,true],"gb-block-post-grid-square":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/08\/Pong-600x600.png",600,600,true]},"uagb_author_info":{"display_name":"Vito Gentile","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/vito-gentile\/"},"uagb_comment_info":1,"uagb_excerpt":"Here&#8217;s your quick guide to building your own console emulator! In the last decade, we have witnessed an increasing interest towards retrograming. We have of course great modern games nowadays, and impressive quality of graphics and AI behind them. However, many gamers cannot stop thinking about a Game Boy or Super Nintendo Entertainment System (SNES)&#8230;&hellip;","lang":"en","_links":{"self":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/27","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/comments?post=27"}],"version-history":[{"count":8,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/27\/revisions"}],"predecessor-version":[{"id":18333,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/27\/revisions\/18333"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media\/28"}],"wp:attachment":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media?parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/categories?post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/tags?post=27"},{"taxonomy":"collections","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/collections?post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}