Uridium and other games not working on JSBeeb

want to talk about MESS/model b/beebem/b-em/electrem/elkulator? do it here!
User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Uridium and other games not working on JSBeeb

Post by lurkio » Thu Jul 25, 2019 10:25 am

Moderators note: This thread has been split from the Detecting BeebEm thread. Mark

Rich Talbot-Watkins wrote:
Thu Jul 25, 2019 8:33 am
and of course jsbeeb
Several games that work in BeebEm simply fail in JSBeeb:

I'm glad we now have a variety of emulators and I'm awed and impressed by the people who created them and continue to work on them. But all the emulators have flaws.

:idea:
Last edited by 1024MAK on Sat Aug 03, 2019 10:29 pm, edited 2 times in total.

User avatar
billcarr2005
Posts: 1358
Joined: Fri Sep 09, 2005 3:01 pm
Location: UK
Contact:

Re: Detecting BeebEm

Post by billcarr2005 » Fri Jul 26, 2019 8:23 am

lurkio wrote:
Thu Jul 25, 2019 10:25 am
Several games that work in BeebEm simply fail in JSBeeb:
It's a terribly small number, and it might be because the emulation is *too* accurate!
In what way does Uridium fail? Perhaps it could be a fault in the "cracked" game...
Could you try the following disk image? It's taken from the original disk, with the protection code removed / expected value inserted. When the code in the program "Game" is being executed, an OSWORD &7D (125) - Read cycle number of disc is attempted at &7700 (found at MDFS) =D>

EDIT: Seems like we've been here before...
viewtopic.php?f=51&t=13967&p=184720#p184647

EDIT: Deleted attachment, since the one linked above works
Last edited by billcarr2005 on Wed Aug 07, 2019 8:28 pm, edited 4 times in total.

User avatar
Rich Talbot-Watkins
Posts: 1512
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Detecting BeebEm

Post by Rich Talbot-Watkins » Fri Jul 26, 2019 11:36 am

In any case, the version on STH works fine in jsbeeb:

https://bbc.godbolt.org/?&disc=sth%3AHe ... ridium.zip#

Edit: as does the version you just posted!
Last edited by Rich Talbot-Watkins on Fri Jul 26, 2019 11:38 am, edited 1 time in total.

User avatar
billcarr2005
Posts: 1358
Joined: Fri Sep 09, 2005 3:01 pm
Location: UK
Contact:

Re: Detecting BeebEm

Post by billcarr2005 » Fri Jul 26, 2019 3:15 pm

lurkio wrote:
Thu Jul 25, 2019 10:25 am
Several games that work in BeebEm simply fail in JSBeeb:
Further chipping away... I wouldn't bother listing Dunjunz as a failure either, since it's an unofficial hack which was probably only ever intended to work on the author's machine :roll:

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Detecting BeebEm

Post by scarybeasts » Sat Jul 27, 2019 5:29 am

This thread has inspired me to look at fixing any prominent jsbeeb accuracy issues. It's a welcome break from hacking away at my own proto-emulator and ultimately will probably be of more use to people.

I have a PR up to fix Snapper, for example, which is broken (all versions) but we understand why from previous corner case testing in this forum.

It's a little hard to work out what other games demonstrate jsbeeb bugs vs. being just dodgy disk images. Does anyone have any strong opinions on other clearly not-working-in-jsbeeb software should be fixed as a priority?


Cheers
Chris

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Detecting BeebEm

Post by lurkio » Sat Jul 27, 2019 6:28 am

scarybeasts wrote:
Sat Jul 27, 2019 5:29 am
It's a little hard to work out what other games demonstrate jsbeeb bugs vs. being just dodgy disk images.
I believe that all the games and disc-images listed as not working in JSBeeb in the Issue report I linked to earlier all do work in BeebEm and on a real Beeb. At least, Uridium does:
If a disc-image works in BeebEm and on a real Beeb but not in JSBeeb then I think it’s fair to say that it’s JSBeeb that’s at fault.

:idea:
Last edited by lurkio on Sat Jul 27, 2019 6:30 am, edited 1 time in total.

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Detecting BeebEm

Post by scarybeasts » Sat Jul 27, 2019 8:40 am

