1 hour ago · 30 min read6058 words · Tech · hide · 0 comments

LC-3 assembly is an educational programming language. It is simple enough that complex programs can be written directly in it without needing a compiler, and thus it is often used in teaching assembly. An LC-3 textual assembly program is compiled to a binary object file by an assembler, and then executed by a virtual machine. Writing a virtual machine for LC-3 is a fun little exercise. However, in this post, we implement a disassembler for compiled LC-3 binaries back to textual assembly programs. This post was originally published on abhinavsarkar.net. ContentsIntroduction to LC-3Problem in Disassembling LC-3Setting UpDecoding InstructionsBasic DisassemblyFixed-Point CleanupPostprocessingPretty-PrintingReading the BinaryFinishing UpConclusion Introduction to LC-3# LC-3 has a simple instruction set with only 18 instructions. It works with eight 16-bit registers (numbered from 0 to 7), and 16-bit addressable memory. LC-3 instructions are also 16-bit, with first four bits used for…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.