Author Topic: CPCBox, your CPC emulator in Javascript  (Read 105785 times)

0 Members and 1 Guest are viewing this topic.

Offline Zoe Robinson

  • Supporter
  • 6128 Plus
  • *
  • Posts: 628
  • Country: gb
  • I become a minor egg
    • ZoeRobinson.com
  • Liked: 595
  • Likes Given: 657
Re: CPCBox, your CPC emulator in Javascript
« Reply #525 on: 10:58, 23 October 13 »
I have to say I really like CPCBox - it's nice to use the same emulator regardless of the computer I'm sat at at the time. My only gripe is the default AZERTY keyboard, which confused the hell out of me for the first few times I used it. Is there an option to switch to QWERTY? If not, is that a planned update for the future?

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 468
  • Country: fr
    • CPCBox - CPC emulator in JavaScript
  • Liked: 162
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #526 on: 09:32, 24 October 13 »
Yes, I'm aware it's a big downside at the moment.
In the next CPCBox release I'm working on,  I've overhauled the keyboard handling to fix the issue.
Atwood's law (2007): "Any application that can be written in JavaScript, will eventually be written in JavaScript."

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: CPCBox, your CPC emulator in Javascript
« Reply #527 on: 13:57, 24 October 13 »
In the next CPCBox release I'm working on,  I've overhauled the keyboard handling to fix the issue.

The current version works on my iPhone (with Safari) at about 25fps which is impressive.

However, there is no sound and I can't control the keyboard.  Any plans to update these factors for Safari?

Would be great if you could - who needs an App (and all of Apples meglo-mania control mechanisms) when it works in a browser  ;)

Offline Zoe Robinson

  • Supporter
  • 6128 Plus
  • *
  • Posts: 628
  • Country: gb
  • I become a minor egg
    • ZoeRobinson.com
  • Liked: 595
  • Likes Given: 657
Re: CPCBox, your CPC emulator in Javascript
« Reply #528 on: 16:13, 24 October 13 »
The current version works on my iPhone (with Safari) at about 25fps which is impressive.

However, there is no sound and I can't control the keyboard.  Any plans to update these factors for Safari?

Would be great if you could - who needs an App (and all of Apples meglo-mania control mechanisms) when it works in a browser  ;)


Oooh, a virtual keyboard displayed under the screen would be a cool way of dealing with the keyboard-on-phones issue. Add in cloud/Dropbox support and you could use the disk drive/tape deck with files stored on the phone, too...

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 468
  • Country: fr
    • CPCBox - CPC emulator in JavaScript
  • Liked: 162
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #529 on: 11:55, 25 October 13 »
However, there is no sound and I can't control the keyboard.  Any plans to update these factors for Safari?
I've added a virtual keyboard in CPCBox.next. I posted a screenshot of it some time ago.

For the sound, I'm currently using Mozilla's Audio Data API as there wasn't any standard sound API in browsers.
The good news is that Firefox 25 will support the W3C Web Audio API and other browsers will follow soon too.

So yes, I'm looking to migrate CPCBox to the Web Audio API. But there will be some work to do as these 2 APIs are totally different in the way they work.
« Last Edit: 12:07, 25 October 13 by phi2x »
Atwood's law (2007): "Any application that can be written in JavaScript, will eventually be written in JavaScript."

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 468
  • Country: fr
    • CPCBox - CPC emulator in JavaScript
  • Liked: 162
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #530 on: 12:04, 25 October 13 »
Oooh, a virtual keyboard displayed under the screen would be a cool way of dealing with the keyboard-on-phones issue. Add in cloud/Dropbox support and you could use the disk drive/tape deck with files stored on the phone, too...
For the moment, cloud storage is quite a mess of proprietary APIs.
I don't want to add specific support in CPCBox for Dropbox, and then specific support for Google Drive, and then specific support for SkyDrive...

It would be great if there was a standard way of accessing any cloud service. But that doesn't exist yet  :(
Atwood's law (2007): "Any application that can be written in JavaScript, will eventually be written in JavaScript."