lurkio wrote:
Sat Jul 27, 2019 6:28 am
If a disc-image works in BeebEm and on a real Beeb but not in JSBeeb then I think it’s fair to say that it’s JSBeeb that’s at fault.

:idea:
Yes, I think that's fair.

However, in the specific case of Uridium, I'm unconvinced there's anything to do:

1) Plain BBC B.
While the Uridium disk image referenced does not appear to work in the version of jsbeeb hosted on bbcmicro.co.uk, it does work in latest jsbeeb at https://bbc.godbolt.org/

2) Master mode.
I can reproduce the problem where the game cannot be started, i.e. the keyboard appears unresponsive. However it is unclear if Uridium would work on a real Master. It's doing something pretty crazy:
[ITRP] 4877: LDY #$07
[ITRP] 4879: LDA #$0F
[ITRP] 487B: STA $FE42
[ITRP] 487E: LDA $4905,Y
[ITRP] 4881: STA $FE40
[ITRP] 4884: DEY
[ITRP] 4885: BPL $487E

This loop spews values all over the system VIA attached peripherals, including setting bit 1 and bit 2 of the addressable latch. On a BBC B I think these are mapped to the (optional) speech processor. On a Master, this will activate reads and writes to the (built-in) CMOS. The CMOS access doesn't appear to be deactivated so the CMOS reads will likely interfere with attempts to read the keyboard. The results are also likely to be non-deterministic depending on existing CMOS contents on a real machine.
It's possible there are bugs in the jsbeeb and b-em (tested, same result) CMOS emulation but at any rate, Uridium seems to be coded in a risky way for broad compatability.


I'm happy to try and diagnose other jsbeeb issues if anyone has recommendations.


Cheers
Chris

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Detecting BeebEm

Post by lurkio » Sat Jul 27, 2019 9:00 am

scarybeasts wrote:
Sat Jul 27, 2019 8:40 am
in the specific case of Uridium, I'm unconvinced there's anything to do:

1) Plain BBC B.
While the Uridium disk image referenced does not appear to work in the version of jsbeeb hosted on bbcmicro.co.uk, it does work in latest jsbeeb at https://bbc.godbolt.org/
Ah! I wasn’t aware of that. I’m only on a phone so I can’t test properly right now but there’s a second version of JSBeeb installed on bbcmicro.co.uk which has disc-drive noises and is newer than the other “silent” version. I think it’s used for the game Zen. If you can wrangle the URL params, you might be able to check whether the disc-image of Uridium in question works on that second install of JSBeeb on bbcmicro.co.uk. Just in case you’re curious.

:?:
Last edited by lurkio on Sat Jul 27, 2019 9:25 am, edited 2 times in total.

User avatar
tricky
Posts: 3599
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Detecting BeebEm

Post by tricky » Sat Jul 27, 2019 4:35 pm

I have come across a couple of instances where things are timing dependant and booting a disc on jsbeeb is deterministic (may not actually be the case) and hence always hits the issue. The timing of key presses seem to be more consistent in jsbeeb and I believe that this can also make a dodgy program that might work 99% of the time on HW fail in an emulator.

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Detecting BeebEm

Post by lurkio » Sun Jul 28, 2019 8:19 am

Hmm. So I just tried the disc-image of Uridium that's been linked from bbcmicro.co.uk all this time: I just clicked the existing Play button to launch the game in JSBeeb, and it worked! JSBeeb booted into Master mode because of a modified URL. So I edited the URL to boot into Model B mode, and Uridium worked then too. This was in Firefox on macOS.

So it seems I can no longer get Uridium to fail in JSBeeb! Good news, but I'm not sure why it's suddenly working -- for me at any rate.

EDIT: Hold on -- I just tried it again and it crashed! The JavaScript console window -- or was it the JSBeeb debug window? -- popped up in Firefox! I now seem to dimly recall that this disc-image of Uridium was always a bit random in JSBeeb: sometimes it would work, sometimes it wouldn't.

Am very confused.

:?

User avatar
billcarr2005
Posts: 1358
Joined: Fri Sep 09, 2005 3:01 pm
Location: UK
Contact:

Re: Detecting BeebEm

Post by billcarr2005 » Sun Jul 28, 2019 2:40 pm

Might I humbly suggest that we use the "fixed" version here - taken from the original disk with minimal changes

viewtopic.php?f=51&t=13967&p=184720#p184671

