Jump to content
LaunchBox Community Forums

Autoboot Command / Script for MAME SWL (Computer Systems)


SiriusVI

Recommended Posts

  • 2 months later...

I'm wracking my brain on this one...

I'm working on Amstrad PCW. The way most games work is that you need to first boot into CP/M in flop1 and once in the OS prompt, change the disk to the game you want. Here's a use case:

Command line for Launchbox:

pcw8512 -flop1 cpmplus

Now all the PCW machines only have one floppy drive, except pcw8512 which has two. The problem with this machine is that the 2nd drive doesn't work yet. So, the workaround is to do the same as you would for any other PCW machine... enter the MAME menu and change the flop1 disk to your game.

But I got to thinking... we could automate this with lua. By setting the following command line in launchbox:

pcw8512 -script pcw.lua -flop1

Launchbox will insert the game disk in drive 1. In Lua, we can read this value, unmount it immediately, mount the cpmplus disk, wait until the disk is loaded, then unmount it and reload the original disk.

Here's my code so far (paste in notepad, save as pcw.lua and save it in your root MAME install path):

local disk = manager.machine.images[":upd765:0:3ssdd"].filename
local game_disk
local mame_runtime = manager.machine.time.seconds
 
if (disk ~= "cpmplus") then
    game_disk = manager.machine.images[":upd765:0:3ssdd"].filename
    manager.machine.images[":upd765:0:3ssdd"]:load_software("cpmplus")
    manager.machine:soft_reset()
end
 
function checktime()
    --if (This is where we need to check whether the CP/M has reached command prompt and if so, swap the disk. Alternatively, we can set a timer that once elapsed would allow the disk swap to happen) then
        manager.machine.images[":upd765:0:3ssdd"]:unload()
        manager.machine.images[":upd765:0:3ssdd"]:load_software(game_disk)
    -- end
end
 
checktime()

Everything works as it should.... In removing the last line of the code above (leaving it there will cause lua to switch the disk back to the original game disk before CP/M has a chance to load), Launchbox runs MAME with the game disk in flop1 however, as expected, the lua script switches it with the CP/M disk and resets MAME in order to boot into CP/M... But as you can see, my problem is in being able to either detect when the CP/M is ready for a command prompt OR in establishing a timer.

I haven't been able to figure out how to detect when CP/M is ready for a command prompt so I've tried the timer approach. The problem though is that any loop I create interrupts MAME entirely so it just hangs while the loop runs which means MAME can't load CP/M at all until the timer runs out. We need CP/M to load WHILE the timer runs.

If someone can help me figure out how to get this aspect working without interrupting MAME, then this system, which seems to run all it's games just fine, will finally be accessible within MAME.

For testing, I've been using the game disk brick. Once you load into CP/M and swap the disk, just type brick and return and the game will run.

For lau documentation, you can refer to https://www.lua.org/pil/contents.html and https://docs.mamedev.org/techspecs/luareference.html

Edited by mcfilmmakers
Link to comment
Share on other sites

9 hours ago, mcfilmmakers said:

Now all the PCW machines only have one floppy drive, except pcw8512 which has two.

Since pcw8512 has 2 FDD's, could you do something like

pcw8512 -flop1 cpmplus -flop2

or

pcw8512 -flop1 %romfile% -flop2 cpmplus

or

pcw8512 -flop2 cpmplus -flop1

I honestly have no idea and have no intention/desire to test it.  But I do love what you're doing with Lua scripting.  👍

Link to comment
Share on other sites

3 minutes ago, JoeViking245 said:

Since pcw8512 has 2 FDD's, could you do something like

pcw8512 -flop1 cpmplus -flop2

or

pcw8512 -flop1 %romfile% -flop2 cpmplus

or

pcw8512 -flop2 cpmplus -flop1

I honestly have no idea and have no intention/desire to test it.  But I do love what you're doing with Lua scripting.  👍

You could, and Launchbox does send the information to the 2nd drive but the 2nd drive doesn't work inside MAME (it freezes when you try to switch to it in CP/M, or alternatively, the disk image data isn't accessible for the 2nd drive - it returns nil).

Link to comment
Share on other sites

  • 4 months later...

I'm once again trying to get some computer systems working. This time it's the BBC Micro. I have a lot of games working automatically with this custom commandline:

-L "M:\LaunchBox\Emulators\RetroArch\cores\mame_libretro.dll" "bbcb -autoboot_delay 1 -autoboot_command *cat\n*exec!boot\n -rp \"L:\LaunchBox\Games\Arcade\" -flop1 \"%romfile%\""

