can't open a file ("filename.gray") in assembly Risc v, assume that the path to the file, either being absolute or relative is correct (i'm not having issues with null terminated strings) long story short , i have a snippet of code :
li a7, 1024 la a0, filename # filename is store in a variable called filename in the data store segment as an .asciz value of "name.gray" li a1, 0 ecall mv s0, a0 # retrieve file pointer
I tried booting the code in linux, i tried changing the system file permissions to read and write to all users, i tried creating fresh directories to check if that was the issue, tried changing the path and names to reduce typing errors or wrong directories. i tried typing a fopen system call in all different sorts and ways but from what i know (fopen syscall gets 2 inputs resumed -> a0 : filename ; a1 -> filemode : 0 for rb and 1 for wb ; and of course the li a7, 1024 to do the instruction
i also made the entire program in C and it runs just fine : snippet : unsigned char* read_image(const char* filename, int width, int height) {
FILE *file = fopen(filename, "rb");
unsigned char* image = (unsigned char*)malloc(width * height);
rars.jarfile. Another thing to try is to create some file using RARS ecalls and see where it winds up.java -jar C:\...rars1_6.jarfor windows), you can set the working directory as you like, while using an (absolute) path to the .jar file.