which contains the instructions, but doesn't frequently change the metals in the top right corner, which I just noticed when trying out the bbcmicro.co.uk version and assume is a bug that makes it worthwhile changing?
If it still crashes, then we could agree that Uridium is certainly bugged. I appreciate that Lee has tested on a real BBC and various emulators, but if it's an occasional bug, perhaps he wouldn't have encountered it...
Last edited by billcarr2005 on Sun Jul 28, 2019 2:43 pm, edited 2 times in total.

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Detecting BeebEm

Post by lurkio » Sun Jul 28, 2019 5:12 pm

billcarr2005 wrote:
Sun Jul 28, 2019 2:40 pm
Might I humbly suggest that we use the "fixed" version here - taken from the original disk with minimal changes viewtopic.php?f=51&t=13967&p=184720#p184671 which contains the instructions, but doesn't frequently change the metals in the top right corner, which I just noticed when trying out the bbcmicro.co.uk version and assume is a bug that makes it worthwhile changing?
Oh, lawks! Yes, I think we'd better use your version then.

I'll upload it to bbcmicro.co.uk but I'll also ask Mick to replace the version that's currently on his compilation disc too, because we're trying to keep Mick's DSD collection and the bbcmicro.co.uk archive in sync as far as possible.

:idea:
Last edited by lurkio on Sun Jul 28, 2019 5:15 pm, edited 1 time in total.

Michael Brown
Posts: 2135
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham
Contact:

Re: Detecting BeebEm

Post by Michael Brown » Wed Jul 31, 2019 7:35 am

Hi All,

The version of Uridium I had used on D031 was a sort of Hybrid of the original tape files and then the last file from a disc hack as it was protected on tape.

I had stored some code in my instructions to be stored at &100 which loads the main game to avoid having to alter/extend the original tape file. It may be this code that is causing the problem with the newer emulator.

I will copy Bill's version onto D031 asap.
It's kind of ironic that I am now being asked to amend a copy of game to work on a newer emulator rather than the author of the emulator being asked to upgrade the emulator to run the game as BeenEm and others do. But I will do it as I believe in having the best version of all games available for all players on all formats.

Mick.

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Detecting BeebEm

Post by lurkio » Wed Jul 31, 2019 9:43 am

Michael Brown wrote:
Wed Jul 31, 2019 7:35 am
I will copy Bill's version onto D031 asap.
It's kind of ironic that I am now being asked to amend a copy of game to work on a newer emulator rather than the author of the emulator being asked to upgrade the emulator to run the game as BeenEm and others do.
Normally I might agree with you, but in this specific case it seems that the version of Uridium you'd been using on your Disc031 DSD, and which we'd copied to bbcmicro.co.uk, has a bug whereby the metal name in the top right corner of the screen keeps changing (each time you die, I think) for no apparent reason!

:!:
Last edited by lurkio on Wed Jul 31, 2019 11:58 am, edited 3 times in total.

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Detecting BeebEm

Post by scarybeasts » Sat Aug 03, 2019 6:29 am

Michael Brown wrote:
Wed Jul 31, 2019 7:35 am
It's kind of ironic that I am now being asked to amend a copy of game to work on a newer emulator rather than the author of the emulator being asked to upgrade the emulator to run the game as BeenEm and others do. But I will do it as I believe in having the best version of all games available for all players on all formats.

Mick.
FWIW, I'm on a mission to try and crank through all serious jsbeeb bugs. As such, the "Uridium issues" got to the top of my queue last night.

For the case of Uridium crashing in the loader, there appears to be a pretty serious bug in the Uridium loader relating to setting up an IRQ routine while leaving IRQs enabled. I was able to get the bug to trigger in b-em too but it's a race condition so your mileage will vary depending on emulator and the weather outside.

I put details here: https://github.com/mattgodbolt/jsbeeb/issues/130

I also posted a tentative fix, based on the version at bbcmicro.co.uk, which just involves moving an SEI instruction down a little bit so that it doesn't get "clobbered" by a CLI inside an OSCLI call.

There remains a bug (in both b-em and jsbeeb) in master mode where the game can't be started. I'm looking to fix that but using plain model b mode should be fine for this game for now.


Cheers
Chris

User avatar
billcarr2005
Posts: 1358
Joined: Fri Sep 09, 2005 3:01 pm
Location: UK
Contact:

