Closed bitartrate closed 3 years ago
I have a working prototype for this. Right now it attempts to execute the command run ".autoexec"
provided the relevant config option (9) is enabled. It doesn't enforce a specific path but uses the current directory for file access.
Another option would be to always load a stub from /flash (i.e. run "/flash/.autoexec"
) which can then do 2nd level loading.
Thoughts?
Sounds good to me. Two things, though:
To answer my own question, it can be /flash :(
A quick fix could be run "/sd/AUTOEXEC.BAS"
... I'm a bit unsure about how reliable keyboard override would be.
Pulling PSX_DATA low might be an option. I'll verify this later.
I think you two are on a good track with this. I agree with AUTOEXEC.BAS as the filename. Possibly look in /flash first and then /sd second. I don't think it needs to enforce a path as at startup BE always is in the root of /sd.
To keep it simple I just went back to using CWD$() as the source of AUTOEXEC.BAS. If no SD card is mounted then it attempts to find it in /flash.
IF something goes wrong with the /flash version one can either insert an SD version (clean/working) or ground PSX_DATA during poweron which skips the autostart feature entirely.
Hi Konimaru, I did clone your autostart branch but it came in without the changes. So I copied the changed files by hand. I was just about to say I couldn't get it to load AUTOEXEC.BAS but I just remembered CONFIG 9. So far so good it is working for me from both /sd and /flash. Good job!
What command did you use (for cloning)?
git clone --branch autostart http://github.com/konimaru/basicengine-firmware.git
ahhh I see, no I simply used 'git-clone https://github.com/konimaru/basicengine-firmware.git' Thank you. That adds to my understanding of Git.
Back to square one, vs23.digitalRead is not available on all platforms.
@uli would a dummy digitalRead on other platforms (e.g. esp32) be an option or do you prefer a keyboard/pad solution for the override?
@bitartrate: Could someone who has a PSX controller available please check my autostart branch? Cursor key abort works for me on native and hosted.
When auto start is enabled (config 9,1) pressing any button affecting pad(0) should cancel auto start.
@konimaru I confirm that the PSX controller does cancel the autostart with message "autostart cancelled" Excellent!
Thanks for testing this.
You are very welcome. Thank you for the feature.
Are you contemplating loading from /FLASH when /SD is present but AUTOEXEC.BAS is not on /sd but is on /flash?
The way it's done now is that I inject a small basic command(!) into the buffer (once) and pass it straight on to the tokenizer. I'm not sure the needed functionality can be placed in a single line. Feel free to surprise me.
I might just do that :)
Did this ever get merged into the firmware? I saw there were commits & pull requests by @konimaru but on my machine CONFIG 9,# applies/reverts the recent code formatting change, and I'm not seeing a CONFIG 10,#.
Did this ever get merged into the firmware?
Not to my knowledge. Since it was never merged on time, the pull requests quickly collected merge conflicts which I only fixed a couple of times ...
So this is why nobody should elect me as President of the Universe: I didn't merge this because I consider the implementation way too intrusive for such a small feature. I didn't say anything, though, because I don't like to say things like that, and I didn't write a better solution either. Sorry about that. :(
Anyway, I wrote something simpler now. I left out the config part, though, because I feel it's redundant. After all, you can disable the autoexec temporarily by holding a key, and permanently by deleting the file.
I can confirm this is working on my machine. I have the AUTOEXEC.BAS retrieving the time from a Maxim DS3231 RTC and setting the time on the Basic Engine. Thanks guys.
Thanks for testing.
I have several projects that would be greatly enhanced if there where an ".autoexec" type functionality. What I propose is giving the BASIC Engine the ability to look for and run this specially named basic program on startup.