Questions tagged [lc3]

Little Computer 3 (LC-3) is an educational assembly language, designed to help teach low-level programming. It is run using an emulator, and does not run natively on any processor.

Little Computer 3 (LC-3) is an educational assembly language with 15 opcodes, designed by Yale N. Patt and Sanjay J. Patel and published in their textbook Introduction to Computing Systems: From Bits and Gates to C and Beyond, 2nd edition (2003).

It exists solely for educational purposes, and does not run natively on any existing processor. Existing emulation tools include an assembler, a compiler, and a simulator, all provided by McGraw-Hill.

References

361 questions
-1
votes
1 answer

LC-3 program that adds the sum of odd integers between two number

I'm not sure how to input a two digit number and actually be able to work with it (add, subtract, AND, etc.). So far I can enter my start and end numbers as strings and use LEA to output the strings, but I need them in registers so I can convert…
-1
votes
1 answer

Writing a custom tokenizer in C for an LC3 Assembler

Hi I'm supposed to write an lc3 assembler (??) for class in C but I'M stuck at writing the tokenizer, the code is clean no warnings but it gives me segmentation fault. after the first line. consider \n \r and ; and new line to skip…
-1
votes
1 answer

Program will only print the first letter of user inputted string

I am trying to make a program in LC3 that asks the user to enter a string and will proceed to print it out. My program is only ably to print out the first letter from the user inputted string. For example, I typed in "Hello" and it would only print…
-1
votes
1 answer

How to put a certain large number into a register in LC3 assembly?

I'm trying to have a register (say R1) storing a particular number that's too big for an immediate (say 440). Obviously I cannot just set R1 to 0 and use ADD, is there a way to achieve this? Thanks!
Alan Fu
  • 1
  • 2
-1
votes
3 answers

How do I write a program that prints out “Hello World”, 5 times using a loop in LC3?

.ORIG x3000 COUNTER .FILL x0005 LEA R0, HELLO_WORLD PUTS HALT HELLO_WORLD .stringz "Hello World this is John Cena!" .END This is the code I have so far for just writing the name once, I'm confused how to implement the loop into this code so that…
Kenny Tien
  • 11
  • 1
  • 1
-1
votes
1 answer

how to overwrite in the memory of lc3

I am writing a program in assembly lc3 and although I know how to read a letter which is stored in the memory I don't know how to overwrite this letter with another one. I don't want to do it using .STRINGZ because then an extra "0" will be added…
otrym
  • 21
  • 2
-1
votes
3 answers

Print triangle of *'s in Assembly Language (LC-3)

I am trying to print a triangle of asterisks based on a value of N. The code I have here will just print an entire row of N *'s. The end result i am looking for is: * ** *** **** If N = 4 The code I have right now .ORIG x3000 LD …
connor moore
  • 611
  • 1
  • 8
  • 18
-1
votes
1 answer

How do you clear a specific bit in a register without changing the other bits in ONE instruction?

For example, let's say register 4 (R4) has a value 0001110010101111. How could you change bit 5 (0001110010 >1< 01111) to 0 (even if it was already 0) without moving or changing the other bits in a single hex instruction? So 0001110010101111 ->…
Austin Chow
  • 1
  • 1
  • 2
-1
votes
2 answers

LC3 assembly program, print instruction

The following LC3 program will print out "Hello". But can some one please help to explain why it does it? I am confused because there is no instructions like PUTS. Does it have something to do with loading values to R0? Thank you! LEA R1,…
user3474606
  • 515
  • 1
  • 6
  • 15
-1
votes
1 answer

program for LC3 Assembly language

How do you convert any character input from the user to its corresponding decimal value? I was just having trouble getting started. The program has to achieve the following things: The program accepts character from keyboard. If the character is a…
user3469170
  • 1
  • 2
  • 3
-2
votes
1 answer

Brand new to LC3

I am trying to write a program that will accept a user input and print the binary form of that input. I am using the getc trap for the input. I know that the getc input will be stored in R0 so I am thinking in need to use a BRzp then AND each bit…
Jhov81
  • 1
  • 1
-2
votes
1 answer

LC-3 code confusion

For this problem we are given a problem in LC-3 and told to describe what it does and state what is contained in RESULT. Unfortunately, I am struggling hardcore with this language and I am really confused by it. I just don't understand what these…
-2
votes
1 answer

Parsing hex into an LC3 ADD instruction

I am writing a program in C to convert a hex file compiled for the LC3 processor back into assembly language. Currently, I am trying to decode the ADD instruction. There are two types of ADDs in LC3 assembly language: add by reference: adding two…
Matt
  • 61
  • 1
  • 1
  • 7
-2
votes
1 answer

How to start the basic programming task using Pennsim and LC-3 programming language?

The task at hand is to write a subroutine STRCPY to implement a string copy function like the C the programming language's strcpy() function. I know: R1 is the address of the string to copy from R2 is the address of where the string is to be copied…
Jeremy
  • 7
  • 1
-3
votes
2 answers

Using stacks in LC-3 Assembly

I am going through a problem I found on a website of making a calculator in LC-3. I am going about it in steps and saw something about doing what I am currently doing using stacks. I was wondering if someone could help me with what I have so far to…
connor moore
  • 611
  • 1
  • 8
  • 18
1 2 3
24
25