Running Wonderland from a hard disk

chat about arc/risc pc gaming & RISC OS software here (NOT the core OS!)

Related forum: adventures


markdryan
Posts: 41
Joined: Sun Aug 20, 2017 10:37 pm
Contact:

Running Wonderland from a hard disk

Postby markdryan » Sat Apr 21, 2018 5:45 pm

Hi All,

I'm trying to get Magnetic Scroll's Wonderland to run from harddisk (IDEFS CF card) on my 4MB ARM2 RISCOS 3.11 A3000. The game runs fine from the floppies but the disk swapping is really tedious. The game comes with an installation program which seems to correctly copy all the files from the floppies onto the harddisk. However, when I run the game, it crashes. I see the loading screen and then "Illegal address (e.g., wildly outside array bounds). I have an original copy of the game but the original disks are a little flaky. I play, and I installed, the game from copies that I have made of the original floppy disks.

Has anyone come accross this issue before? If not, I might give ADFFS a try.

Mark

sirbod
Posts: 819
Joined: Mon Apr 09, 2012 8:44 am
Location: Essex
Contact:

Re: Running Wonderland from a hard disk

Postby sirbod » Sun Apr 22, 2018 7:32 am

markdryan wrote:Has anyone come accross this issue before? If not, I might give ADFFS a try.

The game has a couple of issues in its loader, it will generate an Abort in RISC OS if the disc it's running from isn't named and will only run from either ADFS::4 or SCSIFS::4, which are hardcoded.

It's next on my list of game bugs/issues to fix as although ADFFS gets it running on modern machines, this prevents it working when installed to SD on a Pi. I'll probably make a start on it next week, as I've just finished resolving the multitude of issues in the TOPOLOGIKA loader.

markdryan
Posts: 41
Joined: Sun Aug 20, 2017 10:37 pm
Contact:

Re: Running Wonderland from a hard disk

Postby markdryan » Sun Apr 22, 2018 8:54 am

Thanks for your reply. I tried naively replacing the harcoded SCSIFS::4 and ADFS::4 strings in the win1 binary with IDEFS::4, taking care not to modify the size of the file. The game still crashes in the same way. I guess it's crashing before it reads these strings, perhaps due to the first issue you mentioned. My disk is named though. It's called something like IDEDisc4.

Do you know whether wonderland works on an A3000 under ADFFS? If so I'll try this next.

sirbod
Posts: 819
Joined: Mon Apr 09, 2012 8:44 am
Location: Essex
Contact:

Re: Running Wonderland from a hard disk

Postby sirbod » Sun Apr 22, 2018 9:26 am

markdryan wrote:Thanks for your reply. I tried naively replacing the harcoded SCSIFS::4 and ADFS::4 strings in the win1 binary with IDEFS::4, taking care not to modify the size of the file. The game still crashes in the same way.

That's just the issues I could remember, I've now looked at my notes:

  • When run from HD it switches to RAM:$
  • Fails with "No system resource" when Obey$Dir isn't ADFS::<diskname>.$...
  • Fails with "Wonderland needs more file descriptors" when run from any FS other than ADFS or SCSIFS
  • Causes a Page Zero access issue when checking which HD it's being run on
  • Doesn't build up a stack frame before calling the os_byte routine when reporting an error and causes a Page Zero access related crash
  • malloc failure when run from HD

markdryan wrote:Do you know whether wonderland works on an A3000 under ADFFS? If so I'll try this next.

The boot script (!ADFFS.obey.F1038901) fixes one of the Page Zero access issues when run on an A3000, but won't currently get it running from HD, it will run from floppy image.

markdryan
Posts: 41
Joined: Sun Aug 20, 2017 10:37 pm
Contact:

Re: Running Wonderland from a hard disk

Postby markdryan » Sun Apr 22, 2018 7:22 pm

Wow, not something that can be fixed with a quick search and replace then.

I did manage to image my disks and get the game working on the A3000 using ADFFS. The only problem is I haven't figured out how to save my position. It will only let me select the floppy drive when saving, which is I guess is an ADF image and I don't seem to be able to write to this.

sirbod
Posts: 819
Joined: Mon Apr 09, 2012 8:44 am
Location: Essex
Contact:

Re: Running Wonderland from a hard disk

Postby sirbod » Mon Apr 23, 2018 10:37 am

markdryan wrote:not something that can be fixed with a quick search and replace then.

