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

Info iconThis 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
Background image of page 1

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

View Full DocumentRight 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.
Background 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
Background image of page 3

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

View Full DocumentRight 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.
Background 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, SIX LD R2, NUMBER AND
Background image of page 5

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

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

Page1 / 16

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

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online