assembly - Invalid program counter value in MIPS -
My program is about to be recursive, but just after calculating the last answer to my program, the program ends with errors, <
More specifically: Error: Invalid Program Counter Value: 0x00000000 I believe this is a problem with my JR $ RA because my code During debugging I saw that the error was the second junior $ RA program Calculates the correct answer after How will I solve this problem? I need a program to print the number stored in the $ v0 register, but the program fails before doing so. The last I do not know that you have not specified your performance environment since the "Invalid Program Counter" error, but as I mentioned above, adding a
.data msg: .asciiz "Enter a positive integer: \ n" Msg2: .asciiz "its value is: \ n" .text li $ v0.4 to $ a0, msg Syscall li $ v0,5 syscall $ a0 driving, $ v0 cValue: addi $ sp, $ sp, -4 sw $ r, 0 ($ sp) bgt $ a0,1, recursive li $ v0.1 lw $ ra, 0 ($ Sp) addi $ sp, $ sp, 4 jr $ ra recursive: addi $ a0, $ a0, - 1 gel c value li $ t7,3 ml $ v0, $ t7 mflo $ v0 addi $ v0, $ v0, 1 lw $ ra, 0 ($ sp) addi $ sp, $ sp, 4 jr $ ra <
jr $ ra to display will jump to
$ ra previously set before entering
cValue Was there. Since you do not have any initial
jal cValue , then the value of
$ ra will be the price of your program. Usually this will be somewhere in the runtime, which gives your
main , and this is the behavior that I get in PCSpim.
jal cValue After the subtype has ended, the problem should be solved after continuous execution after
jal . Then you can do whatever you want to get out of the program.
Comments
Post a Comment