-
Notifications
You must be signed in to change notification settings - Fork 245
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
Command-Line issues with readchar syscall #135
Comments
This is a issue for readchar on the terminal. In the GUI, it works without buffering. I think it would be a little hard, but I think the best fix for this would be to modify L101 to act like L108. rars/src/rars/util/SystemIO.java Lines 97 to 110 in dce53ad
|
Fixed it #174. Now, when you press enter (in nc mode), the line will be saved to the buffer and subsequent calls will reads from there (if there are characters there), which will allow you not to lose the next characters after reading from the input stream |
This isn't quite fixed. The program doesn't crash, but the output does not match the GUI based output. There seems to be a terminal mode issue as well. The readchar does not take any input until a newline is entered. Using the sample code I provided, I have to type enter twice to leave the program in CLI mode. The ascii code of the chars typed are not printed in real-time as I enter them. When using redirected input, only the ascii code of the 1st char is printed. |
Accidentally closed. |
There is an issue with readchar syscall. The readcall requires a newline to accept the character, and doesn't read the newline char itself. Perhaps the terminal mode line buffering is misconfigured for readchar.
The following code always causes a runtime exception "Error in /home/jplanck/./riscv1.asm line 6: Runtime exception at 0x00400010: invalid char input (syscall 12)"
Here is the runtime response when i type "1234".
java -jar ~/opt/riscv/rars/rars1_5.jar riscv1.asm nc
1234
49
Error in /home/jplanck/riscv1.asm line 6: Runtime exception at 0x00400010: invalid char input (syscall 12)
Simulation terminated due to errors.
Here is the output when I type a newline after each char.
java -jar ~/opt/riscv/rars/rars1_5.jar riscv1.asm nc
1
492
503
514
52
Error in /home/jplanck/riscv1.asm line 6: Runtime exception at 0x00400010: invalid char input (syscall 12)
Simulation terminated due to errors.
system info,
Linux version 5.11.0-38-generic (buildd@lgw01-amd64-041) (gcc (Ubuntu 9.3.0-17ubuntu1
20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #4220.04.1-Ubuntu SMP Tue Sep 28 20:41:07 UTC 2021The text was updated successfully, but these errors were encountered: