Compsci 210 Tutorial Five.

Slides:



Advertisements
Similar presentations
Chapter 7 Introduction to LC-3 Assembly Language Assembly Language Assembly Process Using the Editor & Simulator for Assembly Language Programming.
Advertisements

The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
PART 6 Programming 1.Decomposition 2.Three Constructs 3.Counting Example 4.Debugging.
COMPSCI 210 Semester Tutorial 6 – Revision.
Week 3. Assembly Language Programming  Difficult when starting assembly programming  Have to work at low level  Use processor instructions >Requires.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
Lab6 – Debug Assembly Language Lab
LC-3 and Assembly code (2).  Minh Nguyen,  Tutorials:  Office hours:
Overview Program in LC-3 machine language Use the Editor
Some thoughts: If it is too good to be true, it isn’t. Success is temporary. It is hard work to make it simple. Knowing you did it right is enough reward.
Agenda Shortcuts converting among numbering systems –Binary to Hex / Hex to Binary –Binary to Octal / Octal to Binary Signed and unsigned binary numbers.
Programming and Problem Solving
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
Floating Point Numbers
Choice for the rest of the semester New Plan –assembler and machine language –Operating systems Process scheduling Memory management File system Optimization.
Table 1. Software Hierarchy Levels.. Essential Tools An assembler is a program that converts source-code programs into a machine language (object file).
Decimal Addition What is going on? (carry) (subtract the base)
Binary Addition Addition Rules: = = = = = carry 1 1 carry 1 Example 1: Example 2:
How Computers Work Dr. John P. Abraham Professor UTPA.
1 Lecture 5 Floating Point Numbers ITEC 1000 “Introduction to Information Technology”
1 Programming in Machine Language SCSC 311 Spring 2011.
COMPSCI 210 Semester Tutorial 1
Number Systems Binary to Decimal Octal to Decimal Hexadecimal to Decimal Binary to Octal Binary to Hexadecimal Two’s Complement.
Computer Science 210 Computer Organization More on Assembler.
Floating-Point Representation We can store integers and characters easily in binary, but what about fractions? ¼ =.25 = 2.5 * *
Addition and Substraction
Introduction to Microprocessors Chapter 2. Decimal or Base 10 Numbers  Have ten different digits (0-9)  It is a weighted number system. Each position.
Outline Binary Addition 2’s complement Binary Subtraction Half Adder
Integer Operations Computer Organization and Assembly Language: Module 5.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
1 Chapter 1: Introduction Appendix A: Binary and Hexadecimal Tutorial Assembly Language for Intel-Based Computers, 3rd edition Kip R. Irvine.
Lab (6) Introduction to Assembly Language 1. Introduction Objectives : Learn EMU8086 installation EMU8086 environment Learn how to: Assemble instructions.
Compsci 210 Tutorial Two CompSci Semester Two 2016.
The Little man computer
Computer Science 210 tutorial 5
PROGRAMMING THE BASIC COMPUTER
Computer Science 210 Computer Organization
Chapter 5- Assembling , Linking, and Executing Programs
Chapter 7 Assembly Language
Compsci 210 Tutorial Four.
Programming in Machine Language
Data Representation Binary Numbers Binary Addition
Integer Real Numbers Character Boolean Memory Address CPU Data Types
Morgan Kaufmann Publishers
Boolean Algebra, Bitwise Operations
Chapter 7 Assembly Language
Computer Science 210 Computer Organization
Addition and Substraction
Binary Addition & Subtraction
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 6
Starter Read the Feedback Click on Add new Feedback Open Realsmart
Computer Science 210 Computer Organization
and Executing Programs
Chapter 7 LC-2 Assembly Language.
Assembler CASE Tool.
Chap. 6 Programming the Basic Computer
Arithmetic Logical Unit
Chapter 7 Assembly Language
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Chapter 7 LC-2 Assembly Language.
Computer Science 210 Computer Organization
Chapter 7 Assembly Language
Chapter 7 Assembly Language
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
CISC101 Reminders Labs start this week. Meet your TA! Get help with:
Chapter 6 Programming the basic computer
Reverse Assembly Typical problem:
Example 1: (expression evaluation)
CS334: MIPS language _Mars simulator Lab 2_1
One-step addition & subtraction equations: fractions & decimals
Presentation transcript:

Compsci 210 Tutorial Five

agenda Lc-3 simulator practice Some exercises from past test

LC-3 simulator & LC-3 editor CompSci 210 - Semester One 2016

