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

can system call 51 (InputDialogInt) take a hex input? #213

Open
jowens opened this issue Jan 31, 2024 · 0 comments
Open

can system call 51 (InputDialogInt) take a hex input? #213

jowens opened this issue Jan 31, 2024 · 0 comments

Comments

@jowens
Copy link
Contributor

jowens commented Jan 31, 2024

Please forgive my non-knowledge of Java. In class I am using this simulator to teach RISC-V. Students input a value using system call 51 (InputDialogInt) at the start of an assembly program and then watch the simulator run the program with that input.

It is my understanding that this system call inputs a decimal number. For many test cases, students would appreciate the opportunity to instead input a hexadecimal number. Here's my understanding of what is happening:

  • rars/src/rars/riscv/syscalls/SyscallReadInt.java : SyscallReadInt calls SystemIO.readInteger
  • rars/src/rars/util/SystemIO.java: SystemIO.readInteger calls return Integer.parseInt(input.trim())
    • Integer.parseInt takes two arguments; the second is the base and is if not specified 10

If the first two characters of input are 0x, could they be removed and then result in a call like return SystemIO.readInteger(input[2:].trim(), 16)? Again, sorry, I don't know Java.

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

1 participant