Re: Detecting BeebEm

Post by billcarr2005 » Sat Aug 03, 2019 8:29 am

scarybeasts wrote:
Sat Aug 03, 2019 6:29 am

I also posted a tentative fix, based on the version at bbcmicro.co.uk, which just involves moving an SEI instruction down a little bit so that it doesn't get "clobbered" by a CLI inside an OSCLI call.
Although, as discussed in the post above, you've fixed a version which is broken in other ways :roll:
It seems that the (other) "fixed" version loads the file GAME and then executes the code at &7725 to stop interrupts and relocate code down from &6E00 to &200 through to &B00 and then from &1900 (through to &6E00) down to &B00
Both versions seem to end up executing code at &4800 after relocation has been done, although this appears different.

FWIW, I would tend to think it's not worth trying to fix up an already broken "unofficial / unreleased / hacked" version to make it work somewhat better, when there appears to be a perfectly functional version already...

(Although finding out what makes them nonfunctional is useful for emulation / to stop bad coding practices purposes!)
Last edited by billcarr2005 on Sat Aug 03, 2019 8:51 am, edited 1 time in total.

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Detecting BeebEm

Post by scarybeasts » Sat Aug 03, 2019 9:22 am

billcarr2005 wrote:
Sat Aug 03, 2019 8:29 am
Although, as discussed in the post above, you've fixed a version which is broken in other ways :roll:
Oh, unbelievable! I hadn't noticed the variant you're referring to.
sha256sum: 4e5f5aba3981978856ada91f1831ebb78faae0ea0a6bf59a7729de52e6c30adc

This one is doubly safe already. It has interrupts disabled for the tricky loop (SEI), _and_ the system VIA interrupt enabled register has been cleared for good measure.

The version I posted can be ignored.

At least we understand what is wrong with the dodgy versions and why some of the emulators crash on load.


Cheers
Chris

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Detecting BeebEm

Post by lurkio » Sat Aug 03, 2019 10:26 am

scarybeasts wrote:
Sat Aug 03, 2019 9:22 am
At least we understand what is wrong with the dodgy versions and why some of the emulators crash on load.
How come the "broken" version of the game apparently works without any problems on a real Beeb then?

:?:

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Detecting BeebEm

Post by scarybeasts » Sat Aug 03, 2019 10:37 am

lurkio wrote:
Sat Aug 03, 2019 10:26 am
scarybeasts wrote:
Sat Aug 03, 2019 9:22 am
At least we understand what is wrong with the dodgy versions and why some of the emulators crash on load.
How come the "broken" version of the game apparently works without any problems on a real Beeb then?

:?:
Emulators tend to have low resolution of keyboard polling and often the keyboard is polled at a predictable time relative to vsync. If you're unlucky, this reliably and repeatably trigger bugs like the Uridium loader one.
You can see in it action in jsbeeb by breakpointing the start of the problem loop &6F00 and looking at the crtc controller video beam position. It's usually in just the wrong place to generate a vsync IRQ at a really unfortunate time.


Cheers
Chris

chrisn
Posts: 476
Joined: Sat Apr 19, 2014 11:31 am
Location: UK
Contact:

Re: Detecting BeebEm

Post by chrisn » Sat Aug 03, 2019 10:39 am

Is it possible for one of the moderators to spin out the Uridium discussion to a new thread, or merge with this one, as we've drifted away from BeebEm as original topic?

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Detecting BeebEm

Post by lurkio » Sat Aug 03, 2019 10:52 am

scarybeasts wrote:
Sat Aug 03, 2019 10:37 am
Emulators tend to have low resolution of keyboard polling and often the keyboard is polled at a predictable time relative to vsync.
Is that something that needs to be improved in JSBeeb then?

(I’m not sure if that’s a silly question or not! Please forgive my ignorance.)

:?:

User avatar
1024MAK
Posts: 9049
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Detecting BeebEm

Post by 1024MAK » Sat Aug 03, 2019 12:57 pm

chrisn wrote:
Sat Aug 03, 2019 10:39 am
Is it possible for one of the moderators to spin out the Uridium discussion to a new thread, or merge with this one, as we've drifted away from BeebEm as original topic?
Yep. I’ll see what I can do...

Done :D

