LC3 Assembler Labels - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

LC3 Assembler Labels

Description:

Lables are normally used as the target of a branch ... Comments are for people who read the program or to help remind you ... comments clutter up a ... – PowerPoint PPT presentation

Number of Views:262
Avg rating:3.0/5.0
Slides: 10
Provided by: bobc2
Category:

less

Transcript and Presenter's Notes

Title: LC3 Assembler Labels


1
LC3 Assembler Labels
  • Labels are case sensitive
  • Lables are 1 to 10 alphabetic or numeric
    characters.
  • Lables are normally used as the target of a
    branch statement, BRp AGAIN
  • Labels are used to name a location for a value
    that is loaded or stored.
  • Any statement can have a label but there is no
    need unless the location is referenced.

2
LC3 Assembler Comments
  • Comments are for people who read the program or
    to help remind you of something.
  • A semicolon indicates that the rest of the line
    is a comment.
  • A comment may follow a statement or it may be the
    first character on a line.
  • Too many comments clutter up a program
  • Use a comment(s) at the start of your programs to
    give your name, assignment , email

3
LC3 Assembler Pseudo-ops
  • A better name might be assembler directives
  • Once the assembler handles the directive or
    message, then it is discarded.
  • The LC3 has 5 Pseudo-Ops
  • .ORIG
  • .FILL
  • .BLKW
  • .STRINGZ
  • .END

4
LC3 .ORIG
  • .ORIG tells the assembler where in memory to
    start the program. Many people use .ORIG x3000
  • It is usually better to take an easy location
    since .ORIG x3C4D will work but it makes it
    harder to follow the memory locations.
  • A program can only have one .ORIG statement and
    not 2. If you want to write a program to load in
    different parts of memory, then write it in two
    parts.

5
LC3 .FILL
  • .FILL sets aside a memory location and fills it
    with the value of the operand. Dont confuse this
    with define in C.
  • .FILL is useful for constants or to name memory
    locations.
  • SEVEN .FILL 7 this will store a 7 in the
    location and name it SEVEN
  • TEMP .FILL 0 this will name the location TEMP
    and store a 0 in it.

6
LC3 .BLKW
  • .BLKW reserves a Block of Words or sequential
    memory locations. The operand indicates the
    number to reserve.
  • Used to reserve some locations where data will be
    stored during execution of the program.
  • Could also be used to store a table of data.

7
LC3 - .STRINGZ
  • Stores a string of characters.
  • Uses n1 memory locations and each location
    stores one character in zero-extended ascii code.
  • Terminates string with x0000
  • Characters to be stored are enclosed with double
    quotations.
  • HELLO .STRINGZ Hello World!

8
LC3 .END
  • Indicates where the program ends.
  • Anything after .END is ignored.
  • .END does not stop the program, it only tells the
    assembler that this is the end of the source
    program.

9
LC3 - Examples
  • ADD1to5.asm
  • Mult6by4.asm
  • GET11-7.asm
  • shift-left-4.asm
  • Loop Counter
  • Two-Part Program
  • first.asm
  • second.asm
Write a Comment
User Comments (0)
About PowerShow.com