{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lec16 - Computer Programming I TA C162 Todays Agenda...

Info icon This preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Computer Programming I TA C162 15/02/07 Today’s Agenda Assembly Language Programming Assembly Process First Pass Symbol Table Second Pass Machine Language Linking and Loading More Programming Examples
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Computer Programming I TA C162 15/02/07 Assembly Process Convert assembly language file (.asm) into an executable file  (.obj) for the LC-3 simulator.
Image of page 2
3 Computer Programming I TA C162 15/02/07 Assembly Process First Pass: Scan program file Find all labels and calculate the corresponding addresses;  this is called the  symbol table Second Pass: Convert instructions to machine language, using  information from symbol table
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 Computer Programming I TA C162 15/02/07 First Pass: Constructing the Symbol Table 1. Find the  . ORIG  statement, which tells us the  address of the first instruction. Initialize location counter (LC), which keeps track of the  current instruction. 2. For each non-empty line in the program: If line contains a label, add label and LC to symbol table Increment LC NOTE:  If statement is  . BLKW  or  . STRINGZ , increment LC by the number of words allocated. 1. Stop when  . END  statement is reached. NOTE: A line that contains only a comment is considered an empty line.
Image of page 4
5 Computer Programming I TA C162 15/02/07 Construct the symbol table for the program ; ; Program to multiply a number by the constant 6 ; .ORIG x3050 LD R1,
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern