Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.6 command line mode does not print register content after the run #199

Open
zhijieshi opened this issue Sep 10, 2023 · 3 comments

Comments

@zhijieshi
Copy link

Somehow the register options do not work in Version 1.6. They worked perfectly in Version 1.5.

For example,

# The following command is supposed to print register x1 at the end of run. However, register x1 is not printed.
java -jar rars1.6.jar example.s x1

# With the me option, register x1 is printed in stderr.
java -jar rars1.6.jar example.s x1 me
@zhijieshi zhijieshi changed the title Version 1.6 command line mode does not print register content after at the end of run Version 1.6 command line mode does not print register content after the run Sep 10, 2023
@TheThirdOne
Copy link
Owner

I cannot reproduce this error. I used the code:

li a7, 10
ecall

Please share a short program that shows this bug for you.

@zhijieshi
Copy link
Author

OS: Windows 11.
Java version:

java 17.0.1 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

Assume a file e.s has the following code.


        .data
msg:    .asciz  "Hello, world!\n"

        .text
main:
        lui     a0, 0x10010     # a0 = the address of msg. hard-coded
        addi    a7, zero, 4     # a7 = 4, the system call number for printing a string
        ecall                   # system call

        # system call 10: exit with code 0
        addi    a7, zero, 10    # a7 = 10
        ecall                   # system call

Here is the command and the output, using RARS 1.5.

java -jar .\rars1_5.jar e.s a0 a7 
RARS 1.5  Copyright 2003-2019 Pete Sanderson and Kenneth Vollmar

Hello, world!

Program terminated by calling exit
a0      0x10010000
a7      0x0000000a

Here is the command and the output when RARS 1.6 is used. The values of a0 and a7 are not printed. The line "Program terminated by calling exit" is also different.

java -jar .\rars1_6.jar e.s a0 a7
RARS 1.6  Copyright 2003-2019 Pete Sanderson and Kenneth Vollmar

Hello, world!

Here is the command and the output when me option is used with RARS 1.6.

java -jar .\rars1_6.jar e.s a0 a7 me
RARS 1.6  Copyright 2003-2019 Pete Sanderson and Kenneth Vollmar

Hello, world!

Program terminated by calling exit
a0      0x10010000
a7      0x0000000a

@kpiche
Copy link

kpiche commented Nov 26, 2023

Noticed that RARS doesn't output registers if your program prints anything:

$ cat reg1.asm 
.text
        li      a1, 0x1234
        li      a0, 65          # printchar A
        addi    a7, zero, 11
        ecall
$
$ rars a1 reg1.asm
RARS 1.6  Copyright 2003-2019 Pete Sanderson and Kenneth Vollmar

A$ 

With no printchar call:

$ cat reg2.asm 
# rars nc a1 reg2.asm
.text
        li      a1, 0x1234
$ 
$ rars a1 reg2.asm
RARS 1.6  Copyright 2003-2019 Pete Sanderson and Kenneth Vollmar


Program terminated by dropping off the bottom.
a1      0x00001234
$ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants