ADFFS 2.40

Discuss ADFFS development and download test releases
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: ADFFS 2.40

Post by JonAbbott »

JonAbbott wrote:BlowPipe is the closest to working, the only problem is a piece of code that tries to write to page zero.
This problem only occurs on RO5, either IOMD or ARM11. The sequence of events leading up the issue are:

1. RISCOS calls the EventV handler in BlowPipe on VSync (Event 4)
2. Within the EventV handler, the follow sequence of JIT code executes and randomly fails:

Code: Select all

LDR R1,&11fd464
LDR PC,&11fd43c (which jumps to the instruction below)
STMFD R13!,{R0-R3,R14}
R1 is correct at the point it's loaded in the 1st instruction. By the time the CPU has reached the 3rd instruction R1 has changed to &200. Another IRQ must be triggering which is corrupting R1. I've ruled out ADFFS and the game as the culprit, which leaves RISCOS, QTM, MusMod2. My suspicion is RISCOS, as if the issue were with QTM or MusMod2 I'd expect to see it occurring on all platforms.
JonAbbott wrote:I also need to figure out how to improve disc swapping on Xenon 2 and BlowPipe. Both sit in a loop waiting for an IRQ event to notice the disc has changed, for some reason that causes problems on the Pi, as if the keyboard doesn't trigger a hardware IRQ.
This issue is Pi specific, not RO5 specific. RO5 on IOMD doesn't suffer this issue.
Vanfanel
Posts: 576
Joined: Mon Sep 16, 2013 12:01 am

Re: ADFFS 2.40

Post by Vanfanel »

