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
vote
1 answer

Rotate Right operation, LC3 simulator

I am writing routines for LC3 simulator, I have successfully wrote Shift Right routine, but I am now stuck with Rotate Right routine, it should move bits right and during each move to the right the least significant bit is copied into the most…
edi
  • 47
  • 1
  • 1
  • 9
1
vote
2 answers

saving a string of chars in assembly LC-3

I am trying to make a simple program using the LC-3 Architecture. All I am trying to do is read a string from the console, somehow save it in memory, and then print it back out. This is what I have so Far ; This program attemps to read a string and…
Cheesegraterr
  • 517
  • 3
  • 14
  • 26
1
vote
1 answer

In LC-3 assembly language, how do I convert these commands to machine code?

For one of my classes I need to write an LC-3 program in machine code and I can't seem to find the machine codes for the commands that have a period for them: .ORIG .END .BLKW etc Does anyone know what they are? I have all of the commands done, for…
user1017593
  • 21
  • 2
  • 3
1
vote
0 answers

Multiplication in LC3 without knowing which registers are full

How would I write assembly code to multiply two registers if I don't know which registers are full? I am writing a C program that expands a mult macro or pseudo-instruction in LC3 code to multiply two registers. So I do not have access to the…
Sarah
  • 23
  • 5
1
vote
1 answer

LC-3 Assembly Language Sentinel-Controlled Loop How come my code ends when I press enter?

I am practicing using arrays and loops and I am trying to have the user ENTER less than 100 characters in console to fill up my array. The user can press ENTER whenever they are done entering how ever many characters they want and the program will…
henrypham
  • 11
  • 1
1
vote
0 answers

How to convert a .c or a .o or a .exe file to a .obj file?

I am building an LC3 Virtual Machine in C, but one problem that I am facing is that it takes in only .obj files as input. How am I to convert any file that I write in C into a .obj file in order to run it through the Virtual Machine
1
vote
1 answer

Converting a code a* b * c written in C to LC3

I don't know if this question is vague or lacks enough information but I was just wondering If I want to convert this line a = a * b * c written in C language to LC-3, how can I do it? Assuming that a, b and c are local variables and that the offset…
yowhatsup123
  • 287
  • 1
  • 11
1
vote
0 answers

Left Shift subroutine in LC3 not working for when the value in R3 is 0

I have to write a subroutine to calculate the value stored at R2 to left-shift by the value stored at R3 (R2 << R3). The result is saved at R3. So far I have this: leftSHIFT ADD R0,R2,R2 ADD R3,R3,#-1 BRz MyEXIT …
jobahola
  • 11
  • 1
1
vote
0 answers

#LC3 Trying to Subtract two number, but the result comes out is not correct

MySUB NOT R4,R3 | Flip R3 and load into r4 ADD R1,R4,#1 | ADD R4 with 1 and load into r1 ADD R3,R2,R1 | ADD R4 with R1 and load into R3 RET |Output R3 So R2 and R3 it's given in the data, and r3's value is the output…
SSxu
  • 11
  • 2
1
vote
1 answer

virtual machine for lc3

Hello I can’t figure out why in the add instruction I need to and by 7 this is the cpp code for the Add instruction uint16_t dr = (instr >> 9) & 0b111; uint16_t sr1 = (instr >> 6) & 0b111; uint16_t sr2 = instr &…
1
vote
1 answer

Why does my ASCII ART in LC-3 look so ugly?

I have written an LC-3 program that outputs some ASCII ART. It spells the word "COOL". But the picture turns out to be very ugly. This is what I get: and this is what I would like to see: _____ ____ ____ _ / ____/ __ \ / __ \| | …
kewi_101
  • 11
  • 1
1
vote
0 answers

Bitmask for converting letters to uppercase

I can't seem to figure out a bitmask for converting both upper case and lower case letters to upper case. I know I can use XOR 00100000 for converting lowercase to uppercase but this would not work if I XOR an upper case letter with 00100000 back to…
Han
  • 11
  • 1
1
vote
0 answers

PUTS jumps to beginning of PC?

So I'm pretty new to LC-3 language. Every time I execute a PUTS instruction, the PC goes from my current place (like x3001) straight to x0000 and I am not sure why. My code looks like this: LD R0, PROMPT1 PUTS I am not very knowledgeable on all the…
Jackson
  • 11
  • 1
1
vote
1 answer

LC3 Assembly Language: skipping over function call

I am writing a program in LC3 that reads in a file of integers, squares each element and adds their squares up. I need the 'squaring' part to be in a function but in my while loop the call to my function is completely skipped over. So what I am…
ella_UW
  • 15
  • 4
1
vote
1 answer

lc3 - Loading Multiple Source Files to be Run

So working with LC3, and I've been given an assignment to build a library functions to run a given driver. I've written the library at this point, but I cannot figure out how to load the library and the driver in the the Simulator memory…
DivinusVox
  • 1,133
  • 2
  • 12
  • 27
1
2
3
24 25