avatar_Maniac

Help with Amstrad Plus keyboard incompatibility with some CPC games

Started by Maniac, 09:58, 08 May 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Maniac

A while ago I found a great article on how to fix keyboard routines for CPC games that didn't work with the Plus range due to the PPI implementation. I'm sure I didn't imagine it but stupidly I didn't bookmark it and now am unable to find it again. Does anyone know of such an article please or if not how you might go about fixing the issue?


I know some games have already been patched but I can't find a patched copy of Split Personalities that I could then play on my 6128 plus.


Any help greatly appreciated.

dragon


GUNHED

http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)


Phantomz

@Maniac


Did you manage to make a plus compatible version of " Split Personalities " with the info from that article?


I wouldn't mind a plus compatible version, maybe we could play it on the GX4000 too then.  ;)

Maniac

Quote from: Phantomz on 20:04, 10 May 20
@Maniac


Did you manage to make a plus compatible version of " Split Personalities " with the info from that article?


I wouldn't mind a plus compatible version, maybe we could play it on the GX4000 too then.  ;)
Not had a chance to look yet as been decorating my daughters room the last few days. Hope to do so in the next couple of weeks.

Maniac

I finally had a chance to take a look at patching Split Personalities so that the keyboard worked on the Plus range. I'm not great with keyboard or sound routines that hit the hardware direct so I did my research and found what I needed to do. Using a cracked copy of the game by Duck from CPC Power (https://www.cpc-power.com/index.php?page=detail&onglet=dumps&num=2035) and WinApe I found the keyboard routine at &3b9b. The patched code needed 2 additional bytes of memory so the patched code needed to be located elsewhere as there was no space to add anything extra. After a couple of tests I put the patched code at &3f00 and patched the jumps to the routine in the main game code.


So far so good. All looked good in WinApe where the patched routine worked and the music etc sounded good. However when I transferred the patched code to my 6128 Plus although the keyboard routine worked and allowed me to play the game the music sounds corrupted/distorted. If you start the original version of the game minus patch the music plays fine but you can't play the game!


I'm now a bit stuck and wondered if any of you good folk on here would be kind enough to help me out please?


My patched code looks as follows:

