Page 1 of 1

Loading Programs from SD Card Image

Posted: Sat Sep 18, 2021 6:10 am
by EasyModeGamer

Is there a way to properly load programs with associated BIN files from the SD card image? If you were using the host filesystem, you can call the emulator from the folder with the program, but you can't do that with the SD card image. Besides, I don't want to have to have the program preloaded when I start the emulator with no way to run any other programs without using a different batch file to start the emulator.


Loading Programs from SD Card Image

Posted: Sat Sep 18, 2021 5:36 pm
by Ender

I'm not sure what your question is.  Do you mean is there a way to load an SD card image after you've started the emulator?  There isn't currently a way, no.  That's just a limitation of the emulator.  If you want to load a different SD card image, you have to restart the emulator with a different command line.


Loading Programs from SD Card Image

Posted: Sat Sep 18, 2021 5:49 pm
by kliepatsch

To be able to load programs from the SD card, you have to start the emulator from the command line like this:

x16emu -sdcard sdcard.img

That way, all files on the image are visible to the emulator. They can then be loaded like

LOAD"MYPROG.PRG"

.BIN files could be loaded the same way, as long as they are loaded to the address that is stored in the files themselves (the first two bytes in .BIN files often determine the address where the file is loaded).

But I think most programs will take care of loading the necessary .BIN files themselves.


Loading Programs from SD Card Image

Posted: Sat Sep 18, 2021 6:51 pm
by EasyModeGamer


1 hour ago, kliepatsch said:




To be able to load programs from the SD card, you have to start the emulator from the command line like this:



x16emu -sdcard sdcard.img



That way, all files on the image are visible to the emulator. They can then be loaded like



LOAD"MYPROG.PRG"



.BIN files could be loaded the same way, as long as they are loaded to the address that is stored in the files themselves (the first two bytes in .BIN files often determine the address where the file is loaded).



But I think most programs will take care of loading the necessary .BIN files themselves.



I have no problem loading the SD card image and I can load any program that doesn't require a .bin file. However, when I try to load a program that DOES require a .bin file, I just get a black screen. Currently, I have all of those programs in different subdirectories of the SD card image, but it still didn't work when I put them in the main directory.

EDIT: It actually doesn't go directly to a black screen when I try to load Brixx. For a split second a mouse cursor appears, then the screen goes mostly black with a red cursor in the top right which disappears after a second. Also, I can get garbage on the screen in flappy bird by mashing keys. Invaderz is the only game out of the three that doesn't get the red cursor.


Loading Programs from SD Card Image

Posted: Sat Sep 18, 2021 7:07 pm
by kliepatsch

Hmm ... I don't know which programs you are referring to. There are two different types of loading files. One, where the target address from the .BIN file (the first two bytes) is used, and another one where the program itself decides (at runtime) where the program is loaded in memory. The latter is known to be broken in the latest official emulator (R38) when trying to load from an SD card, unfortunately. It could be the case that your programs are trying to load files that way and therefore do not succeed.

 

That red spot in the top right typically indicates disk activity. From what is known about that emulator bug I could imagine that your programs are suffering from it. The file is loaded at address 0, and depending on how large it is, the program that is running gets overridden, causing the X16 to crash. If that's the case, I'm afraid that at the moment, you cannot use those programs from the SD card.


 


Loading Programs from SD Card Image

Posted: Sat Sep 18, 2021 7:13 pm
by EasyModeGamer


7 minutes ago, kliepatsch said:




Hmm ... I don't know which programs you are referring to. There are two different types of loading files. One, where the target address from the .BIN file (the first two bytes) is used, and another one where the program itself decides (at runtime) where the program is loaded in memory. The latter is known to be broken in the latest official emulator (R38) when trying to load from an SD card, unfortunately. It could be the case that your programs are trying to load files that way and therefore do not succeed.

 



That red spot in the top right typically indicates disk activity. From what is known about that emulator bug I could imagine that your programs are suffering from it. The file is loaded at address 0, and depending on how large it is, the program that is running gets overridden, causing the X16 to crash. If that's the case, I'm afraid that at the moment, you cannot use those programs from the SD card.




 



The difference is, the garbage on flappy bird seems to indicate the program is running, it just lacks the .bin files it needs to work properly. Could this be caused by the bug you're describing? I'm pretty new to this kind of stuff.

EDIT: Nevermind, I just realized that even if the program isn't overwritten, it still won't know where to find the bin files. Sorry!


Loading Programs from SD Card Image

Posted: Sat Sep 18, 2021 7:29 pm
by kliepatsch

You're right, I tried it and even the sound works correctly. That's kinda funny, actually. But I can't think of anything you can do to make it work from the SD card right now.