Jump fails in LC3 - subroutine

I seem to be having a problem with LC3 assembly.
I'm trying to jump to a subroutine, but instead it just goes through to the next command.
I've tried:
LD R0, Subpgm
JSRR R0
and at the bottom, This line to define Subpgm.
Subpgm .FILL x4000
I expected this to jump to PC x4000, but instead the PC is just incremented by the normal 1.
Any help would be super appreciated!

You're using the JSRR command correctly, I would have to see the rest of your code to understand what's causing the error.

Related

Show Line Number in Error Message

On most instances of MATLAB I've used, whenever I had a bug in my code the error message in the command window would show the line number.
However on the computer I am currently using, it shows me only the following:
??? Subscripted assignment dimension mismatch.
Is there anyway to get the line number to show again instead of ?????
What you are doing is using Run Section or Run and Advance as #canzar said. If you run scripts like this there is no 'line number', just as when you copy-paste code and run it in the command-window will not show you the line number on the error.
If you run the script using run or by pressing F5 it does know the line number and then prints that on the error statement. Good to know for debugging is to go to the tab editor->breakpoints->dbstop on error. If you press that it will keep your variables as present when the memory occurs, as opposed to throwing everything out when debugging functions.

Step to cursor/line eclipse debugger

Is there a possibility to step to any following line while debugging in eclipse?
It will help debug situations when I have a breakpoint at method beginning, I check something there, and below there is a for loop that i want to step through fast to see all changes it made at once.
Currently in the above scenario I put a breakpoint below the for-loop, hit F8, remove the breakpoint after execution stops which is pretty cumbersome.
Is there a better method of doing above?
Put break point at start of function.
Check XYZ. Come up to for loop.
Put your cursor after for loop.
Press CTRL + R.
HURRAY!!!!! I skiped for loop in debug.

debug the last sentence of a program

I have used Eclipse and VS. When I insert a breakpoint and debug the program, it will stop before the breakpoint.
But what if I want to debug the effect of the last sentence of the program? Inserting a meaningless sentence(say print 'pause' in Python) is OK but seems awkward. Is there any alternatives?
In Visual Studio you can put break point on closing bracket in main (or any) method of Program (or any) class (default naming, may vary), then debugger stops just before closing application.
Is there any reason not to use a breakpoint on the last statement, like you said, then manually proceed one step? Depending on the debugger, this can also be automated. In GDB, one can use commands N, where N is the breakpoint number, to set a list of (debugger) commands to be executed immediately after a breakpoint is hit.

How to inspect a variable in XCODE?

Is there any command using which we can inspect a object in command line while app is running in DEBUG mode. I do not want to put description message in the code.
Try these resources. one two
(gdb) p varName
Yes sure. If you are debuging, breakpoints are automatically set to on. Just set a breakpoint to the line in which the variable is. The program stops as soon it reaches the line with the breakpoint. Just hold the cursor over the variable and all important data is displayed. I do it also that way all the time. ;-)

What is the usual way in MATLAB to read help page by page?

I'm looking for an equivalent of for example DOS's dir |more which lists the data, until one page is complete, then waits for a key to be pressed until showing another. Is there an equivalent for MATLAB's help system.
I know I could simply scroll back, but this would be so much more convenient, expecially if one uses help system often.
Type more on at the command line. This will print command outputs page by page.
For the next line: 'return'; next page; 'spacebar'; return to command line: 'q'.
Likewise, more off resumes the normal display mode.