Skip to content

The Assembly Template

Video: The LC-3 Assembly Template — Text Alternative

This video demonstrates the structure of the LC-3 assembly template in LC3Tools. Key elements visible on screen:

  • Header comment block: lines beginning with ; for Assignment, Module, Name, Description, and Notes
  • .ORIG x3000: assembler directive setting the program's starting memory address to x3000
  • Done HALT: final executable instruction — Done is an optional label; HALT stops the processor clock
  • ;End of Program: comment marking that no code executes after HALT
  • ;Data Declarations: section below HALT for allocating memory locations and defining data
  • .END: assembler directive marking the end of the source file

Students will use and complete the assembly template for all graded work. This file is in the LC-3 Docs zip file downloaded earlier

LC-3 assembly template showing the header comment block, .ORIG x3000 directive, HALT instruction, and .END directive

The top section with lines started by a semicolon (;) is filled in with assignment and student name info. There is a line to describe the program at a high level and another to include any notes ot comments

Main Body

The program will be written between the .ORIG x3000 and the ;End of Program lines.

lc-3
.ORIG x3000

Done HALT

;End of Program

.ORIG x3000 is the assembler directive that identifies memory location 300016 as the location to load and execute the program

Done HALT is the last executable line of code in an assembly program

Done is an optional label used to other parts of the program to terminal the program early

HALT is a build-in function that stops the system clock so that no more instructions can execute

;End of Program is a comment to remind programs that no code will be executed after HALT

Data Declarations

The area under the ;Data Declarations------------- comment is reserved for allocating memory locations and initialized data

Code End

Like .ORIG, .END is an assembler directive informing that there is no more programs or data allocations to assemble

The contents of this E-Text were developed under an Open Textbooks Pilot grant from the Fund for the Improvement of Postsecondary Education (FIPSE), U.S. Department of Education. However, those contents do not necessarily represent the policy of the Department of Education, and you should not assume endorsement by the Federal Government.
Released under Creative Commons BY NC 4.0 International License