Loading a tape in jsbeeb

want to talk about MESS/model b/beebem/b-em/electrem/elkulator? do it here!
User avatar
pau1ie
Posts: 328
Joined: Thu May 10, 2012 9:48 pm
Location: Bedford

Loading a tape in jsbeeb

Postby pau1ie » Sat Jun 17, 2017 10:13 pm

So, on bbcmicro.co.uk to run a disc, I use a parameter like disc=<url>. This is actually undocumented behaviour, but it works.

If I change disc t tape I get an error, it is trying to do what is documented and load it from the tapes directory. Is there any way to provide a URL for a tape like for a disc? Actually I think I need to change the jsbeeb source - looking at the loadDiscImage it checks whether the scheme is http or https and downloads (And unzips if necessary) the file. This doesn't exist in the loadTapeImage.

Can anyone change tapes to work like discs? If not I will have a go. I don't know javascript, but maybe some copying and pasting will make things work...
I'm working on http://bbcmicro.co.uk

User avatar
richardtoohey
Posts: 3378
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand

Re: Loading a tape in jsbeeb

Postby richardtoohey » Sun Jun 18, 2017 2:44 am

Had a hack at it for you.

Seems to set up the correct tape, but you have to do a *TAPE and CH."" so not exactly 100% what you want. Yet.

All the action in main.js so far:

Copy/pasted the http/https block as you suggested - middle chunk below

Code: Select all

 655             if (schema === '|' || schema === "sth") {
 656                 return tapeSth.fetch(tapeImage).then(function (image) {
 657                     processor.acia.setTape(tapes.loadTapeFromData(tapeImage, image));
 658                 });
 659             }
 660
 661
 662             if (schema === "http" || schema === "https") {
 663                 return utils.loadData(schema + "://" + tapeImage).then(function (tapeData) {
 664                     if (/\.zip/i.test(tapeImage)) {
 665                         var unzipped = utils.unzipDiscImage(tapeData);
 666                         tapeData = unzipped.data;
 667                         tapeImage = unzipped.name;
 668                     }
 669                     processor.acia.setTape(tapes.loadTapeFromData(tapeImage, tapeData));
 670                 });
 671             }
 672
 673             return tapes.loadTape("tapes/" + tapeImage).then(function (tape) {
 674                 processor.acia.setTape(tape);
 675             });
So this works (in that the UEF is noticed and things are ready to go ...) on my localhost, with a UEF:

http://localhost/jsbeeb/index.html?tape ... evenge.uef

Console log messages:

Code: Select all

GL Canvas set up
6502.js:789 Loading OS from roms/os.rom
6502.js:772 Loading ROM from roms/BASIC.ROM
6502.js:772 Loading ROM from roms/b/DFS-0.9.rom
via.js:369 Using physical key layout
fdc.js:5 Loading disc from discs/elite.ssd
utils.js:811 Ungzipping localhost/jsbeeb/videosRevenge.uef
tapes.js:198 Detected a UEF tape
google-drive.js:16 Google Drive: available

Obviously for this to work with bbcmicro.co.uk the main jsbeeb site would need the new code (and sure it could be done better than my attempts.)

Think that's all I did but double-checking ... I did originally have a "tape" check near the "disc","disc1" switch but don't think that was needed.

User avatar
richardtoohey
Posts: 3378
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand

Re: Loading a tape in jsbeeb

Postby richardtoohey » Sun Jun 18, 2017 2:58 am

Browser caching ... gnnnarrrrr

Link a bit mangled (you can't use it obviously but it doesn't show the tape= part properly above):

Code: Select all

http://localhost/jsbeeb/index.html?tape=http://localhost/jsbeeb/videosRevenge.uef

Still not sure if you need a tape chunk, but here's what it looked like if you need it:

Code: Select all

  93                         case "disc":
  94                         case "disc1":
  95                             discImage = val;
  96                             break;
  97                         case "tape":
  98                             tapeImage = val;
  99                             break;
 100                         case "rom":
 101                             extraRoms.push(val);
 102                             break;

So all I've done is download the jsbeeb code from github, unzip it to jsbeeb directory on my localhost, dumped a UEF in the same directory, and made the two changes to main.js (and I'm not sure if the second change is even needed, so just try the first one first.)

I can definitely then do *TAPE, CH."" and it starts to load the tape files. Having said that it hit Block? etc. issues but that could be my browser/computer etc. so hopefully this is a good start for you.

User avatar
pau1ie
Posts: 328
Joined: Thu May 10, 2012 9:48 pm
Location: Bedford

Re: Loading a tape in jsbeeb

Postby pau1ie » Sun Jun 18, 2017 9:07 pm

Thanks Richard, that's perfect. I only needed the http/https block, then the following works:

Code: Select all

http://localhost/~paul/e/jsbeeb/play.php?autochain&tape=http://localhost/~paul/e/gameimg/discs/7/JugglePuzzle_BE.uef
I'm working on http://bbcmicro.co.uk

User avatar
pau1ie
Posts: 328
Joined: Thu May 10, 2012 9:48 pm
Location: Bedford

Re: Loading a tape in jsbeeb

Postby pau1ie » Sun Jun 18, 2017 10:06 pm

Created a pull request to merge the change into jsbeeb.

https://github.com/mattgodbolt/jsbeeb/pull/147
I'm working on http://bbcmicro.co.uk

User avatar
richardtoohey
Posts: 3378
Joined: Thu Dec 29, 2011 5:13 am
Location: Tauranga, New Zealand

Re: Loading a tape in jsbeeb

Postby richardtoohey » Sun Jun 18, 2017 11:55 pm

=D>

I wasn't sure about re-using utils.unzipDiscImage but it seemed (from a quick skim!) to be handling zip data regardless of tape/disc so hopefully OK (I didn't try a zipped UEF.)

User avatar
Matt Godbolt
Posts: 163
Joined: Mon Jul 31, 2006 10:02 am
Location: Chicago
Contact:

Re: Loading a tape in jsbeeb

Postby Matt Godbolt » Mon Jun 19, 2017 12:56 pm

Thanks for this! I merged and pushed to my release branch and it should now be live on bbc.godbolt.org!


Return to “emulators”

Who is online

Users browsing this forum: No registered users and 2 guests