Download presentation
Presentation is loading. Please wait.
1
Compsci 210 Tutorial Five
2
agenda Lc-3 simulator practice Some exercises from past test
3
LC-3 simulator & LC-3 editor
CompSci Semester One 2016
4
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.
5
LC-3 simulator & LC-3 editor
virtual computer which execute assembly code Simulator CompSci Semester One 2016
6
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 Semester One 2016
7
The LC-3 Files CompSci Semester One 2016
8
The LC-3 Files After installation, you will see 2 exe programs (windows): LC3Edit.exe and Simulate.exe.
9
LC-3 Editor CompSci Semester One 2016
10
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
11
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 Semester One 2016
12
LC-3 Simulator
13
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
14
Lc-3 simulator CompSci Semester One 2016
15
Example: LC-3 ADD Instruction
CompSci Semester One 2016
16
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.
17
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: 3_simulator.html All the examples can be found from canvas: torials_Ben_Thursday CompSci Semester One 2016
18
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 Semester One 2016
19
Q20 from last test The great explanation from josh on canvas: CompSci Semester One 2016
20
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 Calculate 2’s complement: → Answer:
21
What is the result of adding these unsigned binary numbers: 10110101 + 1011
“ ”: left pad any numbers so both have the same number of bits 1011 = Now align them vertically, and add 1 + 0 = 1, = 0 (with a carry), Carry + 1 = 0 (with a carry) CompSci Semester One 2016
22
What is the result of subtracting these unsigned binary numbers: 10110101 + 1011
“ ”: 1011 = 1 - 1 = 0, = 1 (with a carry “-1” from left side) CompSci Semester One 2016
23
If 0010100.101 is a binary fractional number what is its decimal equivalent
convert to decimal = −1 + 2 −3 = =20.625 CompSci Semester One 2016
24
Questions CompSci Semester One 2016
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.