ld bc,#f40e - 01 0E F4
out (c),c - ED 49
ld bc,#f6c0 - 01 C0 F6
out (c),c - ED 49
out (c),0 - ED 71 - Extra 2 bytes of code added for Plus compat.
ld c,#92 - 0E 92
inc b - 04
out (c),c - ED 49
dec b - 05
ld c,#49 - 0E 49
ld d,#0a - 16 0A
ld hl,#000e - 21 0E 00
out (c),c - ED 49 - Keyboard code loops to here if no keypress
ld a,#f4 - 3E F4
in a,(#00) - DB 00
xor #ff - EE FF
ld (hl),a - 77
inc hl - 23
dec c - 0D
dec d - 15
jp nz,&3f19 - C2 19 3f
ld c,#80 - 0E 80
out (c),c - ED 49
ld c,#82 - 0E 82
inc b - 04
out (c),c - ED 49
jp #3e50 - C3 50 3E



I've attached my patched version to this post if anyone would be happy to take a look.

dragon

Winape is so much tolerant. Try the game in arnoldemu. I'm sure probably you then  find the same issue in the emulator and you can tracert here the issue.


If the game sound o.k in the cracked version without your patch. But not with you patch.






Then the problem is your patch. If not the problem is the crack.


Probably you put the code in a zone that you think the game not use it..but probably they use it for something.


Another posibility was if the cracked version  use some type of compression and you alters it directly with hex heditor. You can probably altered the rest of the game in unknown ways...


Or maybe you have cause some type of corruption in timmings or something with the bus..

Maniac

Thanks Dragon.


The cracked version is ok and no compression is used. Various buffers and other bits move around when you first start to play the game but my patched routine avoids these areas after much testing and experimentation. The most likely cause is the necessary writing of 0 to the PPI port required for Plus compatibility. Trouble is I don't know how to compensate for it.


I will run my version in Arnold and see if it does the same. I suspect WinApes emulation of the Plus PPI implementation is not 100% accurate.

dragon

Maybe he can call some interruption to music when is  read the keyboard?


Yeah, winape not is very reliable in the ppi, or the cpr format compared with the original machine.

dragon

Maybe he can call some interruption to music when is  read the keyboard?


Yeah, winape not is very reliable in the ppi, or the cpr format compared with the original machine.


Ask urusergi. He Is a expert patching the plus games keyboard.

Urusergi

@Maniac please, try this code:

ORG &3B9B
        LD BC,&F40E
        OUT (C),C
        LD BC,&F6C0
        OUT (C),C
        LD HL,&000E
        OUT (C),H
        LD C,&92
        INC B
        OUT (C),C
        DEC B
        LD C,&49
        LD D,&0A

L3BB2:  OUT (C),C
        LD A,&F4
        IN A,(&00)
        CPL
        LD (HL),A
        INC L
        DEC C
        DEC D
        JR NZ,L3BB2
        LD C,&80
        OUT (C),C
        LD C,&82
        INC B
        OUT (C),C


P.D.: There's no need to relocate this code, it has the same bytes as the original since it is more optimized (JP > JR, XOR &FF > CPL)

Maniac

@Urusergi thank you so much for your help - it really is very much appreciated.


Unfortunately on my hardware at least I get the same result when the game is patched. The music sounds corrupted/distorted.  :picard:


When I tested both my original patch and the one that @Urusergi kindly provided over the original code in Arnold and WinApe everything works as it should do. I even went as far as loading the original code in to Arnold to make sure it didn't work with the keyboard i.e. the PPI emulation is accurate. Which I confirmed. Patch the code and all works.


I think something else is at play here. Either my 6128 Plus has a fault (although nothing else has this issue) or the game is doing something odd on real hardware. Just to be certain I removed all my extra hardware and loaded the game from my HxC but got the same result.


So to try and help work this out I've put together a DSK image that has the original, my original patch and the optimised patch where the keyboard code has been overwritten by that provided by @Urusergi  for others to try on their hardware. I've run this on mine and can confirm that the results are as I originally said; original game code - music sounds good but no keyboard function; patched (either version) music sounds corrupt but keyboard input works. The disk has a menu so you can select the version you want to run (enter the number and press Enter).


Once again thank you for all of your help everyone.

Phantomz

@Maniac


Sorry I can't test your disc in real hardware at the moment as have no access to it, hopefully some people on here will test it out for you.


I know it might seem like a long shot, but have you tried a different crack of the game, worth a try!


I think I've applied @Urusergi patch to a different version of the game, might be worth a go, no harm in trying.


The disc and cpr are below to try.


If it all works ok, I'll get the pause and quit option mapped so it GX4000 compatible.  :D

Urusergi

Then the fault may be in the sound routine
ORG &3D8C
    LD BC,&F4C0
    OUT (C),E
    LD B,&F6
    OUT (C),C
    LD C,&80
    OUT (C),C
    LD BC,&F440
    OUT (C),D
    LD B,&F6
    OUT (C),C
    RET


I'll take a look at the weekend.

dragon

But the more interesting question, if is a software issue, then that means that here are some limitation on the plus not discovered and emulated. Even in arnoldemu

Maniac

Quote from: Phantomz on 14:16, 27 May 20
@Maniac


Sorry I can't test your disc in real hardware at the moment as have no access to it, hopefully some people on here will test it out for you.


I know it might seem like a long shot, but have you tried a different crack of the game, worth a try!


I think I've applied @Urusergi patch to a different version of the game, might be worth a go, no harm in trying.


The disc and cpr are below to try.


If it all works ok, I'll get the pause and quit option mapped so it GX4000 compatible.  :D
Thanks for everyones help with this. Unfortunately the same issue occurs with the sound being distorted/corrupted. As @Urusergi says the fault may be in the sound routine. You have to wonder with all the software out there though why this particular game is an issue and none others that the community is aware of are.

Urusergi

Try this, it's quite possible that it will work:

ORG &3D8C
    LD BC,&F4C0
    OUT (C),E
    LD B,&F6
    OUT (C),C
    db &ED,&71
    LD BC,&F480
    OUT (C),D
    LD B,&F6
    OUT (C),C
    db &ED,&71
    RET


P.D: and this:
ORG &3BC1
LD C,&00


using my keyboard routine

Maniac

Quote from: Urusergi on 23:43, 27 May 20
Try this, it's quite possible that it will work:

ORG &3D8C
    LD BC,&F4C0
    OUT (C),E
    LD B,&F6
    OUT (C),C
    db &ED,&71
    LD BC,&F480
    OUT (C),D
    LD B,&F6
    OUT (C),C
    db &ED,&71
    RET


P.D: and this:
ORG &3BC1
LD C,&00


using my keyboard routine


@urusergi that did the trick! You super star! Game now works on the Plus with the sound/music sounding as it did before being patched. What was the problem please?


Thank you so much for all of your help with this! It is very much appreciated.


Attached to this post is the final version fully patched, based on the crack by Duck, of the DSK image that can be used as the basis of a CRT image if wanted so that this is also playable on a GX4000 via the C4CPC.

Urusergi

You're welcome  :)

Looks like a dirty trick by the original programmer. I still don't understand how it could have worked.
All I've done is put the standard sound routine in place of that routine.

Phantomz

@Maniac and @Urusergi


Nice work guys, well done!  8)


I'm trying to change the Spanish retail version to work too (from cpc-power), not sure how to use all this assembly code, but think I've got it fixed.


Could you guys test that I've changed it all ok and that it works without the sound problem, cheers  ;D




Maniac

Quote from: Phantomz on 14:52, 29 May 20
@Maniac and @Urusergi


Nice work guys, well done!  8)


I'm trying to change the Spanish retail version to work too (from cpc-power), not sure how to use all this assembly code, but think I've got it fixed.


Could you guys test that I've changed it all ok and that it works without the sound problem, cheers  ;D
Just tried it out and all worked just fine. Can't see any differences in the game apart from the way in which it loads the game. Funny that the DISC.BAS file is actually a binary file!


I am aware that there were some slight variations in certain countries but it doesn't look like that's the case with the Spanish release.

Phantomz


Quote from: Maniac on 23:41, 29 May 20Just tried it out and all worked just fine. Can't see any differences in the game apart from the way in which it loads the game. Funny that the DISC.BAS file is actually a binary file!I am aware that there were some slight variations in certain countries but it doesn't look like that's the case with the Spanish release.



@Maniac


Thanks for checking the disk out for me.  :)


Do you know if this game has a high score table, I'm looking at changing the controls to make it GX4000 friendly.


Maniac

@Phantomz I can't recall seeing a high score table no. But I could be wrong. Seems my skills over the years have got rusty and I'm not so good at the game at the mo!

Phantomz


Quote from: Maniac on 23:28, 30 May 20@Phantomz I can't recall seeing a high score table no. But I could be wrong. Seems my skills over the years have got rusty and I'm not so good at the game at the mo!



@Maniac


No problem, think I'm in the same position as you regarding my skills playing the game.  :laugh: :doh:

Powered by SMFPacks Menu Editor Mod