70 likes | 188 Views
This lecture focuses on LC-3 Assembly Language, revisiting the assembler and its components, which include instructions, directives, and labels. Students will delve into the two-pass assembly process, emphasizing its role in defining RAM addresses and translating instructions into binary patterns. Basic programming constructs such as assignment statements, arithmetic calculations, and conditional execution will also be discussed. The session concludes with Assignment 4, which involves designing a counting loop to sum a list of numbers, integrating key programming principles.
E N D
ENGR 330: Today’s Class • Homework • More LC-3 Assembly Language • Revisit the Assembler • Basic programming constructs • Assignment 4 R. Smith - University of St Thomas - Minnesota
Homework Issues • Programming problems? • Tool problems? R. Smith - University of St Thomas - Minnesota
Revisit the Assembler • Goal: produce a pattern of words to store in RAM, usually including machine instructions • Language has 3 parts • Instructions – 1 word each • Directives that adjust things • .ORIG to set starting address • .BLKW to set aside a block of words • .FILL to fill a word with a specific value • .END to mark the end • Labels – column 1 – stand for RAM addresses R. Smith - University of St Thomas - Minnesota
Two Pass Assembly • Without it, you can’t do forward branches • WHY? • Because the first pass defines ALL RAM address labels • Pass 1 • Counts the number of words being assembled • One per instruction; one per .FILL • .BLKW may use many • Assigns values to RAM address labels • Pass 2 • Really translate the instructions into bit patterns • Convert RAM address labels to numbers as needed R. Smith - University of St Thomas - Minnesota
Basic programming constructs • What to our classic languages provide • Java, C, Ada, Pascal, Basic, Visual Basic, etc. ? • Assignment statements • Arithmetic calculations • Conditional execution (IF statements) • Looping (Do, For, While, Repeat, ...) • We can do any of these, but we construct them out of multiple instructions R. Smith - University of St Thomas - Minnesota
Assignment 4 • Add up a list of numbers • List is prefixed by a count of how many to add • Problem: how do we do a counting loop? • Leading decision vs trailing decision • Boundary conditions and condition codes R. Smith - University of St Thomas - Minnesota
The Programming Process • Identify the details of the problem: what are the inputs, what are the results, what working storage do you need • Write out a list of computer steps to solve the problem – one step = the work of 1 or 2 instructions, no more or less • Translate each step into the actual instructions R. Smith - University of St Thomas - Minnesota