Questions tagged [lc3-trap]

19 questions
1
vote
1 answer

LC-3 Instruction Understanding

Hey Stackoverflow I was going over some example code our professor has left us to study with, and I've had some problems understanding what some of the codes mean and it doesnt help that some of his comments are vague. the first is R3,R1,0; check…
1
vote
2 answers

LC3 TRAP's Instructions

This is a question that's giving me a lot of trouble, but which I need to understand for my Final Exam in 2 weeks. I don't know if it's the wording, but I have no idea how to arrive at a concrete answer. Here's the question: "Bob plans to make…
David Ayala
  • 13
  • 1
  • 2
  • 4
0
votes
0 answers

LC3 Help - not printing the amount I want to print

I am doing a project that follows as: You will edit the program you wrote for Lab #9 that prompts the user for the value of the number of bits to rotate (AMOUNT) a given value (ORIGINAL), and stores the rotated (ROTATED) value. For this lab…
0
votes
1 answer

How to develop an intuition to code in LC-3 Assembly?

I read about how LC-3 works, but I can't for the life of me figure out how to code in LC-3 assembly. My goal is to be able to write simple programs like generating Fibonacci numbers or sorting an array. Can someone point to me to resources to learn…
SkV
  • 60
  • 1
  • 1
  • 11
0
votes
0 answers

How to produce double digits numbers LC3

Having trouble printing any number past 10 in my LC3 program to multiply 2 input numbers to get a area. It works for any numbers below 10 so I know my multiplication is right. The problem is it produces weird symbols or nonsense anywhere higher then…
Gitown
  • 5
  • 2
0
votes
1 answer

Printing double digit numbers in LC-3

Been learning about LC-3 lately and was wondering how do I go about printing a number that's bigger then 9? In this program I made it asks for width and length and multiplies the two to get the area of the shape. My problem is any output bigger then…
Exrial
  • 19
  • 1
  • 6
0
votes
1 answer

How would you draw a vertical line in an LC-3 simulator like Pennsim?

I know how to draw horizontal lines by doing LOOP1 STR R5, #0 ;starting ixel ADD R5, R5, #1 ;increment of pixel on coordinate ADD R7, R7 #-1 ;decrement to the desired length counter BRp LOOP1 ;keeps looping until register with desired…
0
votes
1 answer

How would you write a code to add every 4th number between 2 values entered by the user?

I do not have any code to provide, mainly because my teacher is not good so I have no clue where to start. But for example if you chose 3 and 20 then it would add up 3, 7, 11, 15, 19 to display the sum of 55. What would be the basis of writing this…
0
votes
0 answers

Write an LC-3 assembler in LC-3 assembly (just handling mnemonic -> opcode, not operands)

The LC-3 assembler must be able to map an instruction's mnemonic into its binary opcode. For instance, given an ADD, it must generate the binary pattern 0001. The user must type in an LC-3 assembly language mnemonic and the program then displays…
0
votes
0 answers

Efficient LC3 assembly code to print the numbers leading up to any digit, unit test says mine is too inefficient

I'm using an LC3 microarchitecture simulator to write assembly code. I've only been writing assembly for about three weeks, so I am still very new. My goal is to print all the numbers leading up to a set value, so for example, if the user selects…
0
votes
0 answers

LC3 - Compute Square Assembly

Hi I'm writing a lc3 subroutine to compute the square of a value in n and then place that value in r0, i have wrote the code and it seems to be filling r0 with the sumofsums however at the end of the program the value in r0 ends up being x7fff - i'm…
rahulchawla
  • 170
  • 1
  • 3
  • 20
0
votes
1 answer

LC3 Assembly Square of N

Hi I'm trying to write a lc3 assembly program which computes the square of a number and stores it in r0, the integer is given as a parameter and is located in r1, the problem i noticed while debugging is during the first pass it initially adds 2,…
rahulchawla
  • 170
  • 1
  • 3
  • 20
0
votes
1 answer

Incorrect Value in Register After Run LC3 Assembly

I am creating an LC3 program to display sum and count of positive and negative numbers but when I run the program in the Simulate program - I look at R5 which is suppose to hold the sum of positive numbers only shows the first +ve number added. My…
rahulchawla
  • 170
  • 1
  • 3
  • 20
0
votes
0 answers

LC3 continue getting a trap was executed with an illegal vector number

I am trying to create a program that will present the number input in binary to the user. Currently, all I have is the setup to get the user's number once they are finished typing all of their characters, however I don't understand why the code…
0
votes
1 answer

How to load a location into the trap vector table LC3

An assignment asks to load the location of a trap we were asked to write into location x0026 of the trap vector table. I understand loading into a register, but I'm not sure as far as loading something into the trap vector table. Any help is…
1
2