Some games seem to need different launch command. For example the game "Dr. Who and the mines of terror" Needs "*exec who0" to run (the game doesn't even work correctly in mame/mess but that's not important here, I think).

The problem is that I don't know how to pass this command via commandline. The problem is the SPACE between *ecec and who0. So this line does not work:

-L "M:\LaunchBox\Emulators\RetroArch\cores\mame_libretro.dll" "bbcb -autoboot_delay 1 -autoboot_command *cat\n*exec who0\n -rp \"L:\LaunchBox\Games\Arcade\" -flop1 \"%romfile%\"

this also does not work:

-L "M:\LaunchBox\Emulators\RetroArch\cores\mame_libretro.dll" "bbcb -autoboot_delay 1 -autoboot_command *cat\n"*exec who0"\n -rp \"L:\LaunchBox\Games\Arcade\" -flop1 \"%romfile%\"

Does anyone have an idea how to get this working, I mean passing the SPACE to the emulator after *exec?

Link to comment
Share on other sites

41 minutes ago, JoeViking245 said:

You were getting close.  Put the whole thing in quotes.

-autoboot_command "*cat\n*exec who0\n"

 

Thanks, I'll try that, but I think I already did and it didn't work. I think if I do this, the command line won't load the rom file. I get a notification from retroarch that the game "n*exec"  is being loaded are something like this.

This might have something to do with the fact that I checked the remove quotes options for this particular instance of retroarch, but I'm not sure.

Anyway, I'll report back shortly after trying again.

EDIT: Just tried it and it doesn't work. It's as I described above. It wants to load "n*exec".

EDIT 2: I have tried multiple other place for the quotes to go, but it just won't work =/. 

EDIT 3: Just to explain what happens with your suggested quotes:

Retroarch starts the mame core like normal, but I get the notification that "n*exec" is being loaded instead of the real rom. Then the screen just stays black, so the bbcb system isn't even launched correctly. I cannot enter the main system menu by pressing TAB.

Edited by SiriusVI
Link to comment
Share on other sites

54 minutes ago, JoeViking245 said:

If RA MAME is like standalone MAME, for Computers (i.e. Acorn Micro) you need to press Scroll Lock to get out of the emulated keyboard.  Then you can press Tab to get to MAMEs game menu.

I know, but it doesn't work. I just wanted to tell you that with the quotes you suggested, the bbcb system doesn't even load.

If I use my original command:

-L "M:\LaunchBox\Emulators\RetroArch\cores\mame_libretro.dll" "bbcb -autoboot_delay 1 -autoboot_command *cat\n*exec who0\n -rp \"L:\LaunchBox\Games\Arcade\" -flop1 \"%romfile%\"

Mame loads the bbcb just fine, it just fails to autoload the command to boot the rom. But I can manually type in the correct command and get the rom to load.  Now I just need a way to get the command line to accept the SPACE. 

The quotes you suggested don't work. Mame in Retroarch seems to work differently than standalone mame, or maybe it's the disable quotes option in the Launcbox emulator settings that's the problem.

EDIT: Isn't there a special command that can send "SPACE", the same way "\n" sends "RETURN"?

Edited by SiriusVI
Link to comment
Share on other sites

4 minutes ago, JoeViking245 said:

image.thumb.png.f7e3b8735a450e8c79cb7b15716ec17a.png

:) 

So what did you end up with for your full command line for "Doctor Who and the mines of terror"?

Sorry, I'm very bad with command lines. Did't even know that it's called ascii code, hehe.

The full command line is:

-L "M:\LaunchBox\Emulators\RetroArch\cores\mame_libretro.dll" "bbcb -autoboot_delay 1 -autoboot_command *cat\n*exec\x20who0\n -rp \"L:\LaunchBox\Games\Arcade\" -flop1 \"%romfile%\"

 

However, as previously said, the game won't even work with at least the retroarch version of mame (haven't tried standalone mame). The graphics are all glitchy. But it's good to know that can use these types of codes for other games that need them 😃

  • Like 1
Link to comment
Share on other sites

  • 8 months later...
23 minutes ago, kerlon123 said:

even in different variations this didn't work with retroarch.... -L "cores\mame_libretro.dll" "aquarius -rp \"Z:\Retro\Games\Mattel\Aquarius\Games\aquarius_cart (MAME)\" -cart1 \"%romfile%\""

 

Edited by kerlon123
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...