Offline ralferoo

  • Supporter
  • 6128 Plus
  • *
  • Posts: 969
  • Country: gb
  • Liked: 580
  • Likes Given: 222
Re: CPCBox, your CPC emulator in Javascript
« Reply #531 on: 12:51, 02 November 13 »
Yes, I'm aware it's a big downside at the moment.
In the next CPCBox release I'm working on,  I've overhauled the keyboard handling to fix the issue.
I just tried using CPCBox to test some tape functionality (that's another matter) and found I couldn't even try CPCBox with my own tape at all... Why?

Well, choosing the 464 configuration with a tape player lets me select my tape image, but I can't RUN" because there's an AMSDOS ROM loaded and I can't switch to tape mode because I can't type | nor it seems any punctuation apart from a comma.

Is there a workaround?

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 468
  • Country: fr
    • CPCBox - CPC emulator in JavaScript
  • Liked: 162
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #532 on: 15:04, 02 November 13 »
There's no simple workaround I'm afraid.
I'm aware of the issue. It will be fixed in the next release.
Atwood's law (2007): "Any application that can be written in JavaScript, will eventually be written in JavaScript."

Offline dragon

  • 6128 Plus
  • ******
  • Posts: 1.380
  • Country: es
  • Liked: 572
  • Likes Given: 482
Re: CPCBox, your CPC emulator in Javascript
« Reply #533 on: 19:34, 16 December 13 »
i try it in ps4 web browser, and it works,but control keys are bad mapped. Is possible fix it?

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 468
  • Country: fr
    • CPCBox - CPC emulator in JavaScript
  • Liked: 162
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #534 on: 00:42, 27 December 13 »
I've added a simple documentation page in CPCBox. Just thought it would be nice for newcomers.
Atwood's law (2007): "Any application that can be written in JavaScript, will eventually be written in JavaScript."

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1976
  • Likes Given: 4650
Re: CPCBox, your CPC emulator in Javascript
« Reply #535 on: 00:40, 28 December 13 »
Well, except you everybody is a newcomer. So you did well including that.  :)


When creating a own product it's hard to write good docs, because one knows everything about it and it's hard to imagine the questions of newbies.

TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 468
  • Country: fr
    • CPCBox - CPC emulator in JavaScript
  • Liked: 162
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #536 on: 20:07, 28 December 13 »
CPCBox.next being at least a few months away  :-[ , I finally decided to backport to the current CPCBox the keyboard patch that I intended for that release.
Please remember that you have to reset the CPC after changing the firmware option. That's because the CPC initializes the keymap at boot or something like that, so it's not a limitation of CPCBox.

French and English keyboards should work 100%.
With the Spanish keyboard, 3 keys are missing in Firefox. It's a bug of Firefox, it doesn't report these keys at all when pressed :(
The Spanish keyboard should work 100% with other browsers.

Tell me if you find anything wrong.
Atwood's law (2007): "Any application that can be written in JavaScript, will eventually be written in JavaScript."

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 468
  • Country: fr
    • CPCBox - CPC emulator in JavaScript
  • Liked: 162
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #537 on: 20:51, 02 February 14 »
I've just come to realize that browsers are crap. All. Really.

Here's a simple benchmark I made:
CPCBox - DOM benchmark

[attachimg=1]
Atwood's law (2007): "Any application that can be written in JavaScript, will eventually be written in JavaScript."

Offline robcfg

  • Supporter
  • 6128 Plus
  • *
  • Posts: 2.235
  • Country: se
  • 8-Bit Technomancer
    • index.php?action=treasury
  • Liked: 992
  • Likes Given: 2276
Re: CPCBox, your CPC emulator in Javascript
« Reply #538 on: 21:54, 02 February 14 »
On my machine chrome gets 250ms per frame. That's 4 frames per second... Hmmm, yes, that's crap.

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1976
  • Likes Given: 4650
Re: CPCBox, your CPC emulator in Javascript
« Reply #539 on: 22:23, 02 February 14 »
192 here. But the computer is couple years old.
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 468
  • Country: fr
    • CPCBox - CPC emulator in JavaScript
  • Liked: 162
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #540 on: 00:06, 03 February 14 »
Browsers handle the Unreal Engine 3 engine at full 60fps, with asm.js and webGL.
But they just can't handle a simple hex viewer at more than 6 fps.

I mean, wtf!? ???

Atwood's law (2007): "Any application that can be written in JavaScript, will eventually be written in JavaScript."

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 15.171
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 3007
  • Likes Given: 5336
Re: CPCBox, your CPC emulator in Javascript
« Reply #541 on: 11:01, 03 February 14 »
300ms Opera Chromium and Chrome, 550ms FF, 350 IE. Pffft!

Offline Lone

  • Supporter
  • CPC664
  • *
  • Posts: 94
  • Country: fr
  • Liked: 169
  • Likes Given: 74
Re: CPCBox, your CPC emulator in Javascript
« Reply #542 on: 11:03, 03 February 14 »
I think WebGl and asm.js offer some shortcut to avoid lots of layers of code. Also, modern computer developpement focus on "good code that can be maintain",  despite of "fast code"


Since I found that modern OS and CPU don't allow self modifying code, I'm like you, I lost my illusions...


PS : 130 ms on chrome (bu with a nice core I7 CPU)

Offline Sykobee (Briggsy)

  • 6128 Plus
  • ******
  • Posts: 697
  • Country: gb
  • Liked: 238
  • Likes Given: 354
Re: CPCBox, your CPC emulator in Javascript
« Reply #543 on: 12:32, 03 February 14 »
Thanks for putting in the English keyboard option.


Please note that on UK keyboards the " and @ are swapped from the US keyboard, so in CPC Box the "{" is showing up for shift-2, and the quote for shift-' (to the right of ;).


There might be other similar issues.


Chrome gave me around 125ms here, on my fast work PC in Linux.

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 468
  • Country: fr
    • CPCBox - CPC emulator in JavaScript
  • Liked: 162
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #544 on: 21:20, 03 February 14 »
Thanks for putting in the English keyboard option.
Please note that on UK keyboards the " and @ are swapped from the US keyboard, so in CPC Box the "{" is showing up for shift-2, and the quote for shift-' (to the right of ;) .
Remember that after changing the keyboard setting, CPCBox needs a manual reset of the CPC. That's the issue you faced here.
Atwood's law (2007): "Any application that can be written in JavaScript, will eventually be written in JavaScript."

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 468
  • Country: fr
    • CPCBox - CPC emulator in JavaScript
  • Liked: 162
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #545 on: 00:48, 05 February 14 »
I've just noticed that Mozilla's Audio Data API is broken in Firefox 27  >:(
Not sure if it's intentional or not, but that's bad news as that's what I use to output sound in CPCBox :(

And it's probable that Mozilla won't fix it, as they've marked that API as deprecated since a few Firefox releases.

Worse yet, I haven't started to work on the Web Audio API either.
As these 2 APIs don't handle things the same way at all, I think it won't be easy stuff...

[attachimg=1]
Atwood's law (2007): "Any application that can be written in JavaScript, will eventually be written in JavaScript."

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1976
  • Likes Given: 4650
Re: CPCBox, your CPC emulator in Javascript
« Reply #546 on: 03:21, 05 February 14 »
So... what now? Back to Java?
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 468
  • Country: fr
    • CPCBox - CPC emulator in JavaScript
  • Liked: 162
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #547 on: 20:14, 05 February 14 »
False alarm. The issue magically disappeared after I restarted Firefox.
Atwood's law (2007): "Any application that can be written in JavaScript, will eventually be written in JavaScript."

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 15.171
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 3007
  • Likes Given: 5336
Re: CPCBox, your CPC emulator in Javascript
« Reply #548 on: 20:18, 05 February 14 »
Lol... troubleshooting 101 :D

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1976
  • Likes Given: 4650
Re: CPCBox, your CPC emulator in Javascript
« Reply #549 on: 21:05, 05 February 14 »
Take a deep breath...
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus