English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 01 August 2008, 12:35   #1
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Weird problem

As some of you know I am writing a WHD slave for Croak!

I have come to a particularly strange problem.

I have managed to get my slave to recognise and support both the original af35 powerpacked version, and also unpacked version!

The patches I have done so far work flawlessly on the uncompressed version (Inf lives and vblank timing) but for the packed version I have the strangest error with the vblank timing!

The game waits 200 frames before the vblank actually kicks in. I have tested and the patch is in the right place and anything I put outside my vblank loop is executed fine, but the loop itself isn't run for the first 200 frames, despite me having it set to run every 2nd frame!

Any ideas?

my loop code is:

Code:
_waitvb
        movem.l    a0/a1,-(a7)
        lea    delay(pc),a0
        lea    count(pc),a1
        addq.l #1,(a1)
        subq.w    #1,(a0)
        bne.b    .skip

        move.w    #$2,(a0)
        waitvb
        blitz
        clr.l (a1)
.skip        movem.l    (a7)+,a0/a1
    
        cmp.l    #7,d0            ; code we removed
        rts                ; return to game
BippyM is offline  
Old 01 August 2008, 12:42   #2
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
what are you doing with "count"? Can't see it used anywhere except for the addq.l #1,(a1)/clr.l (a1).
Edit: I guess I know what you're using count for.

As for the rest, I don't think it is possible to find the problem without looking at the game code as the code for the delay is correct.
StingRay is offline  
Old 01 August 2008, 13:11   #3
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 828
Hi

Quote:
I have managed to get my slave to recognise and support both the original af35 powerpacked version, and also unpacked version!
I think that better is unpack powerpacked version in install script ( xfddecrunch ). Furthermore user can pack a file with packer which is supported by WHDLoad ( xpk or other ). Don't forget to load a file in proper way ( function resload_LoadFileDecrunch ).

Regards
Asman is offline  
Old 01 August 2008, 13:19   #4
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by Asman View Post

I think that better is unpack powerpacked version in install script ( xfddecrunch ). Furthermore user can pack a file with packer which is supported by WHDLoad ( xpk or other ). Don't forget to load a file in proper way ( function resload_LoadFileDecrunch ).

The file is an executable file which is loaded using LoadSeg(), slave uses Kick1.3 emu. resload_LoadFileDecrunch can't be used here.

Last edited by StingRay; 01 August 2008 at 13:32. Reason: typo
StingRay is offline  
Old 01 August 2008, 13:28   #5
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 828
Hi,

Quote:
The file is an executable file which is loaded using LoadSeg(), slave uses Kick1.3 emu. resload_LoadFileDecrunch can't be used here.
Upss, I didn't know that. So LoadFiledecrunch + Relocate can be used in that case . Furthermore Kick1.3 emu may be kicked out ( if kick1.3 is used only with LoadSeg ).

Regards

Last edited by Asman; 01 August 2008 at 13:47.
Asman is offline  
Old 01 August 2008, 18:45   #6
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by Asman View Post
Hi,



Upss, I didn't know that. So LoadFiledecrunch + Relocate can be used in that case . Furthermore Kick1.3 emu may be kicked out ( if kick1.3 is used only with LoadSeg ).
LoadFileDecrunch + Relocate would work but using LoadSeg is much simpler here (and makes more sense anyway). Also, the kick1.3 emu is necessary as the game is using a lot of system functions.
StingRay is offline  
Old 01 August 2008, 21:57   #7
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
the count is used simply to count up.. I used that to determine the 200 frames before it actually started executing the vblank!

I waited until blitz was called (freeze system) and then I checked the location held in count!
BippyM is offline  
Old 01 August 2008, 22:44   #8
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
I have now checked the offsets of the crunched file in comparison to the uncrunched file and it's err.. identical, 100% identical.. so why is it doing this?
BippyM is offline  
Old 02 August 2008, 01:40   #9
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Initial value of delay getting messed up most likely. A pointer stepping outside its supposed bounds and writing delay by mistake perhaps? Are you using the correct word size for reserving space and setting the delay value initially? Check the outside code, f.ex what does the code look like from where you jump into _waitvb? There's nothing wrong in the _waitvb routine itself.
Leffmann is offline  
Old 02 August 2008, 04:15   #10
StrategyGamer
Total Chaos AGA is fun!
 
Join Date: Jun 2005
Location: USA
Posts: 873
Powerpacker is trashing some memory. I have seen it trash ram before. That is why I generally avoid powerpacker.
StrategyGamer is offline  
Old 02 August 2008, 12:42   #11
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 828
Quote:
Originally Posted by StingRay View Post
LoadFileDecrunch + Relocate would work but using LoadSeg is much simpler here (and makes more sense anyway). Also, the kick1.3 emu is necessary as the game is using a lot of system functions.
You're right LoadSeg is much simpler. In my opinion LoadFileDecrunch + Relocate makes sense, because:

- I can relocate hunks into FAST memory ( speed up )
- I can pack files ( safe disk space )

Of course LoadFileDecrunch + Relocate costs work a bit ( sometimes a lot ).

Regards
Asman is offline  
Old 02 August 2008, 14:57   #12
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
I am not using powerpacker myself. It is compressed with it on the coverdisk, and I just wanted to add direct support for the coverdisk version!

I am more than happy to decrunch it during install and using it uncompressed (it's only 151kb).

The game passes the load address to a5 and then copies itself to $f2 where it does a jmp address..

I simply break into the uncompress routine and change the jsr to an rts and copy the load address to my location instead of the game.

After that powerpacker is finished and I can work on patching the game itself. So in theory powerpacker cannot trash memory, esp whd memory as it is confined to the area I gave it to work with and the slave is naturally outside of this area, and the game has not been patched!
BippyM is offline  
Old 03 August 2008, 14:21   #13
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Leffman you are correct. I was doing the following

Code:
		move.b	#$75,(-1,a5)		; Make the game RTS back to slave
		lea	_fileaddress(pc),a5	; Change location game will put jsr address

		move.l	a0,d0			; Following 3 lines are code we overwrote
		lsr.l	#2,d0
		move.l	d0,(a4)
Powerpacker executes the same code in a loop, so after I moved my address into a5 it patched -1,a5 so overwrote my counter

I put that inside a routine to test if it had been run once, and now it works fine

Thanks guys for all your help.. next highscore patching
BippyM is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird Directory Problem? Unregistered support.WinUAE 5 18 June 2021 16:02
Weird problem tesla support.Other 2 28 March 2013 01:57
Very weird problem alkis21 project.WHDLoad 13 28 September 2010 20:49
Weird CF problem (maybe...) squidbass support.Other 10 01 March 2009 14:45
Weird AIAB problem mousenator New to Emulation or Amiga scene 0 12 May 2008 23:48

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:30.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.22614 seconds with 13 queries