It needs all the ADFS / SCSFS code stripping out and make use of an environment variable instead. From memory that's not as straight forward as it sounds as there's a lot of disparate code associated with locating the files. I recall looking at it two years ago and thinking it's going to take some time to fix.
markdryan wrote:I did manage to image my disks and get the game working on the A3000 using ADFFS. The only problem is I haven't figured out how to save my position. It will only let me select the floppy drive when saving, which is I guess is an ADF image and I don't seem to be able to write to this.

I found a bug last week that prevents ADFFS from saving ADF images back to disc on RISC OS versions below 3.5. 2.65g is now available which fixes this, but you're probably better off waiting for me to fix the game.

When you save, you should get a Windows style save dialogue, clicking Drive toggles between adfs::0.$. and RAM:$., so create a small RAM drive and save to RAM, just remember to copy it when you quit. It's probably this code that's knackering running from HD as it must build a list of available drives.

sirbod
Posts: 819
Joined: Mon Apr 09, 2012 8:44 am
Location: Essex
Contact:

Re: Running Wonderland from a hard disk

Postby sirbod » Mon Apr 23, 2018 12:59 pm

I've found the code that needs changing, its the code that builds the save dialogue drive array that's causing the array bounding error. It's hardcoded to check for the following drives:
  • adfs::0 to number of floppy drives
  • adfs::4 to number of ADFS hard discs
  • RAM:$
  • SCSIFS::4
..and fails miserably if there's no floppies or ADFS hard discs.

You can botch it to load by changing the "SCSIFS::4." text @ 25C90 to "IDEFS::4." and change 25C00 to EA000019 to skip the ADFS hard drive detection.

This however highlights another issue as Save doesn't bring up the dialogue, reporting "Sorry, there was a problem with the save".

I'll rewrite the routine that creates the save dialogue drive array to instead scan all available filesystems and add any available drives, but not until I've figured out why the save dialogue doesn't appear, it may be related.

markdryan
Posts: 41
Joined: Sun Aug 20, 2017 10:37 pm
Contact:

Re: Running Wonderland from a hard disk

Postby markdryan » Mon Apr 23, 2018 3:10 pm

Thanks so much for all the info. I’ll try the RAM disk trick this evening. Needless to say, I’d be more than happy to help test a patch.

markdryan
Posts: 41
Joined: Sun Aug 20, 2017 10:37 pm
Contact:

Re: Running Wonderland from a hard disk

Postby markdryan » Mon Apr 23, 2018 10:01 pm

And the RAM disk trick works fine. The game plays really well under ADFFS. I just need to remember to copy the saved file from the RAM disk before turning off the computer. Thanks again.

Mark

sirbod
Posts: 819
Joined: Mon Apr 09, 2012 8:44 am
Location: Essex
Contact:

Re: Running Wonderland from a hard disk

Postby sirbod » Mon Apr 23, 2018 10:21 pm

To fix the Save/Load dialogue, change the word @ 28CB0 to 0 - it's another bug, the RamFS path becomes RAM:$.$ as the FS string at this address should really be "RAM::0."

EDIT: These are memory addresses incidentally, not offsets in the file.

markdryan
Posts: 41
Joined: Sun Aug 20, 2017 10:37 pm
Contact:

Re: Running Wonderland from a hard disk

Postby markdryan » Tue Apr 24, 2018 8:54 pm

I made the modifications to the win file and the game now starts up fine and is playable. But I'm unable to get the save dialog to open, even though I also made the modifications to 28CB0. Actually, I wasn't really sure what to change this to. I tried setting the entire 32bit word to 0. Then I tried setting it to 002E303A, i.e., ":0.\0" as this format matched the drive paths in the preceding code. Neither changes seemed to fix the load/save dialog.

sirbod
Posts: 819
Joined: Mon Apr 09, 2012 8:44 am
Location: Essex
Contact:

Re: Running Wonderland from a hard disk

Postby sirbod » Tue Apr 24, 2018 10:57 pm

Here's the script I'm working on, which scans for all available filing systems. There's one final issue to resolve, make sure you cycle through the drives on the Save dialogue before you save the first time, otherwise you won't be able to Save or Load again.

I've also noticed it prompts for manual based protection when you load, so I also need to remove that at some point.

Code: Select all

IF ADFFS$CPUID>&A10 THEN ADFRemapVideoMemory 13 160 ELSE ScreenSize 160
IF ADFFS$OSVersion>=&35000 THEN ADFEmulateRISCOS 3.11

SET Wonderland$Dir <obey$dir>
WimpSlot -min 672k -max 1600k
IF ADFFS$OSVersion>=&35000 THEN GOARM3JIT 0
ECHO <22><15>
ECHO <23><1><0><0><0><0><0><0><0><0>
SET Titlescrn "OFF"
ScreenLoad <Wonderland$Dir>.ALICE
ADFPause 200

