TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A C++ Developer Learns Assembly

51 pointsby rjinman7 months ago

6 comments

pjc507 months ago
&gt; There weren&#x27;t really any new concepts to grasp, it was just extremely fiddly<p>&gt; The need to keep things simple tempered any urge I might&#x27;ve had to generalise prematurely with needless abstraction<p>Probably the defining characteristics of assembly. Not only does it not provide abstractions, it doesn&#x27;t provide any metaprogramming tools (other than simple text macros) to help you build any either.<p>For a long time I&#x27;ve had in my ideas folder the phrase &quot;typesafe macro assembler?&quot; The idea would be to build the language people sometimes think C is but isn&#x27;t: it would provide some sort of record type (struct), register allocation, checking to see if you&#x27;ve assigned one thing to a storage location of a different type, and little else. Possibly a means to define a calling convention for caller-saved vs callee-saved registers; possibly some basic structured programming block tools to de-sphagetti your code. Crucially, it would emit exactly the operations you specify (including weirder mnemonic instructions and highly platform specific ones) in the order you specify them.
评论 #41733461 未加载
tuckerpo7 months ago
I did roughly the same thing many moons ago as the final &quot;exam&quot; for my undergraduate embedded systems course. We made Space Invaders, though :^) <a href="https:&#x2F;&#x2F;github.com&#x2F;tuckerpo&#x2F;MicroSpaceInvaders">https:&#x2F;&#x2F;github.com&#x2F;tuckerpo&#x2F;MicroSpaceInvaders</a><p>We targetted a real SoC, though, so a lot of my implementation can be thought of as a &quot;board support package&quot; or HAL, twiddling LEDs, taking in input, TTY in&#x2F;out, i2c, timers, IRQ&#x2F;FIQ handlers, etc...<p>Assembly programming in general is more or less just getting a feel for any given ISA&#x27;s most important instructions, mnemonics ordering and data&#x2F;code separation. The rest is a walk in the park if you&#x27;re comfortable with boring old procedural programming.
ykonstant7 months ago
Finally, someone who uses a sane build system! :D
Irus_247 months ago
Thanks for sharing your experience learning assembly. I&#x27;m curious about the resources you used in your learning journey. Could you share some of the books name, tutorials, or other materials you found particularly helpful?
rep_lodsb7 months ago
non-JS URL: <a href="https:&#x2F;&#x2F;content.deadbeef.io&#x2F;pages&#x2F;a_cpp_developer_learns_assembly.html" rel="nofollow">https:&#x2F;&#x2F;content.deadbeef.io&#x2F;pages&#x2F;a_cpp_developer_learns_ass...</a><p>Sadly it doesn&#x27;t work on my system: the display is drawn at the start (sometimes partially), and then only ever updates when switching between virtual consoles.<p>Tried adding O_SYNC to the open flags for the framebuffer, and it didn&#x27;t help. It&#x27;s writing to the device 60 times per second, just won&#x27;t show for some reason.
评论 #41729760 未加载
snvzz7 months ago
<a href="https:&#x2F;&#x2F;archive.is&#x2F;d5tUv" rel="nofollow">https:&#x2F;&#x2F;archive.is&#x2F;d5tUv</a>