Skip to content

vc64webplayer_d64

mithrendal edited this page Jul 26, 2021 · 3 revisions

how to preload other roms than the open roms you have learned already in chapter preloading the web player with specific system roms

also in that chapter you know that you could add an arbitrary .d64 diskfile ....

like so

<div>
<img 
style="width:60vw" src="my_demo.gif" 
onclick="
let config=
{
  dialog_on_missing_roms:false,
  dialog_on_disk:false,
  navbar:false
};

vc64web_player.samesite_file=
{
  floppy_rom_url:floppy_url,
  basic_rom_url:basic_url,
  kernal_rom_url:kernal_url,
  charset_rom_url:charset_url,
  url:file_url,name:'my_demo.d64'
};

vc64web_player.load(this,encodeURIComponent(JSON.stringify(config)));
return false;
"		
/>
</div>

now this starts the emulator but leaves the user to type load"*",8,1 or something like that on his own ...

what about to auto load and auto run a disk ? Yes we can do this easily by scripting ...

first our autoload/autorun script is this

async function load_from_inserted_disk(prg_or_dir)
{
  if(prg_or_dir != null)
   { 
       if(prg_or_dir=="$")
       {
        await action(`'load"$",8'=>Enter`);
        await disk_loading_finished();
        await action(`'list'=>Enter`);
       }
       else
       {
        await action(`'load"${prg_or_dir}*",8,1'=>Enter`);
        await disk_loading_finished();
        await action(`'run'=>Enter`);
       }
   }
}

and second do we add this script to the config object before we load the emulator with vc64web_player.load

  any_prg_from_that_disk='myprogram'; // the name of the program on the disk you like to start
  config.buttons= [{
    run: true, 
    script: `await wasm_ready_after_reset();(${load_from_inserted_disk.toString()})('${any_prg_from_that_disk}');` 
  }];

summary this autorun actionbutton script waits until the emulator is ready and then starts to load the disk. It waits until loading is finished and then runs automatically the program.

Clone this wiki locally