LOAD <Wonderland$Dir>.WIN 8000
| Fix Page Zero access caused by lack of stack frame
MEMORYA 27F4C EF020006 { > null: }
MEMORYA 27F50 E91BA810 { > null: }

| Don't claim Event and Upcall Environment handlers
MEMORYA 59954 E1A00000 { > null: }
MEMORYA 5996C E1A00000 { > null: }

| Fix filing system scan
MEMORYA 25B38 E3A00012 { > null: }
MEMORYA 25B3C E28F1F47 { > null: }
MEMORYA 25B40 EF02001E { > null: }
MEMORYA 25B44 E1A06003 { > null: }
MEMORYA 25B48 E3A090FE { > null: }
MEMORYA 25B4C E3390025 { > null: }
MEMORYA 25B50 1339002E { > null: }
MEMORYA 25B54 13390035 { > null: }
MEMORYA 25B58 13390063 { > null: }
MEMORYA 25B5C 0A00002B { > null: }
MEMORYA 25B60 E3A00021 { > null: }
MEMORYA 25B64 E1A01009 { > null: }
MEMORYA 25B68 E28F20FC { > null: }
MEMORYA 25B6C E1A07002 { > null: }
MEMORYA 25B70 E3A03030 { > null: }
MEMORYA 25B74 EF020029 { > null: }
MEMORYA 25B78 E5D70000 { > null: }
MEMORYA 25B7C E3300000 { > null: }
MEMORYA 25B80 0A000022 { > null: }
MEMORYA 25B84 15F70001 { > null: }
MEMORYA 25B88 13300000 { > null: }
MEMORYA 25B8C 1AFFFFFC { > null: }
MEMORYA 25B90 E5C70005 { > null: }
MEMORYA 25B94 E3A0003A { > null: }
MEMORYA 25B98 E5C70000 { > null: }
MEMORYA 25B9C E5C70001 { > null: }
MEMORYA 25BA0 E3A00030 { > null: }
MEMORYA 25BA4 E5C70002 { > null: }
MEMORYA 25BA8 E3A0002E { > null: }
MEMORYA 25BAC E5C70003 { > null: }
MEMORYA 25BB0 E3A00024 { > null: }
MEMORYA 25BB4 E5C70004 { > null: }
MEMORYA 25BB8 E3A0000B { > null: }
MEMORYA 25BBC E28F10A8 { > null: }
MEMORYA 25BC0 EF020029 { > null: }
MEMORYA 25BC4 E3A00014 { > null: }
MEMORYA 25BC8 7F020029 { > null: }
MEMORYA 25BCC E1A08002 { > null: }
MEMORYA 25BD0 E3A00013 { > null: }
MEMORYA 25BD4 7F020029 { > null: }
MEMORYA 25BD8 E1310006 { > null: }
MEMORYA 25BDC 1A00000A { > null: }
MEMORYA 25BE0 EF060542 { > null: }
MEMORYA 25BE4 6A000009 { > null: }
MEMORYA 25BE8 E3310000 { > null: }
MEMORYA 25BEC 1B00000B { > null: }
MEMORYA 25BF0 E2511001 { > null: }
MEMORYA 25BF4 CAFFFFFB { > null: }
MEMORYA 25BF8 E3320000 { > null: }
MEMORYA 25BFC 1B000007 { > null: }
MEMORYA 25C00 E2522001 { > null: }
MEMORYA 25C04 CAFFFFFB { > null: }
MEMORYA 25C08 EA000000 { > null: }
MEMORYA 25C0C EB000003 { > null: }
MEMORYA 25C10 E2599001 { > null: }
MEMORYA 25C14 1AFFFFCC { > null: }
MEMORYA 25C18 E59D002C { > null: }
MEMORYA 25C1C E95BA8F0 { > null: }
MEMORYA 25C20 E92D403E { > null: }
MEMORYA 25C24 E3390008 { > null: }
MEMORYA 25C28 0A000005 { > null: }
MEMORYA 25C2C E3A00024 { > null: }
MEMORYA 25C30 E5C70004 { > null: }
MEMORYA 25C34 E3A00011 { > null: }
MEMORYA 25C38 E28F102C { > null: }
MEMORYA 25C3C EF020008 { > null: }
MEMORYA 25C40 E3300002 { > null: }
MEMORYA 25C44 028F1020 { > null: }
MEMORYA 25C48 028D0040 { > null: }
MEMORYA 25C4C 03A02000 { > null: }
MEMORYA 25C50 05C72004 { > null: }
MEMORYA 25C54 0BFFFF8E { > null: }
MEMORYA 25C58 E8BD803E { > null: }
MEMORYA 25C5C 0005B330 { > null: }
MEMORYA 25C60 656C6946 { > null: }
MEMORYA 25C64 65726F43 { > null: }
MEMORYA 25C68 00000000 { > null: }