LC-3 simulator & LC-3 editor You can edit your program here using binary code, hexadecimal code and assembly code.  After finish editing, you can export to .obj file which can be run by LC3 simulator.

LC-3 simulator & LC-3 editor virtual computer which execute assembly code Simulator CompSci 210 - Semester One 2016

LC-3 Notes The simulator and the editor are separate programs The simulator is available for Windows (also Linux/Java/etc) The lab computers should have LC-3 included The LC-3 software can be executed from a flash drive Download from : Goolge: lc-3 simulator canvas if needed CompSci 210 - Semester One 2016

The LC-3 Files CompSci 210 - Semester One 2016

The LC-3 Files After installation, you will see 2 exe programs (windows): LC3Edit.exe and Simulate.exe.

LC-3 Editor CompSci 210 - Semester One 2016

LC-3 Editor The editor is used to enter your LC-3 instructions You will save your programs into the .asm format The editor will also assemble your .asm files into .obj files which can be run on the simulator

example.asm .ORIG x3000 LD R2, ZERO LD R0, M0 LD R1, M1 LOOP BRz DONE ADD R2, R2, R0 ADD R1, R1, -1 BR LOOP DONE ST R2, RESULT HALT RESULT .FILL x0000 ZERO .FILL x0000 M0 .FILL x0004 M1 .FILL x0803 .END CompSci 210 - Semester One 2016

LC-3 Simulator

LC-3 Simulator The simulator is used to execute your assembled LC-3 machine code You will load the .obj files you create into the editor The editor gives you a very detailed view of what is happening as your machine code is executed

Lc-3 simulator CompSci 210 - Semester One 2016

Example: LC-3 ADD Instruction CompSci 210 - Semester One 2016

Demonstration Complete the following tasks in LC-3. Write a program in the LC-3 Editor. Assemble a program in the LC-3 Editor. Load and execute a program in the LC-3 Simulator. Set breakpoints in the simulator to pause execution. Step forward through your executing program one line at a time. Modify a register value during program execution.

Just do it the LC3-Simulator on the lab computers is located at C:\Program Files (x86)\lc3simulator here is the link for the LC-3 Simulator: http://highered.mheducation.com/sites/0072467509/student_view0/lc- 3_simulator.html All the examples can be found from canvas: https://canvas.auckland.ac.nz/courses/1193/files/folder/Tutorials/Tu torials_Ben_Thursday CompSci 210 - Semester One 2016

Assembly language examples A program to multiply a number by the constant 6 Number * 6 A subtraction program subtracts the number in the variable SECOND from FIRST and stores the result in DIFF diff = first - second CompSci 210 - Semester One 2016

Q20 from last test The great explanation from josh on canvas: https://canvas.auckland.ac.nz/courses/1193/external_tools/8 CompSci 210 - Semester One 2016

What is the 8 bit 2’s complement binary representation of -35 Decimal Value: -35 35 / 2 = 17 R 1 17 / 2 = 8 R 1 8 / 2 = 4 R 0 4 / 2 = 2 R 0 2 / 2 = 1 R 0 1 / 2 = 0 R 1 1 0 0 0 1 1 Calculate 2’s complement: 00100011→11011100+1 Answer:11011101

What is the result of adding these unsigned binary numbers: 10110101 + 1011 “10110101 + 1011”: left pad any numbers so both have the same number of bits 1011 = 00001011 Now align them vertically, and add 1 + 0 = 1, 1 + 1 = 0 (with a carry), Carry + 1 = 0 (with a carry) +1 +1 +1 +1 +1 +1 0 0 0 0 1 0 1 1 + 1 0 1 1 0 1 0 1 --------------------------------- 1 1 0 0 0 0 0 0 CompSci 210 - Semester One 2016

What is the result of subtracting these unsigned binary numbers: 10110101 + 1011 “10110101 - 1011”: 1011 = 00001011 1 - 1 = 0, 0 - 1 = 1 (with a carry “-1” from left side) -1 -1 1 0 1 1 0 1 0 1 - 0 0 0 0 1 0 1 1 --------------------------------- 1 0 1 0 1 0 1 0 CompSci 210 - Semester One 2016

If 0010100.101 is a binary fractional number what is its decimal equivalent convert to decimal 0010100.101 = 2 4 + 2 2 + 2 −1 + 2 −3 =16+4+0.5+0.125 =20.625 CompSci 210 - Semester One 2016

Questions CompSci 210 - Semester One 2016