With the latest ADFFS500 and obey, Freddy's Folly works.
And Cannon Fodder shows intro! War.. never been so much fun! :P
Music in the intro has gaps: it sounds well, but samples seem to be out of sync.
Sadly, CF hangs just after the intro :(
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: ADFFS 2.40

Post by JonAbbott »

Vanfanel wrote:With the latest ADFFS500 and obey, Freddy's Folly works.
Good news.
Vanfanel wrote:And Cannon Fodder shows intro! War.. never been so much fun! :P
Music in the intro has gaps: it sounds well, but samples seem to be out of sync.
It's because the inbuilt tracker doesn't take account of the buffer size the system provides. It will need tweeking to fix, which I'll look into at some point. It seems to only affect the loading titles, the in-game music and music at the prompt for disc 2 are okay. I'm not totally sure why that is.

I've spent the best part of a week trying to get Cannon Fodder to work. It's currently causing ADFFS to crash at the prompt for disc 2, which I'm looking into.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: ADFFS 2.40

Post by JonAbbott »

I've made quite a lot of changes, including several instructions encodings and the way IRQ's are entered/exited. Just need to do a final check that everything is still working, then I'll release it before I start work on IOMD 32bit.

It's on the dev site if you want to test, along with an updated obey.zip
Vanfanel
Posts: 576
Joined: Mon Sep 16, 2013 12:01 am

Re: ADFFS 2.40

Post by Vanfanel »

I've tested all the compatible games: no regressions detected :)
With this version, there are many games that are "almost there":

-Heimdall doesn't crash anymore on map sequence! You can move between the islands freely now! But it won't detect second disk when I change it. The hourglass appears, but it keeps asking again and again for disk2.

-Lemmings shows Psygnosis and DMA logos, then crashes. Aaaaagh! I need a Lemmings fix on the Pi! :lol:

-Cannon Fodder still crashes on disk2 prompt, at least here.

-GODS shows intro (with distorted audio, I suspect audio buffer size problems or maybe frequency problems with this one). Then it hangs gracefully a

Other games I've tested that don't "work" at all:

-Cobalt Seed: hangs the whole system when clicked...
Last edited by Vanfanel on Tue Mar 18, 2014 7:52 pm, edited 1 time in total.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: ADFFS 2.40

Post by JonAbbott »

Vanfanel wrote:I've tested all the compatible games: no regressions detected :)
Excellent, I'll release it shortly then.
Vanfanel wrote:-Heimdall doesn't crash anymore on map sequence! You can move between the islands freely now! But it won't detect second disk when I change it. The hourglass appears, but it keeps asking again and again for disk2.
The disks are labeled disc0 to 4, so insert disk 3 for the 2nd disk.
Vanfanel wrote:GODS shows intro (with distorted audio, I suspect audio buffer size problems
I'll need to check, but I think GODS uses a tracker we've already converted, so I'll test it later. It was crashing at the prompt for disc 2 when I tested a few days ago.

EDIT: GODS has an internal tracker, so will need patching at some point.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: ADFFS 2.40

Post by JonAbbott »

JonAbbott wrote:
JonAbbott wrote:BlowPipe is the closest to working, the only problem is a piece of code that tries to write to page zero.
This problem only occurs on RO5, either IOMD or ARM11. The sequence of events leading up the issue are:

1. RISCOS calls the EventV handler in BlowPipe on VSync (Event 4)
2. Within the EventV handler, the follow sequence of JIT code executes and randomly fails:

Code: Select all

LDR R1,&11fd464
LDR PC,&11fd43c (which jumps to the instruction below)
STMFD R13!,{R0-R3,R14}
R1 is correct at the point it's loaded in the 1st instruction. By the time the CPU has reached the 3rd instruction R1 has changed to &200. Another IRQ must be triggering which is corrupting R1.
I've may have tracked down the issue here and the sequence is slightly different to the above:
  1. The game calls &1E030 (key check subroutine) which runs through to the exiting codelet - LDMFD R13!,{R0-R3,PC}
  2. Part way though the codelet, after its stored the working register (R0) and new PC, EventV is triggered
  3. The EventV code calls &1E030 which completes, overwriting the working register and PC values with IRQ versions
  4. The CPU resumes execution of the LDMFD R13!,{R0-R3,PC} codelet in User mode, which then exits with the working register and PC set to the values from the IRQ call
This may explain why various games crash at prompts, if they're re-entering the same code from both IRQ and User CPU modes.


How to fix it is another issue:
  1. Disable IRQ/FIQ during a codelet. This unfortunately is impossible as those bits are locked when in User mode.
  2. Stack the working register and PC, instead of storing them in the codelet. This is fraught with danger in non-LDM/STM instructions as R13 can't be relied upon as being a stack. For LDM/STM you could use Rn to stack the values and fixup Rn on exit.
  3. Fixup the IRQ code in the game so its self-contained. Possibly the simplest option, although means a lot more work on individual games.
  4. Instead of branching to codelets, trigger them via an Abort. Pretty much a non-starter as SWI would corrupt R14 and Co-pro instructions only have space for 32,000 codelets...not to mention the performance impact.
I'll have to give it some thought and see if I can come up with any other solutions.
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: ADFFS 2.40

Post by JonAbbott »

JonAbbott wrote:Fixup the IRQ code in the game so its self-contained
I've done this for BlowPipe and sure enough it now works, the updated Obey.zip is on the dev site.
Vanfanel
Posts: 576
Joined: Mon Sep 16, 2013 12:01 am

Re: ADFFS 2.40

Post by Vanfanel »

I've tried BlowPipe in 2.40b with the updated Obey.zip, but the game hangs when prompting for disk2 (as soon as it's launched)
JonAbbott
Posts: 2938
Joined: Thu Apr 11, 2013 12:13 pm
Location: Essex
Contact:

Re: ADFFS 2.40

Post by JonAbbott »

Vanfanel wrote:I've tried BlowPipe in 2.40b with the updated Obey.zip, but the game hangs when prompting for disk2 (as soon as it's launched)
Hold CTRL-SHIFT and keep hitting F2 until you see the hourglass. It's listed in the known issues.
Post Reply