| Remove second filing system scan
MEMORYA 28B48 EA000044 { > null: }

| Bug fix: Null pointer
IF ADFFS$OSVersion>=&35000 THEN MEMORYA 4EF70 EA052422 { > null: }
IF ADFFS$OSVersion>=&35000 THEN MEMORYA 198000 E3300000 { > null: }
IF ADFFS$OSVersion>=&35000 THEN MEMORYA 198004 01A0F00E { > null: }
IF ADFFS$OSVersion>=&35000 THEN MEMORYA 198008 E92D4010 { > null: }
IF ADFFS$OSVersion>=&35000 THEN MEMORYA 19800C EAFADBD8 { > null: }

GO 8000
IF ADFFS$OSVersion>=&35000 THEN GOARM3JIT
IF ADFFS$CPUID>&A10 THEN ADFRemapVideoMemory
IF ADFFS$OSVersion>=&35000 THEN ADFEmulateRISCOS
UnSet Wonderland$Dir

sirbod
Posts: 819
Joined: Mon Apr 09, 2012 8:44 am
Location: Essex
Contact:

Re: Running Wonderland from a hard disk

Postby sirbod » Wed Apr 25, 2018 3:53 pm

sirbod wrote:There's one final issue to resolve, make sure you cycle through the drives on the Save dialogue before you save the first time, otherwise you won't be able to Save or Load again.

The problem is the lack of a "$" at the end of the initial path, but the fix currently eludes me despite a day of debugging. If I add the $ to the end of the path, it fails to display the Save/Load dialogue :roll:

Another temporary fix is to have a floppy image mounted, as it seems to be going to ADFS::0 - if it finds a floppy the initial path is ADFS::0.$ and Save/Load works as expected #-o

markdryan
Posts: 41
Joined: Sun Aug 20, 2017 10:37 pm
Contact:

Re: Running Wonderland from a hard disk

Postby markdryan » Thu Apr 26, 2018 9:48 pm

Here's the script I'm working on, which scans for all available filing systems.


I did try to apply the patch locally to my win binary but I couldn't get it to work. When starting Wonderland I now see an error "No System Resources". I guess I've just updated the file incorrectly or perhaps I've misinterpreted the patch.

Does the statment

MEMORYA 27F4C EF020006 { > null: }

mean store the value EF020006 at the memory location (not file offset) starting at 27F4C? What does the { > null } signify.

I also skipped any changes enclosed in if statements such as

IF ADFFS$OSVersion>=&35000

I assumed these wouldn't be needed on RISC OS 3.11. Is that correct?

I'm still using the original basic program Wonder1 to launch wonderland.

sirbod
Posts: 819
Joined: Mon Apr 09, 2012 8:44 am
Location: Essex
Contact:

Re: Running Wonderland from a hard disk

Postby sirbod » Fri Apr 27, 2018 8:20 am

markdryan wrote:When starting Wonderland I now see an error "No System Resources".

That error means it can't find "rdf.boot"
markdryan wrote:Does the statment

MEMORYA 27F4C EF020006 { > null: }

mean store the value EF020006 at the memory location (not file offset) starting at 27F4C? What does the { > null } signify.

The file is already at that point and it's altering that memory location.
markdryan wrote:I also skipped any changes enclosed in if statements such as

IF ADFFS$OSVersion>=&35000

I assumed these wouldn't be needed on RISC OS 3.11. Is that correct?

Correct, they're not needed.
markdryan wrote:I'm still using the original basic program Wonder1 to launch wonderland.

Don't run Wonder1, it will reload Win. To test the script, just replace !wonderla.!Run with it and run as normal. You'll need ADFFS loaded as its reliant on ADFFS.

sirbod
Posts: 819
Joined: Mon Apr 09, 2012 8:44 am
Location: Essex
Contact:

Re: Running Wonderland from a hard disk

Postby sirbod » Fri Apr 27, 2018 5:47 pm

Add the following just before the GO 8000 line to remove the manual based protection:

Code: Select all

MEMORYA B 3AAD3 E5 { > null: }

It doesn't strictly remove the protection check as I've not found it yet. It makes it think the Save failed to load so reports an error to that effect instead of triggering the protection check.