Couple of asm questions

Discussion in 'Discussion and Q&A Archive' started by Alriightyman, Nov 13, 2007.

Thread Status:
Not open for further replies.
  1. Alriightyman

    Alriightyman I'm back! Member

    Joined:
    Oct 3, 2007
    Messages:
    156
    Location:
    USA
    i ported the walk/run animation code from sonic 2 to sonic 1 so sonic will show 8 walking frames instead of 6. Then i changed the mappings the animation script the plc's and added some of sonic 1's code back and got it to work but there's a strange glitch when sonic's walking, it'll show a bunch of garbage and /or a rolling frame and then go back to normal. here's a couple of pics:


    [​IMG][​IMG]


    And here's my code:



    Code:
    SAnim_WalkRun:		&#59; XREF: SAnim_Do
    
    		
    
    		addq.b	#1,d0	
    
    		bne.w	SAnim_Roll	
    
    		moveq	#0,d0		
    
    		move.b	$27(a0),d0
    
    		bne.w	SAnim_Tumble	
    
    		moveq	#0,d1
    
    		move.b	$26(a0),d0	
    
    		bmi.s	loc_1B410
    
    		beq.s	loc_1B410
    
    		subq.b	#1,d0
    
    		
    
    loc_1B410:
    
    		move.b	$22(a0),d2
    
    		andi.b	#1,d2		?
    
    		bne.s	loc_13A70	
    
    		not.b	d0		
    
    
    
    loc_13A70:
    
    		addi.b	#$10,d0		
    
    		bpl.s	loc_13A78	
    
    		moveq	#3,d1
    
    
    
    loc_13A78:
    
    		andi.b	#$FC,1(a0)
    
    		eor.b	d1,d2
    
    		or.b	d2,1(a0)
    
    		btst	#5,$22(a0)
    
    		bne.w	SAnim_Push
    
    		lsr.b	#4,d0		
    
    		andi.b	#6,d0		
    
    		move.w	$14(a0),d2	
    
    		bpl.s	loc_13A9C
    
    		neg.w	d2
    
    
    
    loc_13A9C:
    
    		lea	(SonAni_Run).l,a1 
    
    		cmpi.w	#$600,d2	
    
    		bcc.s	loc_13AB4	
    
    		lea	(SonAni_Walk).l,a1 
    
    		add.b	d0,d0
    
    		
    
    
    
    loc_13AB4:
    
    		add.b	d0,d0
    
    		move.b	d0,d3
    
    		moveq	#0,d1
    
    		move.b	$1B(a0),d1
    
    		move.b	1(a1,d1.w),d0
    
    		cmpi.b	#-1,d0
    
    		bne.s	loc_1B48A
    
    		move.b	#0,$1B(a0)
    
    		move.b	1(a1),d0
    
    		
    
    loc_1B48A:		&#59; CODE XREF: h+450Aj
    
    		move.b	d0,$1A(a0)
    
    		add.b	d3,$1A(a0)
    
    		subq.b	#1,$1E(a0)
    
    		bpl.s	locret_1B4AC
    
    		neg.w	d2
    
    		addi.w	#$800,d2
    
    		bpl.s	loc_13AC2
    
    		moveq	#0,d2
    
    
    
    loc_13AC2:
    
    		lsr.w	#8,d2
    
    		move.b	d2,$1E(a0)	
    
    		addq.b	#1,$1B(a0)	
    
    locret_1B4AC:	
    
    		rts	
    
    ; ===========================================================================
    
    SAnim_Tumble:		&#59; CODE XREF: h+448Cj
    
    		move.b	$27(a0),d0
    
    		moveq	#0,d1
    
    		move.b	$22(a0),d2
    
    		andi.b	#1,d2
    
    		bne.s	SAnim_Tumble_Left
    
    
    
    		andi.b	#$FC,1(a0)
    
    		addi.b	#$B,d0
    
    		divu.w	#$16,d0
    
    		addi.b	#$5F,d0; '_'
    
    		move.b	d0,$1A(a0)
    
    		move.b	#0,$1E(a0)
    
    		rts	
    
    ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    
    ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    
    
    
    SAnim_Tumble_Left:		&#59; CODE XREF: h+45BAj
    
    		andi.b	#$FC,1(a0)
    
    		tst.b	$29(a0)
    
    		beq.s	loc_1B566
    
    		ori.b	#1,1(a0)
    
    		addi.b	#$B,d0
    
    		bra.s	loc_1B572
    
    ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    
    ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
    
    
    
    loc_1B566:		&#59; CODE XREF: h+45E4j
    
    		ori.b	#3,1(a0)
    
    		neg.b	d0
    
    		addi.b	#$8F,d0
    
    
    
    loc_1B572:		&#59; CODE XREF: h+45F0j
    
    		divu.w	#$16,d0
    
    		addi.b	#$5F,d0; '_'
    
    		move.b	d0,$1A(a0)
    
    		move.b	#0,$1E(a0)
    
    		rts	
    
    SAnim_Roll:		&#59; XREF: SAnim_WalkRun
    
    		subq.b	#1,$1E(a0)		
    
    		bpl.w	SAnim_Delay	
    
    		addq.b	#1,d0
    
    		bne.s	SAnim_Push
    
    		move.w	$14(a0),d2	
    
    		bpl.s	loc_13ADE
    
    		neg.w	d2
    
    
    
    loc_13ADE:
    
    		lea	(SonAni_Roll2).l,a1 
    
    		cmpi.w	#$600,d2	
    
    		bcc.s	loc_13AF0	
    
    		lea	(SonAni_Roll).l,a1 
    
    
    
    loc_13AF0:
    
    		neg.w	d2
    
    		addi.w	#$400,d2
    
    		bpl.s	loc_13AFA
    
    		moveq	#0,d2
    
    
    
    loc_13AFA:
    
    		lsr.w	#8,d2
    
    		move.b	d2,$1E(a0)	
    
    		move.b	$22(a0),d1
    
    		andi.b	#1,d1
    
    		andi.b	#$FC,1(a0)
    
    		or.b	d1,1(a0)
    
    		bra.w	SAnim_Do2
    
    		
    
    SAnim_Push:		&#59; XREF: SAnim_RollJump
    
    		move.w	$14(a0),d2	
    
    		bmi.s	loc_13B1E
    
    		neg.w	d2
    
    
    
    loc_13B1E:
    
    		addi.w	#$800,d2
    
    		bpl.s	loc_13B26
    
    		moveq	#0,d2
    
    
    
    loc_13B26:
    
    		lsr.w	#6,d2
    
    		move.b	d2,$1E(a0)	
    
    		lea	(SonAni_Push).l,a1
    
    		move.b	$22(a0),d1
    
    		andi.b	#1,d1
    
    		andi.b	#$FC,1(a0)
    
    		or.b	d1,1(a0)
    
    		bra.w	SAnim_Do2
    
    ; End of function Sonic_Animate
    If i need to upload my hack let me know.


    Thanks
     
    Last edited by a moderator: Nov 13, 2007
  2. rika_chou

    rika_chou Adopt Member

    Joined:
    Aug 11, 2007
    Messages:
    689
    Just going by the looks of that screenshot, I would say it's trying to use a mappings frame that doesnt exist. Problem might be in the animation script.
     
    Last edited by a moderator: Nov 13, 2007
  3. puto

    puto Well-Known Member Member

    Joined:
    Aug 11, 2007
    Messages:
    52
    Did you port the art and dynamic PLCs?
     
  4. Alriightyman

    Alriightyman I'm back! Member

    Joined:
    Oct 3, 2007
    Messages:
    156
    Location:
    USA
    Yeah I'm using Sonmaped for the sprites, mappings, and dynamic PLCs.
     
  5. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    Duplicate the walking animation and make it point to the new duplication. My Tails falling sprite did something similar to this, I duplicated it and pointed it to that, and then it was fine.
     
  6. Alriightyman

    Alriightyman I'm back! Member

    Joined:
    Oct 3, 2007
    Messages:
    156
    Location:
    USA
    Not to sound stupid or anything but am I duplicating the walking artwork, the animation script, or the walking code?
     
  7. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    That actual walking code within the animation script.
     
  8. StephenUK

    StephenUK Working on a Quackshot disassembly Member

    Joined:
    Aug 5, 2007
    Messages:
    1,026
    I had to fix this for Megamix when I put the S2 Beta sprites in, and all I did was scrap the first animation frame off the mappings (which is actually blank). It all worked fine after that.
     
  9. Alriightyman

    Alriightyman I'm back! Member

    Joined:
    Oct 3, 2007
    Messages:
    156
    Location:
    USA
    I tried the duplicating the code but it didn't help. Also, I tried deleting the first mapping frame and changed the animation script so it would pick the right frames but it didn't work either.. I also noticed that it seems to do that glitch right before sonic go to his running animation...
     
  10. StephenUK

    StephenUK Working on a Quackshot disassembly Member

    Joined:
    Aug 5, 2007
    Messages:
    1,026
    I didn't say to touch the animation script, I just said to delete the first frame.
     
  11. Alriightyman

    Alriightyman I'm back! Member

    Joined:
    Oct 3, 2007
    Messages:
    156
    Location:
    USA
    Sorry I didn't respond back I was out of town for a few days.


    I just started over and for whatever reason it works now. It shows the wrong angle when sonic walks arond the loops sometimes but that's all. Thanks for helping me out.


    I have some other problems


    1) I wanted to use a larger font for the title cards. So I made multiple title card art, one for each zone. I put them in the plc's to load in the same spot as the original title cards and made a code where it loads the art to check what zone oyur on and to load the correct art. My problem is that SBZ3 loads the LZ art..


    Also, SLZ loads either nothing, explosion, or results art in a spot in the title cards...


    [​IMG]


    In the spots where there is nothing parts of the results or explosion art will be there,


    [​IMG]


    2)I also made diferent Results screen art it loads fine it just takes a few seconds longer than it should..


    Any Help would be greatly appreciated


    EDIT: If you want me to upload my hack let me know.


    EDIT: I fixed the title card thing. But i still don't know what to do about the results screen.
     
    Last edited by a moderator: Nov 22, 2007
Thread Status:
Not open for further replies.