Mark
Last edited by 1024MAK on Sat Aug 03, 2019 10:32 pm, edited 1 time in total.

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Uridium and other games not working on JSBeeb

Post by lurkio » Wed Aug 14, 2019 8:34 am

Chris/scarybeasts has been busy fixing bugs in JSBeeb, and the new version of JSBeeb is now live at godbolt.org:
I'd encourage everyone to test it with loads of different .SSD and .DSD disc-images to see how robust it is. Seems pretty good so far!

=D> =D> =D>

EDIT: To highlight a couple of the changes:

(1) There's a new config, so you can now choose to use DFS1.2 (instead of the default DFS0.9), which helps with OddJob.

(2) There's a noseek mode which reproduces the behaviour of the old version of JSBeeb that's currently installed at bbcmicro.co.uk where there aren't any disc-drive noises, and games appear to load silently and "instantly".
Last edited by lurkio on Wed Aug 14, 2019 9:38 am, edited 5 times in total.

User avatar
vanekp
Posts: 642
Joined: Thu Nov 30, 2000 7:09 am
Location: The Netherlands
Contact:

Re: Uridium and other games not working on JSBeeb

Post by vanekp » Wed Aug 14, 2019 10:07 am

mmm I am not seeing the disc option or DFS type settings under any of the menus. does it only work by putting the commands on the command line?
like in the two links you sent? i.e. https://bbc.godbolt.org/?model=B-DFS1.2&noseek
Peter.

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Uridium and other games not working on JSBeeb

Post by lurkio » Wed Aug 14, 2019 10:15 am

vanekp wrote:
Wed Aug 14, 2019 10:07 am
mmm I am not seeing the disc option or DFS type settings under any of the menus. does it only work by putting the commands on the command line?
like in the two links you sent? i.e. https://bbc.godbolt.org/?model=B-DFS1.2&noseek
Correct. I believe that the DFS1.2 and noseek options were designed for eventual use on bbcmicro.co.uk, primarily.

:idea:

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

Re: Uridium and other games not working on JSBeeb

Post by Matt Godbolt » Wed Aug 14, 2019 1:11 pm

Huge thanks to scarybeasts for all his changes to jsbeeb! And yes, there's currently no UI to pick the DFS1.2 or noseek: they're URL params only for now.

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Uridium and other games not working on JSBeeb

Post by scarybeasts » Fri Aug 16, 2019 8:10 am

lurkio wrote:
Wed Aug 14, 2019 8:34 am
Chris/scarybeasts has been busy fixing bugs in JSBeeb, and the new version of JSBeeb is now live at godbolt.org:
I'd encourage everyone to test it with loads of different .SSD and .DSD disc-images to see how robust it is. Seems pretty good so far!
Please do test! My main hope is that I fixed more software than I broke. I fixed (or at least diagnosed as not-the-emulator's fault) every documented game failure I could find. If there's anything still not right let me know and I'll try and fix it.


Cheers
Chris

User avatar
leenew
Posts: 3914
Joined: Wed Jul 04, 2012 3:27 pm
Location: Doncaster, Yorkshire
Contact:

Re: Uridium and other games not working on JSBeeb

Post by leenew » Fri Aug 16, 2019 9:31 am

Hi Chris,
Great work so far =D>
The issue that springs to my mind is the MODE 7 emulation.
I don't think any emulator gets this exactly right.
Some work was done emulating the beeb's teletext chip (including the bugs), and there are a couple of threads about it... which I can't find at the moment.
Can anyone point us to them please?


Lee.
EDIT: This may be one of them: viewtopic.php?f=4&t=15280&hilit=Beebem+mode+7
Last edited by leenew on Fri Aug 16, 2019 9:34 am, edited 1 time in total.

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Uridium and other games not working on JSBeeb

Post by lurkio » Fri Aug 16, 2019 10:01 am

Hopefully the complete lack of sound in Safari on macOS can also be fixed. There seems to be a potential solution here:
:idea:

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Uridium and other games not working on JSBeeb

Post by scarybeasts » Sat Aug 17, 2019 12:32 am

lurkio wrote:
Fri Aug 16, 2019 10:01 am
Hopefully the complete lack of sound in Safari on macOS can also be fixed. There seems to be a potential solution here:
:idea:
Ok, I'll sort this out.


Cheers
Chris

Post Reply