<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>white-flame</author><text>Static optimization to inlined code that ONLY handles immediate numbers and addresses is fine, and interesting to see the full pipeline working.  But that possibility is there really for any language and any asm platform.  I remember seeing Forth compile down to 6502 or other asm code, where it compiled down to the asm instructions a human would write for the same task, with basically zero language overhead.&lt;p&gt;HOWEVER, that was because the code written only did things similar to assembly instructions, similar to this example.&lt;p&gt;The biggest problem with compiling C family languages to 6502 is the stack.  They generally assume something like a  local stack frame for variables and parameters, and there&amp;#x27;s no way to directly express that style of programming at the 6502 instruction level.  Note that there were no local variables in these examples, much less any actual function calls.  Certainly the ABI used by C would not be machine-code-translatable from x86 to 6502; there would be an ABI written for 6502 and higher level targeting could work.&lt;p&gt;Instead of generating &amp;amp; trying to translate x86 assembly code, compiling C++14 down to plain C and using a 6502 compiler like cc65 could work significantly better for more idiomatic C++.&lt;p&gt;While it&amp;#x27;s an interesting novelty, why write 50+ lines of C++ code when writing 7 lines of commented, well-understood assembly instructions suffice?  Add some variables and macros to take care of naming the various bits &amp;amp; locations, or target some codegen directly to 6502 if we&amp;#x27;re talking about programming &amp;quot;in the large&amp;quot; relatively speaking.  Sure, you don&amp;#x27;t want to touch x64 code for human writing in the general case, but 6502 was designed with hand coding in mind.</text><parent_chain></parent_chain></comment><story><title>C++14 for the Commodore 64 [video]</title><url>https://www.youtube.com/watch?v=nLv_INgaLq8</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>richard_todd</author><text>My eyes couldn&amp;#x27;t look away from the extra &amp;quot;= 0x01&amp;quot; at the top; it was driving me nuts.  Glad he noticed it before the end of the video.&lt;p&gt;The middle part got me thinking: how helpful is it really, to write 50+ lines of high-level code, just to get 8 assembly instructions?  I get that it&amp;#x27;s more readable and whatever, but seriously, I might rather write the 8 assembly lines and be done with it. Maybe I&amp;#x27;ve spent too much time on comp.lang.forth lately :)</text><parent_chain></parent_chain></comment><story><title>C++14 for the Commodore 64 [video]</title><url>https://www.youtube.com/watch?v=nLv_INgaLq8</url></story>