{"id":5427,"date":"2014-03-30T21:53:34","date_gmt":"2014-03-30T21:53:34","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-can-i-become-good-at-assembly-collection-of-common-programming-errors\/"},"modified":"2014-03-30T21:53:34","modified_gmt":"2014-03-30T21:53:34","slug":"how-can-i-become-good-at-assembly-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-can-i-become-good-at-assembly-collection-of-common-programming-errors\/","title":{"rendered":"How can I become good at assembly?-Collection of common programming errors"},"content":{"rendered":"<p>First, how do one define &#8220;good assembly code&#8221;? The fastest code, the most ABI compliant code, or the code which is easiest to read? I think &#8220;good&#8221; depends on the overall goal, and you didn&#8217;t really tell us what you want to use assembly for.<\/p>\n<p>Others recommended writing a software rasterizer. I could latch onto that, but since you already know the x86 mnemonics, you don&#8217;t really need to write more assembly code. What you need is more insight in how machines work under the hood.<\/p>\n<p>My suggestion is to write a system-wide or user-space emulator. I wrote a system-emulator for ARM920, and learned a ton, without writing a single assembly mnemonic! Okay, it ended up dead slow, but I wrote it as an interpreter in pure C. I now know most of the ARM architecture&#8217;s dark secrets and it gave me a new perspective on how embedded computers work.<\/p>\n<p>Just remember, peripherals can be complex to emulate. There is nothing wrong with emulating the CPU, but adding simplified psuedo-peripherals. If you&#8217;re good, you could even make a plug&amp;play system for them.<\/p>\n<p>You might want to check out the QEMU and DosBox sources to get some good ideas, though they use a JIT scheme. My interpreter is found here gp2xemu. It was an attempt at an emulator for the GP2x, but I got stuck due to sucky documentation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>First, how do one define &#8220;good assembly code&#8221;? The fastest code, the most ABI compliant code, or the code which is easiest to read? I think &#8220;good&#8221; depends on the overall goal, and you didn&#8217;t really tell us what you want to use assembly for. Others recommended writing a software rasterizer. I could latch onto [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5427","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5427"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5427\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}