LC3 Tools Reference

Assemblers, simulators, C compiler, IDEs, course sites, reference material.
(Also see user guides in this directory.)

LC3 Simulators and Assemblers and C Compiler.

P&P textbook's web site, student materials.
http://highered.mcgraw-hill.com/sites/0072467509/student_view0/lc-3_simulator.html

Other Sources for LC3 tools

Misc.

LC3 assembler tools, unix version (Lumetta)

Build these tools using gcc (see README in lc3tools-v12.zip distribution).
Contents:
--- lc3as:        LC3 assembler, produces .obj files.
--- lc3convert:   ascii to .obj converter.

lc3as

Assembles LC3 assembly source code to an .obj file.
Command            ---- Description 
-------------      ---------------------------
lc3as file.asm     ---- Creates file.obj and file.sym, the symbol table. 

Error Message                      ---- Explanation
------------------------           ---------------------------
file contains only comments        ---- no assembly instructions in file.
no .ORIG or .END directive found   ---- .ORIG/.END must be first/last line.
multiple .ORIG directives found    ---- one .ORIG is allowed per file. 
instruction appears before .ORIG   ---- instructions must start after .ORIG.
no .END directive found            ---- all programs must end with .END. 
label appears before .ORIG         ---- nothing should appear before .ORIG.
label has already appeared         ---- label can only be defined once.
unknown label x                    ---- label x is referenced, but not defined. 
illegal operands for x             ---- instruction has bad operand specification. 
unterminated string                ---- .STRINGZ has no close-quotes.
contains unrecognizable characters ---- found chars that assembler cannot parse. 
WARNING: All text after .END is ignored.

lc3convert

Convert ascii text version of a machine code .obj file to an actual executable machine code .obj file that can be run in the simulator. As with the actual lc3 .obj format, the first line must contain the load address of the first instruction: if the first line is
0011 0000 0000 0000,
then the first instruction will be located at x3000 when running the simulator. Since lc3convert is reading plain text files, it can handle some extras: (1) the ";" comment character causes the rest of the line to be ignored, (2) digits may have white space within them to help visually group them.
Command                     ---- Description 
-----------------           ---------------------------
lc3convert file.bin         ---- create file.obj, which can be run by simulator.
lc3convert -b2 file.bin     ---- text machine code is in binary (base 2). 
lc3convert -b16 file.bin    ---- text machine code is in hex (base 16). 

Error Message                      ---- Explanation
----------------------             ---------------------------
line contains only x digits        ---- only x digits of 16-bit instruction found.
line contains more than 16 digits  ---- instruction bigger than 16-bits.
contains unrecognizable characters ---- invalid characters were used.
constant outside of allowed range  ---- Immediate value exceeds instruction's range.