Need some help porting a enemy from S1 to S2.

Discussion in 'Engineering & Reverse Engineering' started by .hack//zero, Aug 21, 2006.

Thread Status:
Not open for further replies.
  1. .hack//zero

    .hack//zero

    Member
    2,998
    0
    16
    Learning NES ASM, Finding a girlfriend.
    Okay, so I'm trying to port a crabmeat from S1 to S2. I think, I might be close to getting it to work. I've added all the enemy data and sub SUB ROUTiNE to the end of the rom.

    Code (Text):
    1. ; ---------------------------------------------------------------------------
    2. ; Object 1F - Crabmeat enemy (GHZ, SYZ)
    3. ; ---------------------------------------------------------------------------
    4.  
    5. Obj1F: ? ?; XREF: Obj_Index
    6.  ?moveq #0,d0
    7.  ?move.b    $24(a0),d0
    8.  ?move.w    Obj1F_Index(pc,d0.w),d1
    9.  ?jmp   Obj1F_Index(pc,d1.w)
    10. ; ===========================================================================
    11. Obj1F_Index:    dc.w Obj1F_Main-Obj1F_Index
    12.  ?dc.w Obj1F_Action-Obj1F_Index
    13.  ?dc.w Obj1F_Delete-Obj1F_Index
    14.  ?dc.w Obj1F_BallMain-Obj1F_Index
    15.  ?dc.w Obj1F_BallMove-Obj1F_Index
    16. ; ===========================================================================
    17.  
    18. Obj1F_Main: ?; XREF: Obj1F_Index
    19.  ?move.b    #$10,$16(a0)
    20.  ?move.b    #8,$17(a0)
    21.  ?move.l    #Map_obj1F,4(a0)
    22.  ?move.w    #$400,2(a0)
    23.  ?move.b    #4,1(a0)
    24.  ?move.b    #3,$18(a0)
    25.  ?move.b    #6,$20(a0)
    26.  ?move.b    #$15,$19(a0)
    27.  ?bsr.w ObjectFall
    28.  ?jsr   ObjHitFloor
    29.  ?tst.w d1
    30.  ?bpl.s locret_955A
    31.  ?add.w d1,$C(a0)
    32.  ?move.b    d3,$26(a0)
    33.  ?move.w    #0,$12(a0)
    34.  ?addq.b    #2,$24(a0)
    35.  
    36. locret_955A:
    37.  ?rts  
    38. ; ===========================================================================
    39.  
    40. Obj1F_Action: ?; XREF: Obj1F_Index
    41.  ?moveq #0,d0
    42.  ?move.b    $25(a0),d0
    43.  ?move.w    Obj1F_Index2(pc,d0.w),d1
    44.  ?jsr   Obj1F_Index2(pc,d1.w)
    45.  ?lea   (Ani_obj1F).l,a1
    46.  ?bsr.w AnimateSprite
    47.  ?bra.w MarkObjGone
    48. ; ===========================================================================
    49. Obj1F_Index2:   dc.w Obj1F_WaitFire-Obj1F_Index2
    50.  ?dc.w Obj1F_WalkOnFloor-Obj1F_Index2
    51. ; ===========================================================================
    52.  
    53. Obj1F_WaitFire: ?; XREF: Obj1F_Index2
    54.  ?subq.w    #1,$30(a0); subtract 1 from time delay
    55.  ?bpl.s locret_95B6
    56.  ?tst.b 1(a0)
    57.  ?bpl.s Obj1F_Move
    58.  ?bchg  #1,$32(a0)
    59.  ?bne.s Obj1F_MakeFire
    60.  
    61. Obj1F_Move:
    62.  ?addq.b    #2,$25(a0)
    63.  ?move.w    #127,$30(a0); set time delay to approx 2 seconds
    64.  ?move.w    #$80,$10(a0); move Crabmeat to the right
    65.  ?bsr.w Obj1F_SetAni
    66.  ?addq.b    #3,d0
    67.  ?move.b    d0,$1C(a0)
    68.  ?bchg  #0,$22(a0)
    69.  ?bne.s locret_95B6
    70.  ?neg.w $10(a0); change direction
    71.  
    72. locret_95B6:
    73.  ?rts  
    74. ; ===========================================================================
    75.  
    76. Obj1F_MakeFire: ?; XREF: Obj1F_WaitFire
    77.  ?move.w    #$3B,$30(a0)
    78.  ?move.b    #6,$1C(a0); use firing animation
    79.  ?bsr.w SingleObjLoad
    80.  ?bne.s Obj1F_MakeFire2
    81.  ?move.b    #$1F,0(a1); load left fireball
    82.  ?move.b    #6,$24(a1)
    83.  ?move.w    8(a0),8(a1)
    84.  ?subi.w    #$10,8(a1)
    85.  ?move.w    $C(a0),$C(a1)
    86.  ?move.w    #-$100,$10(a1)
    87.  
    88. Obj1F_MakeFire2:
    89.  ?bsr.w SingleObjLoad
    90.  ?bne.s locret_9618
    91.  ?move.b    #$1F,0(a1); load right fireball
    92.  ?move.b    #6,$24(a1)
    93.  ?move.w    8(a0),8(a1)
    94.  ?addi.w    #$10,8(a1)
    95.  ?move.w    $C(a0),$C(a1)
    96.  ?move.w    #$100,$10(a1)
    97.  
    98. locret_9618:
    99.  ?rts  
    100. ; ===========================================================================
    101.  
    102. Obj1F_WalkOnFloor: ?; XREF: Obj1F_Index2
    103.  ?subq.w    #1,$30(a0)
    104.  ?bmi.s loc_966E
    105.  ?bsr.w SpeedToPos
    106.  ?bchg  #0,$32(a0)
    107.  ?bne.s loc_9654
    108.  ?move.w    8(a0),d3
    109.  ?addi.w    #$10,d3
    110.  ?btst  #0,$22(a0)
    111.  ?beq.s loc_9640
    112.  ?subi.w    #$20,d3
    113.  
    114. loc_9640:
    115.  ?jsr   ObjHitFloor2
    116.  ?cmpi.w    #-8,d1
    117.  ?blt.s loc_966E
    118.  ?cmpi.w    #$C,d1
    119.  ?bge.s loc_966E
    120.  ?rts  
    121. ; ===========================================================================
    122.  
    123. loc_9654: ?; XREF: Obj1F_WalkOnFloor
    124.  ?jsr   ObjHitFloor
    125.  ?add.w d1,$C(a0)
    126.  ?move.b    d3,$26(a0)
    127.  ?bsr.w Obj1F_SetAni
    128.  ?addq.b    #3,d0
    129.  ?move.b    d0,$1C(a0)
    130.  ?rts  
    131. ; ===========================================================================
    132.  
    133. loc_966E: ?; XREF: Obj1F_WalkOnFloor
    134.  ?subq.b    #2,$25(a0)
    135.  ?move.w    #59,$30(a0)
    136.  ?move.w    #0,$10(a0)
    137.  ?bsr.w Obj1F_SetAni
    138.  ?move.b    d0,$1C(a0)
    139.  ?rts  
    140. ; ---------------------------------------------------------------------------
    141. ; Subroutine to set the correct animation for a Crabmeat
    142. ; ---------------------------------------------------------------------------
    143.  
    144. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    145.  
    146.  
    147. Obj1F_SetAni: ?; XREF: loc_966E
    148.  ?moveq #0,d0
    149.  ?move.b    $26(a0),d3
    150.  ?bmi.s loc_96A4
    151.  ?cmpi.b    #6,d3
    152.  ?bcs.s locret_96A2
    153.  ?moveq #1,d0
    154.  ?btst  #0,$22(a0)
    155.  ?bne.s locret_96A2
    156.  ?moveq #2,d0
    157.  
    158. locret_96A2:
    159.  ?rts  
    160. ; ===========================================================================
    161.  
    162. loc_96A4: ?; XREF: Obj1F_SetAni
    163.  ?cmpi.b    #-6,d3
    164.  ?bhi.s locret_96B6
    165.  ?moveq #2,d0
    166.  ?btst  #0,$22(a0)
    167.  ?bne.s locret_96B6
    168.  ?moveq #1,d0
    169.  
    170. locret_96B6:
    171.  ?rts  
    172. ; End of function Obj1F_SetAni
    173.  
    174. ; ===========================================================================
    175.  
    176. Obj1F_Delete: ?; XREF: Obj1F_Index
    177.  ?bsr.w DeleteObject
    178.  ?rts  
    179. ; ===========================================================================
    180. ; ---------------------------------------------------------------------------
    181. ; Sub-object - missile that the Crabmeat throws
    182. ; ---------------------------------------------------------------------------
    183.  
    184. Obj1F_BallMain: ?; XREF: Obj1F_Index
    185.  ?addq.b    #2,$24(a0)
    186.  ?move.l    #Map_obj1F,4(a0)
    187.  ?move.w    #$400,2(a0)
    188.  ?move.b    #4,1(a0)
    189.  ?move.b    #3,$18(a0)
    190.  ?move.b    #$87,$20(a0)
    191.  ?move.b    #8,$19(a0)
    192.  ?move.w    #-$400,$12(a0)
    193.  ?move.b    #7,$1C(a0)
    194.  
    195. Obj1F_BallMove: ?; XREF: Obj1F_Index
    196.  ?lea   (Ani_obj1F).l,a1
    197.  ?bsr.w AnimateSprite
    198.  ?bsr.w ObjectFall
    199.  ?bsr.w DisplaySprite
    200.  ?move.w    ($FFFFF72E).w,d0
    201.  ?addi.w    #$E0,d0
    202.  ?cmp.w $C(a0),d0; has object moved below the level boundary?
    203.  ?bcs.s Obj1F_Delete2; if yes, branch
    204.  ?rts  
    205. ; ===========================================================================
    206.  
    207. Obj1F_Delete2:
    208.  ?bra.w DeleteObject
    209. ; ===========================================================================
    210. Ani_obj1F:
    211. ; include=_anim\obj1F.asm
    212.  
    213. ObjectFall:
    214.  ?move.l    8(a0),d2
    215.  ?move.l    $C(a0),d3
    216.  ?move.w    $10(a0),d0
    217.  ?ext.l d0
    218.  ?asl.l #8,d0
    219.  ?add.l d0,d2
    220.  ?move.w    $12(a0),d0
    221.  ?addi.w    #$38,$12(a0); increase vertical speed
    222.  ?ext.l d0
    223.  ?asl.l #8,d0
    224.  ?add.l d0,d3
    225.  ?move.l    d2,8(a0)
    226.  ?move.l    d3,$C(a0)
    227.  ?rts  
    228. ; End of function ObjectFall
    229. ; ---------------------------------------------------------------------------
    230. ; Subroutine allowing objects to interact with the floor
    231. ; ---------------------------------------------------------------------------
    232.  
    233. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    234.  
    235.  
    236. ObjHitFloor:
    237.  ?move.w    8(a0),d3
    238.  
    239. ; End of function ObjHitFloor
    240.  
    241.  
    242. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    243.  
    244.  
    245. ObjHitFloor2:
    246.  ?move.w    $C(a0),d2
    247.  ?moveq #0,d0
    248.  ?move.b    $16(a0),d0
    249.  ?ext.w d0
    250.  ?add.w d0,d2
    251.  ?lea   ($FFFFF768).w,a4
    252.  ?move.b    #0,(a4)
    253.  ?movea.w   #$10,a3
    254.  ?move.w    #0,d6
    255.  ?moveq #$D,d5
    256.  ?bsr.w FindFloor
    257.  ?move.b    ($FFFFF768).w,d3
    258.  ?btst  #0,d3
    259.  ?beq.s locret_14E4E
    260.  ?move.b    #0,d3
    261.  
    262. locret_14E4E:
    263.  ?rts  
    264. ; End of function ObjHitFloor2
    265. ; ---------------------------------------------------------------------------
    266. ; Subroutine to animate a sprite using an animation script
    267. ; ---------------------------------------------------------------------------
    268.  
    269. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    270.  
    271.  
    272. AnimateSprite:
    273.  ?moveq #0,d0
    274.  ?move.b    $1C(a0),d0; move animation number   to d0
    275.  ?cmp.b $1D(a0),d0; is animation set to restart?
    276.  ?beq.s Anim_Run; if not, branch
    277.  ?move.b    d0,$1D(a0); set to "no restart"
    278.  ?move.b    #0,$1B(a0); reset   animation
    279.  ?move.b    #0,$1E(a0); reset   frame duration
    280.  
    281. Anim_Run:
    282.  ?subq.b    #1,$1E(a0); subtract 1 from frame   duration
    283.  ?bpl.s Anim_Wait; if time remains, branch
    284.  ?add.w d0,d0
    285.  ?adda.w    (a1,d0.w),a1; jump to appropriate animation script
    286.  ?move.b    (a1),$1E(a0); load frame duration
    287.  ?moveq #0,d1
    288.  ?move.b    $1B(a0),d1; load current frame number
    289.  ?move.b    1(a1,d1.w),d0; read sprite number from script
    290.  ?bmi.s Anim_End_FF; if animation is complete, branch
    291.  
    292. Anim_Next:
    293.  ?move.b    d0,d1
    294.  ?andi.b    #$1F,d0
    295.  ?move.b    d0,$1A(a0); load sprite number
    296.  ?move.b    $22(a0),d0
    297.  ?rol.b #3,d1
    298.  ?eor.b d0,d1
    299.  ?andi.b    #3,d1
    300.  ?andi.b    #$FC,1(a0)
    301.  ?or.b  d1,1(a0)
    302.  ?addq.b    #1,$1B(a0); next frame number
    303.  
    304. Anim_Wait:
    305.  ?rts  
    306. ; ===========================================================================
    307.  
    308. Anim_End_FF:
    309.  ?addq.b    #1,d0; is the end flag = $FF    ?
    310.  ?bne.s Anim_End_FE; if not, branch
    311.  ?move.b    #0,$1B(a0); restart the animation
    312.  ?move.b    1(a1),d0; read sprite number
    313.  ?bra.s Anim_Next
    314. ; ===========================================================================
    315.  
    316. Anim_End_FE:
    317.  ?addq.b    #1,d0; is the end flag = $FE    ?
    318.  ?bne.s Anim_End_FD; if not, branch
    319.  ?move.b    2(a1,d1.w),d0; read the next    byte in the script
    320.  ?sub.b d0,$1B(a0); jump back d0 bytes in   the script
    321.  ?sub.b d0,d1
    322.  ?move.b    1(a1,d1.w),d0; read sprite number
    323.  ?bra.s Anim_Next
    324. ; ===========================================================================
    325.  
    326. Anim_End_FD:
    327.  ?addq.b    #1,d0; is the end flag = $FD    ?
    328.  ?bne.s Anim_End_FC; if not, branch
    329.  ?move.b    2(a1,d1.w),$1C(a0); read next byte, run that animation
    330.  
    331. Anim_End_FC:
    332.  ?addq.b    #1,d0; is the end flag = $FC    ?
    333.  ?bne.s Anim_End_FB; if not, branch
    334.  ?addq.b    #2,$24(a0); jump to next routine
    335.  
    336. Anim_End_FB:
    337.  ?addq.b    #1,d0; is the end flag = $FB    ?
    338.  ?bne.s Anim_End_FA; if not, branch
    339.  ?move.b    #0,$1B(a0); reset   animation
    340.  ?clr.b $25(a0); reset  2nd routine counter
    341.  
    342. Anim_End_FA:
    343.  ?addq.b    #1,d0; is the end flag = $FA    ?
    344.  ?bne.s Anim_End; if not, branch
    345.  ?addq.b    #2,$25(a0); jump to next routine
    346.  
    347. Anim_End:
    348.  ?rts  
    349. ; End of function AnimateSprite
    350. ; ---------------------------------------------------------------------------
    351. ; Routine to mark an enemy/monitor/ring as destroyed
    352. ; ---------------------------------------------------------------------------
    353.  
    354. MarkObjGone:
    355.  ?move.w    8(a0),d0
    356.  ?andi.w    #$FF80,d0
    357.  ?move.w    ($FFFFF700).w,d1
    358.  ?subi.w    #$80,d1
    359.  ?andi.w    #$FF80,d1
    360.  ?sub.w d1,d0
    361.  ?cmpi.w    #$280,d0
    362.  ?bhi.w Mark_ChkGone
    363.  ?bra.w DisplaySprite
    364. ; ===========================================================================
    365.  
    366. Mark_ChkGone:
    367.  ?lea   ($FFFFFC00).w,a2
    368.  ?moveq #0,d0
    369.  ?move.b    $23(a0),d0
    370.  ?beq.s Mark_Delete
    371.  ?bclr  #7,2(a2,d0.w)
    372.  
    373. Mark_Delete:
    374.  ?bra.w DeleteObject
    375. ; ---------------------------------------------------------------------------
    376. ; Single object loading subroutine
    377. ; ---------------------------------------------------------------------------
    378.  
    379. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    380.  
    381.  
    382. SingleObjLoad:
    383.  ?lea   ($FFFFD800).w,a1; start address for object RAM
    384.  ?move.w    #$5F,d0
    385.  
    386. loc_DA94:
    387.  ?tst.b (a1); is object RAM slot empty?
    388.  ?beq.s locret_DAA0; if yes, branch
    389.  ?lea   $40(a1),a1; goto next object RAM slot
    390.  ?dbf   d0,loc_DA94; repeat $5F times
    391.  
    392. locret_DAA0:
    393.  ?rts  
    394. ; End of function SingleObjLoad
    395.  
    396.  
    397. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    398.  
    399.  
    400. SingleObjLoad2:
    401.  ?movea.l   a0,a1
    402.  ?move.w    #-$1000,d0
    403.  ?sub.w a0,d0
    404.  ?lsr.w #6,d0
    405.  ?subq.w    #1,d0
    406.  ?bcs.s locret_DABC
    407.  
    408. loc_DAB0:
    409.  ?tst.b (a1)
    410.  ?beq.s locret_DABC
    411.  ?lea   $40(a1),a1
    412.  ?dbf   d0,loc_DAB0
    413.  
    414. locret_DABC:
    415.  ?rts  
    416. ; End of function SingleObjLoad2
    417. SpeedToPos:
    418.  ?move.l    8(a0),d2
    419.  ?move.l    $C(a0),d3
    420.  ?move.w    $10(a0),d0; load horizontal speed
    421.  ?ext.l d0
    422.  ?asl.l #8,d0; multiply speed by $100
    423.  ?add.l d0,d2; add to x-axis    position
    424.  ?move.w    $12(a0),d0; load vertical   speed
    425.  ?ext.l d0
    426.  ?asl.l #8,d0; multiply by $100
    427.  ?add.l d0,d3; add to y-axis    position
    428.  ?move.l    d2,8(a0); update x-axis position
    429.  ?move.l    d3,$C(a0); update y-axis    position
    430.  ?rts  
    431. ; End of function SpeedToPos
    432. ; ---------------------------------------------------------------------------
    433. ; Subroutine to delete an object
    434. ; ---------------------------------------------------------------------------
    435.  
    436. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    437.  
    438.  
    439. DeleteObject:
    440.  ?movea.l   a0,a1
    441.  
    442. DeleteObject2:
    443.  ?moveq #0,d1
    444.  ?moveq #$F,d0
    445.  
    446. loc_D646:
    447.  ?move.l    d1,(a1)+; clear the object RAM
    448.  ?dbf   d0,loc_D646; repeat $F times (length of object RAM)
    449.  ?rts  
    450. ; End of function DeleteObject
    451. ; ---------------------------------------------------------------------------
    452. ; Subroutine to display a sprite/object, when a0 is the object RAM
    453. ; ---------------------------------------------------------------------------
    454.  
    455. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    456.  
    457.  
    458. DisplaySprite:
    459.  ?lea   ($FFFFAC00).w,a1
    460.  ?move.w    $18(a0),d0
    461.  ?lsr.w #1,d0
    462.  ?andi.w    #$380,d0
    463.  ?adda.w    d0,a1
    464.  ?cmpi.w    #$7E,(a1)
    465.  ?bcc.s locret_D620
    466.  ?addq.w    #2,(a1)
    467.  ?adda.w    (a1),a1
    468.  ?move.w    a0,(a1)
    469.  
    470. locret_D620:
    471.  ?rts  
    472. ; End of function DisplaySprite
    473.  
    474. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    475.  
    476.  
    477. FindFloor: ?; XREF: Sonic_AnglePos; et al
    478.  ?bsr.s Floor_ChkTile
    479.  ?move.w    (a1),d0
    480.  ?move.w    d0,d4
    481.  ?andi.w    #$7FF,d0
    482.  ?beq.s loc_149DE
    483.  ?btst  d5,d4
    484.  ?bne.s loc_149EC
    485.  
    486. loc_149DE:
    487.  ?add.w a3,d2
    488.  ?bsr.w FindFloor2
    489.  ?sub.w a3,d2
    490.  ?addi.w    #$10,d1
    491.  ?rts  
    492. ; ===========================================================================
    493.  
    494. loc_149EC:
    495.  ?movea.l   ($FFFFF796).w,a2; load  collision index
    496.  ?move.b    (a2,d0.w),d0
    497.  ?andi.w    #$FF,d0
    498.  ?beq.s loc_149DE
    499.  ?lea   (AngleMap).l,a2
    500.  ?move.b    (a2,d0.w),(a4)
    501.  ?lsl.w #4,d0
    502.  ?move.w    d3,d1
    503.  ?btst  #$B,d4
    504.  ?beq.s loc_14A12
    505.  ?not.w d1
    506.  ?neg.b (a4)
    507.  
    508. loc_14A12:
    509.  ?btst  #$C,d4
    510.  ?beq.s loc_14A22
    511.  ?addi.b    #$40,(a4)
    512.  ?neg.b (a4)
    513.  ?subi.b    #$40,(a4)
    514.  
    515. loc_14A22:
    516.  ?andi.w    #$F,d1
    517.  ?add.w d0,d1
    518.  ?lea   (CollArray1).l,a2
    519.  ?move.b    (a2,d1.w),d0
    520.  ?ext.w d0
    521.  ?eor.w d6,d4
    522.  ?btst  #$C,d4
    523.  ?beq.s loc_14A3E
    524.  ?neg.w d0
    525.  
    526. loc_14A3E:
    527.  ?tst.w d0
    528.  ?beq.s loc_149DE
    529.  ?bmi.s loc_14A5A
    530.  ?cmpi.b    #$10,d0
    531.  ?beq.s loc_14A66
    532.  ?move.w    d2,d1
    533.  ?andi.w    #$F,d1
    534.  ?add.w d1,d0
    535.  ?move.w    #$F,d1
    536.  ?sub.w d0,d1
    537.  ?rts  
    538. ; ===========================================================================
    539.  
    540. loc_14A5A:
    541.  ?move.w    d2,d1
    542.  ?andi.w    #$F,d1
    543.  ?add.w d1,d0
    544.  ?bpl.w loc_149DE
    545.  
    546. loc_14A66:
    547.  ?sub.w a3,d2
    548.  ?bsr.w FindFloor2
    549.  ?add.w a3,d2
    550.  ?subi.w    #$10,d1
    551.  ?rts  
    552. ; End of function FindFloor
    553.  
    554.  
    555. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    556.  
    557.  
    558. FindFloor2: ?; XREF: FindFloor
    559.  ?bsr.w Floor_ChkTile
    560.  ?move.w    (a1),d0
    561.  ?move.w    d0,d4
    562.  ?andi.w    #$7FF,d0
    563.  ?beq.s loc_14A86
    564.  ?btst  d5,d4
    565.  ?bne.s loc_14A94
    566.  
    567. loc_14A86:
    568.  ?move.w    #$F,d1
    569.  ?move.w    d2,d0
    570.  ?andi.w    #$F,d0
    571.  ?sub.w d0,d1
    572.  ?rts  
    573. ; ===========================================================================
    574.  
    575. loc_14A94:
    576.  ?movea.l   ($FFFFF796).w,a2
    577.  ?move.b    (a2,d0.w),d0
    578.  ?andi.w    #$FF,d0
    579.  ?beq.s loc_14A86
    580.  ?lea   (AngleMap).l,a2
    581.  ?move.b    (a2,d0.w),(a4)
    582.  ?lsl.w #4,d0
    583.  ?move.w    d3,d1
    584.  ?btst  #$B,d4
    585.  ?beq.s loc_14ABA
    586.  ?not.w d1
    587.  ?neg.b (a4)
    588.  
    589. loc_14ABA:
    590.  ?btst  #$C,d4
    591.  ?beq.s loc_14ACA
    592.  ?addi.b    #$40,(a4)
    593.  ?neg.b (a4)
    594.  ?subi.b    #$40,(a4)
    595.  
    596. loc_14ACA:
    597.  ?andi.w    #$F,d1
    598.  ?add.w d0,d1
    599.  ?lea   (CollArray1).l,a2
    600.  ?move.b    (a2,d1.w),d0
    601.  ?ext.w d0
    602.  ?eor.w d6,d4
    603.  ?btst  #$C,d4
    604.  ?beq.s loc_14AE6
    605.  ?neg.w d0
    606.  
    607. loc_14AE6:
    608.  ?tst.w d0
    609.  ?beq.s loc_14A86
    610.  ?bmi.s loc_14AFC
    611.  ?move.w    d2,d1
    612.  ?andi.w    #$F,d1
    613.  ?add.w d1,d0
    614.  ?move.w    #$F,d1
    615.  ?sub.w d0,d1
    616.  ?rts  
    617. ; ===========================================================================
    618.  
    619. loc_14AFC:
    620.  ?move.w    d2,d1
    621.  ?andi.w    #$F,d1
    622.  ?add.w d1,d0
    623.  ?bpl.w loc_14A86
    624.  ?not.w d1
    625.  ?rts  
    626. ; End of function FindFloor2
    627. ; ---------------------------------------------------------------------------
    628. ; Subroutine to find which tile the object is standing on
    629. ; ---------------------------------------------------------------------------
    630.  
    631. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    632.  
    633.  
    634. Floor_ChkTile: ?; XREF: FindFloor; et al
    635.  ?move.w    d2,d0
    636.  ?lsr.w #1,d0
    637.  ?andi.w    #$380,d0
    638.  ?move.w    d3,d1
    639.  ?lsr.w #8,d1
    640.  ?andi.w    #$7F,d1
    641.  ?add.w d1,d0
    642.  ?moveq #-1,d1
    643.  ?lea   ($FFFFA400).w,a1
    644.  ?move.b    (a1,d0.w),d1
    645.  ?beq.s loc_14996
    646.  ?bmi.s loc_1499A
    647.  ?subq.b    #1,d1
    648.  ?ext.w d1
    649.  ?ror.w #7,d1
    650.  ?move.w    d2,d0
    651.  ?add.w d0,d0
    652.  ?andi.w    #$1E0,d0
    653.  ?add.w d0,d1
    654.  ?move.w    d3,d0
    655.  ?lsr.w #3,d0
    656.  ?andi.w    #$1E,d0
    657.  ?add.w d0,d1
    658.  
    659. loc_14996:
    660.  ?movea.l   d1,a1
    661.  ?rts  
    662. ; ===========================================================================
    663.  
    664. loc_1499A:
    665.  ?andi.w    #$7F,d1
    666.  ?btst  #6,1(a0)
    667.  ?beq.s loc_149B2
    668.  ?addq.w    #1,d1
    669.  ?cmpi.w    #$29,d1
    670.  ?bne.s loc_149B2
    671.  ?move.w    #$51,d1
    672.  
    673. loc_149B2:
    674.  ?subq.b    #1,d1
    675.  ?ror.w #7,d1
    676.  ?move.w    d2,d0
    677.  ?add.w d0,d0
    678.  ?andi.w    #$1E0,d0
    679.  ?add.w d0,d1
    680.  ?move.w    d3,d0
    681.  ?lsr.w #3,d0
    682.  ?andi.w    #$1E,d0
    683.  ?add.w d0,d1
    684.  ?movea.l   d1,a1
    685.  ?rts  
    686. ; End of function Floor_ChkTile
    687. ; end of 'ROM'
    688. ; ---------------------------------------------------------------------------
    689. ; Sprite mappings - Crabmeat enemy (GHZ, SYZ)
    690. ; ---------------------------------------------------------------------------
    691. Map_obj1F:
    692. ; include=_maps\obj1F.asm
    693. ; ---------------------------------------------------------------------------
    694. ; Collision data
    695. ; ---------------------------------------------------------------------------
    696. AngleMap:   BINCLUDE    "collide\anglemap.bin"; floor angle map
    697.  ?
    698. CollArray1: BINCLUDE    "collide\carray_n.bin"; normal collision array
    699.  ?
    700. CollArray2: BINCLUDE    "collide\carray_r.bin"; rotated collision array
    But, I'm getting 1 error message that I can't figure out how to fix.

    > > >s2.asm(98424): error: jump distance too big
    > > > bsr.s Floor_ChkTile

    Thank you so freakin much Hivebrain, and Aurochs for making your Disassemblies.




    Wait, isn't it a problem that I have the locations at where they where in sonic 1 or should they be changed for sonic 2?
     
  2. StephenUK

    StephenUK

    Liquor in the front, poker in the rear Tech Member
    1,675
    0
    16
    Manchester, UK
    Quackshot Disassembly
    Why the hell did you copy all that? Only 40% of that is actually relevant to the Crabmeat, and all the rest of them are common routines between the Sonic games. You'd need to convert all of the SST values as well, convert the mappings and find the equivalent routines to the ones you copied in order for you to get it to work. If you have no asm knowledge, you're just wasting your time. It's not as simple as a copy and paste.

    On another note, just how many help topics do you actually need? Can't you just make one called "Help DHZ" and put them all in there.
     
  3. Varion Icaria

    Varion Icaria

    He's waiting.... Tech Member
    1,010
    0
    16
    S4: Cybernetic Outbreak
    Adding the subroutines to the end of the rom only wastes space, The games have the same subroutines but in different locations you gotta find them and link the jumps and branches accordingly.
     
  4. Aurochs

    Aurochs

    Единый, могучий Советский Союз! Tech Member
    2,343
    0
    0
    Whatever catches my fancy
    Change bsr.s to bsr.l and the branch will (should*) work. However, Stephen makes a good point. Duplicating code is bad. Locate the equivelant functions in the S2 ROM and jump to those.

    * If the branch distance is greater than $7FFF, you'll have to use a jump. There's no way around that.
     
  5. .hack//zero

    .hack//zero

    Member
    2,998
    0
    16
    Learning NES ASM, Finding a girlfriend.
    Right now, I'm just tring to see if I can get it to work. I'll clean it up later, if I can figure out how to.
     
  6. StephenUK

    StephenUK

    Liquor in the front, poker in the rear Tech Member
    1,675
    0
    16
    Manchester, UK
    Quackshot Disassembly
    I wasn't just hinting at wasting space either. S2 and S1 used different commands to animate the sprites, and mixing the 2 of them in a game could have some serious consequences. I recently ported the Sonic object data from S2B to S1 for Tweaker, and he can back me up on this. To say that the sprites ended up pretty fucked is an understatement. I've actually ported an object from S1 myself, and it did take a little bit of work to get it working properly. Porting S3K to S2 is even worse, but at least most of the routines matched up perfectly. The only major difference is where the data is stored in the SST.
     
  7. .hack//zero

    .hack//zero

    Member
    2,998
    0
    16
    Learning NES ASM, Finding a girlfriend.
    The funny thing is that I did that last time.

    Doing it this way is probably the only way I can learn how to do it.
     
  8. stormislandgal

    stormislandgal

    It's not a phase! Tech Member
    4,528
    8
    18
    Married life <3
    Just keep it simple if you want to LEARN asm. once you learn it, it's time for USING it. Right now, you seem to try to be using it. Check out the basics of comparing, branching, setting values etc. It's the way I learned, and it wasn't that hard.

    I've also found the equivelants of SpeedToPos and ObjectFall in Sonic 2, in case anyone's interested. Both are listed directly under "Sprite_1637C:". In all of my backups, I don't have the normal labels. =P
     
  9. .hack//zero

    .hack//zero

    Member
    2,998
    0
    16
    Learning NES ASM, Finding a girlfriend.
    Well, so far things are going pretty well. I've got him loaded without the game crashing and burning, execpt for when I get his art pointed to him. As for the enemy it's self. He loads, and causes damges. I've gotta fix his collision settings.
     
  10. stormislandgal

    stormislandgal

    It's not a phase! Tech Member
    4,528
    8
    18
    Married life <3
    Well, it's a start. Once you clean it up, noone will probably know the difference, other than Crabmeat being in Sonic 2. =P
     
  11. .hack//zero

    .hack//zero

    Member
    2,998
    0
    16
    Learning NES ASM, Finding a girlfriend.
    what's the equivalent of this in sonic 2?

    AngleMap: incbin collide\anglemap.bin ; floor angle map
    even
    CollArray1: incbin collide\carray_n.bin ; normal collision array
    even
    CollArray2: incbin collide\carray_r.bin ; rotated collision array
    even

    Okay, so how do I fix that?


    Other than the art causing the game kill himself, and the collision. It works fine. ^_^


    Now, I can get the art for the crab loaded, but not on the crabmeat it's self. You guys gotta admit that I got pretty far without knowing ASM.
     
  12. Rika Chou

    Rika Chou

    Tech Member
    5,254
    116
    43
    Before you worry about the art at all, you should get the object working correctly. The STT can be a nightmare if you don't know what your doing.

    Art is the simple part. All you have to do is load it the the VRAM, and make the object read from that location using the correct mappings.
     
  13. .hack//zero

    .hack//zero

    Member
    2,998
    0
    16
    Learning NES ASM, Finding a girlfriend.
    I know, but my main problem is getting his collision working right. As for the art, I'm having the same problem I used to have with beta enemies. Actually, I should be able to fix it about the same way as the beta enemies.

    Code (Text):
    1. ; ---------------------------------------------------------------------------
    2. ; Object 1F - Crabmeat enemy (GHZ, SYZ)
    3. ; ---------------------------------------------------------------------------
    4.  
    5. Obj1F: &nbsp; &nbsp;; XREF: Obj_Index
    6.  &nbsp;moveq    #0,d0
    7.  &nbsp;move.b   $24(a0),d0
    8.  &nbsp;move.w   Obj1F_Index(pc,d0.w),d1
    9.  &nbsp;jmp  Obj1F_Index(pc,d1.w)
    10. ; ===========================================================================
    11. Obj1F_Index:    dc.w Obj1F_Main-Obj1F_Index
    12.  &nbsp;dc.w Obj1F_Action-Obj1F_Index
    13.  &nbsp;dc.w Obj1F_Delete-Obj1F_Index
    14.  &nbsp;dc.w Obj1F_BallMain-Obj1F_Index
    15.  &nbsp;dc.w Obj1F_BallMove-Obj1F_Index
    16. ; ===========================================================================
    17.  
    18. Obj1F_Main:     &nbsp;; XREF: Obj1F_Index
    19.  &nbsp;move.b   #$10,$16(a0)
    20.  &nbsp;move.b   #8,$17(a0)
    21.  &nbsp;move.l   #Map_obj1F,4(a0)
    22.  &nbsp;move.w   #$400,2(a0)
    23.  &nbsp;move.b   #4,1(a0)
    24.  &nbsp;move.b   #3,$18(a0)
    25.  &nbsp;move.b   #6,$20(a0)
    26.  &nbsp;move.b   #$15,$19(a0)
    27.  &nbsp;bsr.w    ObjectFall
    28.  &nbsp;jsr  ObjHitFloor
    29.  &nbsp;tst.w    d1
    30.  &nbsp;bpl.s    locret_10006A
    31.  &nbsp;add.w    d1,$C(a0)
    32.  &nbsp;move.b   d3,$26(a0)
    33.  &nbsp;move.w   #0,$12(a0)
    34.  &nbsp;addq.b   #2,$24(a0)
    35.  
    36. locret_10006A:
    37.  &nbsp;rts 
    38. ; ===========================================================================
    39.  
    40. Obj1F_Action:   &nbsp;; XREF: Obj1F_Index
    41.  &nbsp;moveq    #0,d0
    42.  &nbsp;move.b   $25(a0),d0
    43.  &nbsp;move.w   Obj1F_Index2(pc,d0.w),d1
    44.  &nbsp;jsr  Obj1F_Index2(pc,d1.w)
    45.  &nbsp;lea  (Ani_obj1F).l,a1
    46.  &nbsp;bsr.w    AnimateSprite
    47.  &nbsp;bra.w    MarkObjGone
    48. ; ===========================================================================
    49. Obj1F_Index2:   dc.w Obj1F_WaitFire-Obj1F_Index2
    50.  &nbsp;dc.w Obj1F_WalkOnFloor-Obj1F_Index2
    51. ; ===========================================================================
    52.  
    53. Obj1F_WaitFire:     &nbsp;; XREF: Obj1F_Index2
    54.  &nbsp;subq.w   #1,$30(a0); subtract 1 from time delay
    55.  &nbsp;bpl.s    locret_1000c6
    56.  &nbsp;tst.b    1(a0)
    57.  &nbsp;bpl.s    Obj1F_Move
    58.  &nbsp;bchg #1,$32(a0)
    59.  &nbsp;bne.s    Obj1F_MakeFire
    60.  
    61. Obj1F_Move:
    62.  &nbsp;addq.b   #2,$25(a0)
    63.  &nbsp;move.w   #127,$30(a0); set time delay to approx 2 seconds
    64.  &nbsp;move.w   #$80,$10(a0); move Crabmeat to the right
    65.  &nbsp;bsr.w    Obj1F_SetAni
    66.  &nbsp;addq.b   #3,d0
    67.  &nbsp;move.b   d0,$1C(a0)
    68.  &nbsp;bchg #0,$22(a0)
    69.  &nbsp;bne.s    locret_1000C6
    70.  &nbsp;neg.w    $10(a0) ; change direction
    71.  
    72. locret_1000C6:
    73.  &nbsp;rts 
    74. ; ===========================================================================
    75.  
    76. Obj1F_MakeFire:     &nbsp;; XREF: Obj1F_WaitFire
    77.  &nbsp;move.w   #$3B,$30(a0)
    78.  &nbsp;move.b   #6,$1C(a0); use firing animation
    79.  &nbsp;bsr.w    SingleObjLoad
    80.  &nbsp;bne.s    Obj1F_MakeFire2
    81.  &nbsp;move.b   #$1F,0(a1); load left fireball
    82.  &nbsp;move.b   #6,$24(a1)
    83.  &nbsp;move.w   8(a0),8(a1)
    84.  &nbsp;subi.w   #$10,8(a1)
    85.  &nbsp;move.w   $C(a0),$C(a1)
    86.  &nbsp;move.w   #-$100,$10(a1)
    87.  
    88. Obj1F_MakeFire2:
    89.  &nbsp;bsr.w    SingleObjLoad
    90.  &nbsp;bne.s    locret_100128
    91.  &nbsp;move.b   #$1F,0(a1); load right fireball
    92.  &nbsp;move.b   #6,$24(a1)
    93.  &nbsp;move.w   8(a0),8(a1)
    94.  &nbsp;addi.w   #$10,8(a1)
    95.  &nbsp;move.w   $C(a0),$C(a1)
    96.  &nbsp;move.w   #$100,$10(a1)
    97.  
    98. locret_100128:
    99.  &nbsp;rts 
    100. ; ===========================================================================
    101.  
    102. Obj1F_WalkOnFloor: &nbsp;; XREF: Obj1F_Index2
    103.  &nbsp;subq.w   #1,$30(a0)
    104.  &nbsp;bmi.s    loc_10017E
    105.  &nbsp;jmp  sub_15AC6
    106.  &nbsp;bchg #0,$32(a0)
    107.  &nbsp;bne.s    loc_100164
    108.  &nbsp;move.w   8(a0),d3
    109.  &nbsp;addi.w   #$10,d3
    110.  &nbsp;btst #0,$22(a0)
    111.  &nbsp;beq.s    loc_100150
    112.  &nbsp;subi.w   #$20,d3
    113.  
    114. loc_100150:
    115.  &nbsp;jsr  ObjHitFloor2
    116.  &nbsp;cmpi.w   #-8,d1
    117.  &nbsp;blt.s    loc_10017E
    118.  &nbsp;cmpi.w   #$C,d1
    119.  &nbsp;bge.s    loc_10017E
    120.  &nbsp;rts 
    121. ; ===========================================================================
    122.  
    123. loc_100164:     &nbsp;; XREF: Obj1F_WalkOnFloor
    124.  &nbsp;jsr  ObjHitFloor
    125.  &nbsp;add.w    d1,$C(a0)
    126.  &nbsp;move.b   d3,$26(a0)
    127.  &nbsp;bsr.w    Obj1F_SetAni
    128.  &nbsp;addq.b   #3,d0
    129.  &nbsp;move.b   d0,$1C(a0)
    130.  &nbsp;rts 
    131. ; ===========================================================================
    132.  
    133. loc_10017e:     &nbsp;; XREF: Obj1F_WalkOnFloor
    134.  &nbsp;subq.b   #2,$25(a0)
    135.  &nbsp;move.w   #59,$30(a0)
    136.  &nbsp;move.w   #0,$10(a0)
    137.  &nbsp;bsr.w    Obj1F_SetAni
    138.  &nbsp;move.b   d0,$1C(a0)
    139.  &nbsp;rts 
    140. ; ---------------------------------------------------------------------------
    141. ; Subroutine to set the correct animation for a Crabmeat
    142. ; ---------------------------------------------------------------------------
    143.  
    144. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    145.  
    146.  
    147. Obj1F_SetAni:   &nbsp;; XREF: loc_10017E
    148.  &nbsp;moveq    #0,d0
    149.  &nbsp;move.b   $26(a0),d3
    150.  &nbsp;bmi.s    loc_1001B4
    151.  &nbsp;cmpi.b   #6,d3
    152.  &nbsp;bcs.s    locret_1001B2
    153.  &nbsp;moveq    #1,d0
    154.  &nbsp;btst #0,$22(a0)
    155.  &nbsp;bne.s    locret_1001B2
    156.  &nbsp;moveq    #2,d0
    157.  
    158. locret_1001B2:
    159.  &nbsp;rts 
    160. ; ===========================================================================
    161.  
    162. loc_1001B4:     &nbsp;; XREF: Obj1F_SetAni
    163.  &nbsp;cmpi.b   #-6,d3
    164.  &nbsp;bhi.s    locret_1001C6
    165.  &nbsp;moveq    #2,d0
    166.  &nbsp;btst #0,$22(a0)
    167.  &nbsp;bne.s    locret_1001C6
    168.  &nbsp;moveq    #1,d0
    169.  
    170. locret_1001C6:
    171.  &nbsp;rts 
    172. ; End of function Obj1F_SetAni
    173.  
    174. ; ===========================================================================
    175.  
    176. Obj1F_Delete:   &nbsp;; XREF: Obj1F_Index
    177.  &nbsp;bsr.w    DeleteObject
    178.  &nbsp;rts 
    179. ; ===========================================================================
    180. ; ---------------------------------------------------------------------------
    181. ; Sub-object - missile that the Crabmeat throws
    182. ; ---------------------------------------------------------------------------
    183.  
    184. Obj1F_BallMain:     &nbsp;; XREF: Obj1F_Index
    185.  &nbsp;addq.b   #2,$24(a0)
    186.  &nbsp;move.l   #Map_obj1F,4(a0)
    187.  &nbsp;move.w   #$400,2(a0)
    188.  &nbsp;move.b   #4,1(a0)
    189.  &nbsp;move.b   #3,$18(a0)
    190.  &nbsp;move.b   #$87,$20(a0)
    191.  &nbsp;move.b   #8,$19(a0)
    192.  &nbsp;move.w   #-$400,$12(a0)
    193.  &nbsp;move.b   #7,$1C(a0)
    194.  
    195. Obj1F_BallMove:     &nbsp;; XREF: Obj1F_Index
    196.  &nbsp;lea  (Ani_obj1F).l,a1
    197.  &nbsp;bsr.w    AnimateSprite
    198.  &nbsp;bsr.w    ObjectFall
    199.  &nbsp;jmp  sub_15AC6
    200.  &nbsp;move.w   ($FFFFF72E).w,d0
    201.  &nbsp;addi.w   #$E0,d0
    202.  &nbsp;cmp.w    $C(a0),d0; has object moved below the level boundary?
    203.  &nbsp;bcs.s    Obj1F_Delete2; if yes, branch
    204.  &nbsp;rts 
    205. ; ===========================================================================
    206.  
    207. Obj1F_Delete2:
    208.  &nbsp;bra.w    DeleteObject
    209. ; ===========================================================================
    210. Ani_obj1F:
    211. ; include=_anim\obj1F.asm
    212.  
    213. ObjectFall:
    214.  &nbsp;move.l   8(a0),d2
    215.  &nbsp;move.l   $C(a0),d3
    216.  &nbsp;move.w   $10(a0),d0
    217.  &nbsp;ext.l    d0
    218.  &nbsp;asl.l    #8,d0
    219.  &nbsp;add.l    d0,d2
    220.  &nbsp;move.w   $12(a0),d0
    221.  &nbsp;addi.w   #$38,$12(a0); increase vertical speed
    222.  &nbsp;ext.l    d0
    223.  &nbsp;asl.l    #8,d0
    224.  &nbsp;add.l    d0,d3
    225.  &nbsp;move.l   d2,8(a0)
    226.  &nbsp;move.l   d3,$C(a0)
    227.  &nbsp;rts 
    228. ; End of function ObjectFall
    229. ; ---------------------------------------------------------------------------
    230. ; Subroutine allowing objects to interact with the floor
    231. ; ---------------------------------------------------------------------------
    232.  
    233. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    234.  
    235.  
    236. ObjHitFloor:
    237.  &nbsp;move.w   8(a0),d3
    238.  
    239. ; End of function ObjHitFloor
    240.  
    241.  
    242. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    243.  
    244.  
    245. ObjHitFloor2:
    246.  &nbsp;move.w   $C(a0),d2
    247.  &nbsp;moveq    #0,d0
    248.  &nbsp;move.b   $16(a0),d0
    249.  &nbsp;ext.w    d0
    250.  &nbsp;add.w    d0,d2
    251.  &nbsp;lea  ($FFFFF768).w,a4
    252.  &nbsp;move.b   #0,(a4)
    253.  &nbsp;movea.w  #$10,a3
    254.  &nbsp;move.w   #0,d6
    255.  &nbsp;moveq    #$D,d5
    256.  &nbsp;bsr.w    FindFloor
    257.  &nbsp;move.b   ($FFFFF768).w,d3
    258.  &nbsp;btst #0,d3
    259.  &nbsp;beq.s    locret_14E4E
    260.  &nbsp;move.b   #0,d3
    261.  
    262. locret_14E4E:
    263.  &nbsp;rts 
    264. ; End of function ObjHitFloor2
    265. ; ---------------------------------------------------------------------------
    266. ; Subroutine to animate a sprite using an animation script
    267. ; ---------------------------------------------------------------------------
    268.  
    269. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    270.  
    271.  
    272. AnimateSprite:
    273.  &nbsp;moveq    #0,d0
    274.  &nbsp;move.b   $1C(a0),d0; move animation number   to d0
    275.  &nbsp;cmp.b    $1D(a0),d0; is animation set to restart?
    276.  &nbsp;beq.s    Anim_Run; if not, branch
    277.  &nbsp;move.b   d0,$1D(a0); set to "no restart"
    278.  &nbsp;move.b   #0,$1B(a0); reset   animation
    279.  &nbsp;move.b   #0,$1E(a0); reset   frame duration
    280.  
    281. Anim_Run:
    282.  &nbsp;subq.b   #1,$1E(a0); subtract 1 from frame   duration
    283.  &nbsp;bpl.s    Anim_Wait; if time remains, branch
    284.  &nbsp;add.w    d0,d0
    285.  &nbsp;adda.w   (a1,d0.w),a1; jump to appropriate animation script
    286.  &nbsp;move.b   (a1),$1E(a0); load frame duration
    287.  &nbsp;moveq    #0,d1
    288.  &nbsp;move.b   $1B(a0),d1; load current frame number
    289.  &nbsp;move.b   1(a1,d1.w),d0; read sprite number from script
    290.  &nbsp;bmi.s    Anim_End_FF; if animation is complete, branch
    291.  
    292. Anim_Next:
    293.  &nbsp;move.b   d0,d1
    294.  &nbsp;andi.b   #$1F,d0
    295.  &nbsp;move.b   d0,$1A(a0); load sprite number
    296.  &nbsp;move.b   $22(a0),d0
    297.  &nbsp;rol.b    #3,d1
    298.  &nbsp;eor.b    d0,d1
    299.  &nbsp;andi.b   #3,d1
    300.  &nbsp;andi.b   #$FC,1(a0)
    301.  &nbsp;or.b d1,1(a0)
    302.  &nbsp;addq.b   #1,$1B(a0); next frame number
    303.  
    304. Anim_Wait:
    305.  &nbsp;rts 
    306. ; ===========================================================================
    307.  
    308. Anim_End_FF:
    309.  &nbsp;addq.b   #1,d0   ; is the end flag = $FF ?
    310.  &nbsp;bne.s    Anim_End_FE; if not, branch
    311.  &nbsp;move.b   #0,$1B(a0); restart the animation
    312.  &nbsp;move.b   1(a1),d0; read sprite number
    313.  &nbsp;bra.s    Anim_Next
    314. ; ===========================================================================
    315.  
    316. Anim_End_FE:
    317.  &nbsp;addq.b   #1,d0   ; is the end flag = $FE ?
    318.  &nbsp;bne.s    Anim_End_FD; if not, branch
    319.  &nbsp;move.b   2(a1,d1.w),d0; read the next    byte in the script
    320.  &nbsp;sub.b    d0,$1B(a0); jump back d0 bytes in   the script
    321.  &nbsp;sub.b    d0,d1
    322.  &nbsp;move.b   1(a1,d1.w),d0; read sprite number
    323.  &nbsp;bra.s    Anim_Next
    324. ; ===========================================================================
    325.  
    326. Anim_End_FD:
    327.  &nbsp;addq.b   #1,d0   ; is the end flag = $FD ?
    328.  &nbsp;bne.s    Anim_End_FC; if not, branch
    329.  &nbsp;move.b   2(a1,d1.w),$1C(a0); read next byte, run that animation
    330.  
    331. Anim_End_FC:
    332.  &nbsp;addq.b   #1,d0   ; is the end flag = $FC ?
    333.  &nbsp;bne.s    Anim_End_FB; if not, branch
    334.  &nbsp;addq.b   #2,$24(a0); jump to next routine
    335.  
    336. Anim_End_FB:
    337.  &nbsp;addq.b   #1,d0   ; is the end flag = $FB ?
    338.  &nbsp;bne.s    Anim_End_FA; if not, branch
    339.  &nbsp;move.b   #0,$1B(a0); reset   animation
    340.  &nbsp;clr.b    $25(a0) ; reset 2nd routine counter
    341.  
    342. Anim_End_FA:
    343.  &nbsp;addq.b   #1,d0   ; is the end flag = $FA ?
    344.  &nbsp;bne.s    Anim_End; if not, branch
    345.  &nbsp;addq.b   #2,$25(a0); jump to next routine
    346.  
    347. Anim_End:
    348.  &nbsp;rts 
    349. ; End of function AnimateSprite
    350. ; ---------------------------------------------------------------------------
    351. ; Routine to mark an enemy/monitor/ring as destroyed
    352. ; ---------------------------------------------------------------------------
    353.  
    354. MarkObjGone:
    355.  &nbsp;move.w   8(a0),d0
    356.  &nbsp;andi.w   #$FF80,d0
    357.  &nbsp;move.w   ($FFFFF700).w,d1
    358.  &nbsp;subi.w   #$80,d1
    359.  &nbsp;andi.w   #$FF80,d1
    360.  &nbsp;sub.w    d1,d0
    361.  &nbsp;cmpi.w   #$280,d0
    362.  &nbsp;bhi.w    Mark_ChkGone
    363.  &nbsp;bra.w    DisplaySprite
    364. ; ===========================================================================
    365.  
    366. Mark_ChkGone:
    367.  &nbsp;lea  ($FFFFFC00).w,a2
    368.  &nbsp;moveq    #0,d0
    369.  &nbsp;move.b   $23(a0),d0
    370.  &nbsp;beq.s    Mark_Delete
    371.  &nbsp;bclr #7,2(a2,d0.w)
    372.  
    373. Mark_Delete:
    374.  &nbsp;bra.w    DeleteObject
    375. ; ---------------------------------------------------------------------------
    376. ; Single object loading subroutine
    377. ; ---------------------------------------------------------------------------
    378.  
    379. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    380.  
    381.  
    382. SingleObjLoad:
    383.  &nbsp;lea  ($FFFFD800).w,a1; start address for object RAM
    384.  &nbsp;move.w   #$5F,d0
    385.  
    386. loc_DA94:
    387.  &nbsp;tst.b    (a1)    ; is object RAM slot empty?
    388.  &nbsp;beq.s    locret_DAA0; if yes, branch
    389.  &nbsp;lea  $40(a1),a1; goto next object RAM slot
    390.  &nbsp;dbf  d0,loc_DA94; repeat $5F times
    391.  
    392. locret_DAA0:
    393.  &nbsp;rts 
    394. ; End of function SingleObjLoad
    395.  
    396.  
    397. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    398.  
    399.  
    400. SingleObjLoad2:
    401.  &nbsp;movea.l  a0,a1
    402.  &nbsp;move.w   #-$1000,d0
    403.  &nbsp;sub.w    a0,d0
    404.  &nbsp;lsr.w    #6,d0
    405.  &nbsp;subq.w   #1,d0
    406.  &nbsp;bcs.s    locret_DABC
    407.  
    408. loc_DAB0:
    409.  &nbsp;tst.b    (a1)
    410.  &nbsp;beq.s    locret_DABC
    411.  &nbsp;lea  $40(a1),a1
    412.  &nbsp;dbf  d0,loc_DAB0
    413.  
    414. locret_DABC:
    415.  &nbsp;rts 
    416. ; End of function SingleObjLoad2
    417. SpeedToPos:
    418.  &nbsp;move.l   8(a0),d2
    419.  &nbsp;move.l   $C(a0),d3
    420.  &nbsp;move.w   $10(a0),d0; load horizontal speed
    421.  &nbsp;ext.l    d0
    422.  &nbsp;asl.l    #8,d0   ; multiply speed by $100
    423.  &nbsp;add.l    d0,d2   ; add to x-axis position
    424.  &nbsp;move.w   $12(a0),d0; load vertical   speed
    425.  &nbsp;ext.l    d0
    426.  &nbsp;asl.l    #8,d0   ; multiply by $100
    427.  &nbsp;add.l    d0,d3   ; add to y-axis position
    428.  &nbsp;move.l   d2,8(a0); update x-axis position
    429.  &nbsp;move.l   d3,$C(a0); update y-axis    position
    430.  &nbsp;rts 
    431. ; End of function SpeedToPos
    432. ; ---------------------------------------------------------------------------
    433. ; Subroutine to delete an object
    434. ; ---------------------------------------------------------------------------
    435.  
    436. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    437.  
    438.  
    439. DeleteObject:
    440.  &nbsp;movea.l  a0,a1
    441.  
    442. DeleteObject2:
    443.  &nbsp;moveq    #0,d1
    444.  &nbsp;moveq    #$F,d0
    445.  
    446. loc_D646:
    447.  &nbsp;move.l   d1,(a1)+; clear the object RAM
    448.  &nbsp;dbf  d0,loc_D646; repeat $F times (length of object RAM)
    449.  &nbsp;rts 
    450. ; End of function DeleteObject
    451. ; ---------------------------------------------------------------------------
    452. ; Subroutine to display a sprite/object, when a0 is the object RAM
    453. ; ---------------------------------------------------------------------------
    454.  
    455. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    456.  
    457.  
    458. DisplaySprite:
    459.  &nbsp;lea  ($FFFFAC00).w,a1
    460.  &nbsp;move.w   $18(a0),d0
    461.  &nbsp;lsr.w    #1,d0
    462.  &nbsp;andi.w   #$380,d0
    463.  &nbsp;adda.w   d0,a1
    464.  &nbsp;cmpi.w   #$7E,(a1)
    465.  &nbsp;bcc.s    locret_D620
    466.  &nbsp;addq.w   #2,(a1)
    467.  &nbsp;adda.w   (a1),a1
    468.  &nbsp;move.w   a0,(a1)
    469.  
    470. locret_D620:
    471.  &nbsp;rts 
    472. ; End of function DisplaySprite
    473.  
    474. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    475.  
    476.  
    477. FindFloor:  &nbsp;; XREF: Sonic_AnglePos; et al
    478.  &nbsp;bsr.l    Floor_ChkTile
    479.  &nbsp;move.w   (a1),d0
    480.  &nbsp;move.w   d0,d4
    481.  &nbsp;andi.w   #$7FF,d0
    482.  &nbsp;beq.s    loc_149DE
    483.  &nbsp;btst d5,d4
    484.  &nbsp;bne.s    loc_149EC
    485.  
    486. loc_149DE:
    487.  &nbsp;add.w    a3,d2
    488.  &nbsp;bsr.w    FindFloor2
    489.  &nbsp;sub.w    a3,d2
    490.  &nbsp;addi.w   #$10,d1
    491.  &nbsp;rts 
    492. ; ===========================================================================
    493.  
    494. loc_149EC:
    495.  &nbsp;movea.l  ($FFFFF796).w,a2; load  collision index
    496.  &nbsp;move.b   (a2,d0.w),d0
    497.  &nbsp;andi.w   #$FF,d0
    498.  &nbsp;beq.s    loc_149DE
    499.  &nbsp;lea  (AngleMap).l,a2
    500.  &nbsp;move.b   (a2,d0.w),(a4)
    501.  &nbsp;lsl.w    #4,d0
    502.  &nbsp;move.w   d3,d1
    503.  &nbsp;btst #$B,d4
    504.  &nbsp;beq.s    loc_14A12
    505.  &nbsp;not.w    d1
    506.  &nbsp;neg.b    (a4)
    507.  
    508. loc_14A12:
    509.  &nbsp;btst #$C,d4
    510.  &nbsp;beq.s    loc_14A22
    511.  &nbsp;addi.b   #$40,(a4)
    512.  &nbsp;neg.b    (a4)
    513.  &nbsp;subi.b   #$40,(a4)
    514.  
    515. loc_14A22:
    516.  &nbsp;andi.w   #$F,d1
    517.  &nbsp;add.w    d0,d1
    518.  &nbsp;lea  (CollArray1).l,a2
    519.  &nbsp;move.b   (a2,d1.w),d0
    520.  &nbsp;ext.w    d0
    521.  &nbsp;eor.w    d6,d4
    522.  &nbsp;btst #$C,d4
    523.  &nbsp;beq.s    loc_14A3E
    524.  &nbsp;neg.w    d0
    525.  
    526. loc_14A3E:
    527.  &nbsp;tst.w    d0
    528.  &nbsp;beq.s    loc_149DE
    529.  &nbsp;bmi.s    loc_14A5A
    530.  &nbsp;cmpi.b   #$10,d0
    531.  &nbsp;beq.s    loc_14A66
    532.  &nbsp;move.w   d2,d1
    533.  &nbsp;andi.w   #$F,d1
    534.  &nbsp;add.w    d1,d0
    535.  &nbsp;move.w   #$F,d1
    536.  &nbsp;sub.w    d0,d1
    537.  &nbsp;rts 
    538. ; ===========================================================================
    539.  
    540. loc_14A5A:
    541.  &nbsp;move.w   d2,d1
    542.  &nbsp;andi.w   #$F,d1
    543.  &nbsp;add.w    d1,d0
    544.  &nbsp;bpl.w    loc_149DE
    545.  
    546. loc_14A66:
    547.  &nbsp;sub.w    a3,d2
    548.  &nbsp;bsr.w    FindFloor2
    549.  &nbsp;add.w    a3,d2
    550.  &nbsp;subi.w   #$10,d1
    551.  &nbsp;rts 
    552. ; End of function FindFloor
    553.  
    554.  
    555. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    556.  
    557.  
    558. FindFloor2:     &nbsp;; XREF: FindFloor
    559.  &nbsp;bsr.w    Floor_ChkTile
    560.  &nbsp;move.w   (a1),d0
    561.  &nbsp;move.w   d0,d4
    562.  &nbsp;andi.w   #$7FF,d0
    563.  &nbsp;beq.s    loc_14A86
    564.  &nbsp;btst d5,d4
    565.  &nbsp;bne.s    loc_14A94
    566.  
    567. loc_14A86:
    568.  &nbsp;move.w   #$F,d1
    569.  &nbsp;move.w   d2,d0
    570.  &nbsp;andi.w   #$F,d0
    571.  &nbsp;sub.w    d0,d1
    572.  &nbsp;rts 
    573. ; ===========================================================================
    574.  
    575. loc_14A94:
    576.  &nbsp;movea.l  ($FFFFF796).w,a2
    577.  &nbsp;move.b   (a2,d0.w),d0
    578.  &nbsp;andi.w   #$FF,d0
    579.  &nbsp;beq.s    loc_14A86
    580.  &nbsp;lea  (AngleMap).l,a2
    581.  &nbsp;move.b   (a2,d0.w),(a4)
    582.  &nbsp;lsl.w    #4,d0
    583.  &nbsp;move.w   d3,d1
    584.  &nbsp;btst #$B,d4
    585.  &nbsp;beq.s    loc_14ABA
    586.  &nbsp;not.w    d1
    587.  &nbsp;neg.b    (a4)
    588.  
    589. loc_14ABA:
    590.  &nbsp;btst #$C,d4
    591.  &nbsp;beq.s    loc_14ACA
    592.  &nbsp;addi.b   #$40,(a4)
    593.  &nbsp;neg.b    (a4)
    594.  &nbsp;subi.b   #$40,(a4)
    595.  
    596. loc_14ACA:
    597.  &nbsp;andi.w   #$F,d1
    598.  &nbsp;add.w    d0,d1
    599.  &nbsp;lea  (CollArray1).l,a2
    600.  &nbsp;move.b   (a2,d1.w),d0
    601.  &nbsp;ext.w    d0
    602.  &nbsp;eor.w    d6,d4
    603.  &nbsp;btst #$C,d4
    604.  &nbsp;beq.s    loc_14AE6
    605.  &nbsp;neg.w    d0
    606.  
    607. loc_14AE6:
    608.  &nbsp;tst.w    d0
    609.  &nbsp;beq.s    loc_14A86
    610.  &nbsp;bmi.s    loc_14AFC
    611.  &nbsp;move.w   d2,d1
    612.  &nbsp;andi.w   #$F,d1
    613.  &nbsp;add.w    d1,d0
    614.  &nbsp;move.w   #$F,d1
    615.  &nbsp;sub.w    d0,d1
    616.  &nbsp;rts 
    617. ; ===========================================================================
    618.  
    619. loc_14AFC:
    620.  &nbsp;move.w   d2,d1
    621.  &nbsp;andi.w   #$F,d1
    622.  &nbsp;add.w    d1,d0
    623.  &nbsp;bpl.w    loc_14A86
    624.  &nbsp;not.w    d1
    625.  &nbsp;rts 
    626. ; End of function FindFloor2
    627. ; ---------------------------------------------------------------------------
    628. ; Subroutine to find which tile the object is standing on
    629. ; ---------------------------------------------------------------------------
    630.  
    631. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    632.  
    633.  
    634. Floor_ChkTile:  &nbsp;; XREF: FindFloor; et al
    635.  &nbsp;move.w   d2,d0
    636.  &nbsp;lsr.w    #1,d0
    637.  &nbsp;andi.w   #$380,d0
    638.  &nbsp;move.w   d3,d1
    639.  &nbsp;lsr.w    #8,d1
    640.  &nbsp;andi.w   #$7F,d1
    641.  &nbsp;add.w    d1,d0
    642.  &nbsp;moveq    #-1,d1
    643.  &nbsp;lea  ($FFFFA400).w,a1
    644.  &nbsp;move.b   (a1,d0.w),d1
    645.  &nbsp;beq.s    loc_14996
    646.  &nbsp;bmi.s    loc_1499A
    647.  &nbsp;subq.b   #1,d1
    648.  &nbsp;ext.w    d1
    649.  &nbsp;ror.w    #7,d1
    650.  &nbsp;move.w   d2,d0
    651.  &nbsp;add.w    d0,d0
    652.  &nbsp;andi.w   #$1E0,d0
    653.  &nbsp;add.w    d0,d1
    654.  &nbsp;move.w   d3,d0
    655.  &nbsp;lsr.w    #3,d0
    656.  &nbsp;andi.w   #$1E,d0
    657.  &nbsp;add.w    d0,d1
    658.  
    659. loc_14996:
    660.  &nbsp;movea.l  d1,a1
    661.  &nbsp;rts 
    662. ; ===========================================================================
    663.  
    664. loc_1499A:
    665.  &nbsp;andi.w   #$7F,d1
    666.  &nbsp;btst #6,1(a0)
    667.  &nbsp;beq.s    loc_149B2
    668.  &nbsp;addq.w   #1,d1
    669.  &nbsp;cmpi.w   #$29,d1
    670.  &nbsp;bne.s    loc_149B2
    671.  &nbsp;move.w   #$51,d1
    672.  
    673. loc_149B2:
    674.  &nbsp;subq.b   #1,d1
    675.  &nbsp;ror.w    #7,d1
    676.  &nbsp;move.w   d2,d0
    677.  &nbsp;add.w    d0,d0
    678.  &nbsp;andi.w   #$1E0,d0
    679.  &nbsp;add.w    d0,d1
    680.  &nbsp;move.w   d3,d0
    681.  &nbsp;lsr.w    #3,d0
    682.  &nbsp;andi.w   #$1E,d0
    683.  &nbsp;add.w    d0,d1
    684.  &nbsp;movea.l  d1,a1
    685.  &nbsp;rts 
    686. ; End of function Floor_ChkTile
    687. ; end of 'ROM'
    688. ; ---------------------------------------------------------------------------
    689. ; Sprite mappings - Crabmeat enemy (GHZ, SYZ)
    690. ; ---------------------------------------------------------------------------
    691. Map_obj1F:
    692. ; include=_maps\obj1F.asm
    693. ; ---------------------------------------------------------------------------
    694. ; Collision data
    695. ; ---------------------------------------------------------------------------
    696. AngleMap:   BINCLUDE    "collision\Curve and resistance mapping.bin"; floor angle map
    697.  &nbsp;
    698. CollArray1: BINCLUDE    "collision\Collision array.bin"; normal collision array
    699.  &nbsp;
    700. CollArray2: BINCLUDE    "collision\Curve and resistance mapping.bin"; rotated collision array
    701.  &nbsp;
     
  14. stormislandgal

    stormislandgal

    It's not a phase! Tech Member
    4,528
    8
    18
    Married life <3
    The reason why the collision is all messed up is probably, though I'm not sure, becuase you're using the collision array from Sonic 1. The collision arrays between Sonic 1 and Sonic 2 are miles different, so that might be why. As for equivalents:

    "Collarray1" in Sonic 1 is "colarray" in Sonic 2
    "Collarray2" isn't reference from anywhere in the code you ported, from what I can see.
    "AngleMap" in Sonic 1 is "ColCurveMap" in Sonic 2

    As for the art crashing, you have to fix up the mappings. The function "include=" doesn't work with Aurochs' disassembly. So you'll have to manually paste them into the main disassembly file. I'm not sure if you'll have to fix anything on the mappings, but you might have to.
     
  15. .hack//zero

    .hack//zero

    Member
    2,998
    0
    16
    Learning NES ASM, Finding a girlfriend.
    Thanks for the info. I'll try it out after I'm done with EHZ's background from my hack.
     
  16. Hivebrain

    Hivebrain

    Administrator
    2,839
    17
    18
    53.4N, 1.5W
    HiveView
    That's not actually part of the disassembly, it's part of a text file combining program I wrote. You can get it to work with any disassembly if you copy include.exe to the folder and add the appropriate line to build.bat.
     
  17. .hack//zero

    .hack//zero

    Member
    2,998
    0
    16
    Learning NES ASM, Finding a girlfriend.
    Okay, I've basiclly got him ported. The only problem is that I still can't get the art to show up. This proves my guide is going to help out a lot.

    Code (Text):
    1. ; ---------------------------------------------------------------------------
    2. ; Object 1F - Crabmeat enemy (GHZ, SYZ)
    3. ; ---------------------------------------------------------------------------
    4.  
    5. Obj1F: &nbsp; &nbsp;; XREF: Obj_Index
    6.  &nbsp;moveq    #0,d0
    7.  &nbsp;move.b   $24(a0),d0
    8.  &nbsp;move.w   Obj1F_Index(pc,d0.w),d1
    9.  &nbsp;jmp  Obj1F_Index(pc,d1.w)
    10. ; ===========================================================================
    11. Obj1F_Index:    dc.w Obj1F_Main-Obj1F_Index
    12.  &nbsp;dc.w Obj1F_Action-Obj1F_Index
    13.  &nbsp;dc.w Obj1F_Delete-Obj1F_Index
    14.  &nbsp;dc.w Obj1F_BallMain-Obj1F_Index
    15.  &nbsp;dc.w Obj1F_BallMove-Obj1F_Index
    16. ; ===========================================================================
    17.  
    18. Obj1F_Main:     &nbsp;; XREF: Obj1F_Index
    19.  &nbsp;move.b   #$10,$16(a0)
    20.  &nbsp;move.b   #8,$17(a0)
    21.  &nbsp;move.l   #Map_obj1F,4(a0)
    22.  &nbsp;move.w   #$400,2(a0)
    23.  &nbsp;move.b   #4,1(a0)
    24.  &nbsp;move.b   #3,$18(a0)
    25.  &nbsp;move.b   #6,$20(a0)
    26.  &nbsp;move.b   #$15,$19(a0)
    27.  &nbsp;dc.l ObjectFall
    28.  &nbsp;dc.l ObjHitFloor
    29.  &nbsp;tst.w    d1
    30.  &nbsp;bpl.s    locret_955A
    31.  &nbsp;add.w    d1,$C(a0)
    32.  &nbsp;move.b   d3,$26(a0)
    33.  &nbsp;move.w   #0,$12(a0)
    34.  &nbsp;addq.b   #2,$24(a0)
    35.  
    36. locret_955A:
    37.  &nbsp;rts 
    38. ; ===========================================================================
    39.  
    40. Obj1F_Action:   &nbsp;; XREF: Obj1F_Index
    41.  &nbsp;moveq    #0,d0
    42.  &nbsp;move.b   $25(a0),d0
    43.  &nbsp;move.w   Obj1F_Index2(pc,d0.w),d1
    44.  &nbsp;jsr  Obj1F_Index2(pc,d1.w)
    45.  &nbsp;lea  (Ani_obj1F).l,a1
    46.  &nbsp;dc.l AnimateSprite
    47.  &nbsp;dc.l MarkObjGone
    48. ; ===========================================================================
    49. Obj1F_Index2:   dc.w Obj1F_WaitFire-Obj1F_Index2
    50.  &nbsp;dc.w Obj1F_WalkOnFloor-Obj1F_Index2
    51. ; ===========================================================================
    52.  
    53. Obj1F_WaitFire:     &nbsp;; XREF: Obj1F_Index2
    54.  &nbsp;subq.w   #1,$30(a0); subtract 1 from time delay
    55.  &nbsp;bpl.s    locret_95B6
    56.  &nbsp;tst.b    1(a0)
    57.  &nbsp;bpl.s    Obj1F_Move
    58.  &nbsp;bchg #1,$32(a0)
    59.  &nbsp;bne.s    Obj1F_MakeFire
    60.  
    61. Obj1F_Move:
    62.  &nbsp;addq.b   #2,$25(a0)
    63.  &nbsp;move.w   #127,$30(a0); set time delay to approx 2 seconds
    64.  &nbsp;move.w   #$80,$10(a0); move Crabmeat to the right
    65.  &nbsp;bsr.w    Obj1F_SetAni
    66.  &nbsp;addq.b   #3,d0
    67.  &nbsp;move.b   d0,$1C(a0)
    68.  &nbsp;bchg #0,$22(a0)
    69.  &nbsp;bne.s    locret_95B6
    70.  &nbsp;neg.w    $10(a0) ; change direction
    71.  
    72. locret_95B6:
    73.  &nbsp;rts 
    74. ; ===========================================================================
    75.  
    76. Obj1F_MakeFire:     &nbsp;; XREF: Obj1F_WaitFire
    77.  &nbsp;move.w   #$3B,$30(a0)
    78.  &nbsp;move.b   #6,$1C(a0); use firing animation
    79.  &nbsp;dc.l SingleObjLoad
    80.  &nbsp;bne.s    Obj1F_MakeFire2
    81.  &nbsp;move.b   #$1F,0(a1); load left fireball
    82.  &nbsp;move.b   #6,$24(a1)
    83.  &nbsp;move.w   8(a0),8(a1)
    84.  &nbsp;subi.w   #$10,8(a1)
    85.  &nbsp;move.w   $C(a0),$C(a1)
    86.  &nbsp;move.w   #-$100,$10(a1)
    87.  
    88. Obj1F_MakeFire2:
    89.  &nbsp;dc.l SingleObjLoad
    90.  &nbsp;bne.s    locret_9618
    91.  &nbsp;move.b   #$1F,0(a1); load right fireball
    92.  &nbsp;move.b   #6,$24(a1)
    93.  &nbsp;move.w   8(a0),8(a1)
    94.  &nbsp;addi.w   #$10,8(a1)
    95.  &nbsp;move.w   $C(a0),$C(a1)
    96.  &nbsp;move.w   #$100,$10(a1)
    97.  
    98. locret_9618:
    99.  &nbsp;rts 
    100. ; ===========================================================================
    101.  
    102. Obj1F_WalkOnFloor: &nbsp;; XREF: Obj1F_Index2
    103.  &nbsp;subq.w   #1,$30(a0)
    104.  &nbsp;bmi.s    loc_966E
    105.  &nbsp;dc.l SpeedToPos
    106.  &nbsp;bchg #0,$32(a0)
    107.  &nbsp;bne.s    loc_9654
    108.  &nbsp;move.w   8(a0),d3
    109.  &nbsp;addi.w   #$10,d3
    110.  &nbsp;btst #0,$22(a0)
    111.  &nbsp;beq.s    loc_9640
    112.  &nbsp;subi.w   #$20,d3
    113.  
    114. loc_9640:
    115.  &nbsp;jsr  ObjHitFloor2
    116.  &nbsp;cmpi.w   #-8,d1
    117.  &nbsp;blt.s    loc_966E
    118.  &nbsp;cmpi.w   #$C,d1
    119.  &nbsp;bge.s    loc_966E
    120.  &nbsp;rts 
    121. ; ===========================================================================
    122.  
    123. loc_9654:   &nbsp;; XREF: Obj1F_WalkOnFloor
    124.  &nbsp;jsr  ObjHitFloor
    125.  &nbsp;add.w    d1,$C(a0)
    126.  &nbsp;move.b   d3,$26(a0)
    127.  &nbsp;bsr.w    Obj1F_SetAni
    128.  &nbsp;addq.b   #3,d0
    129.  &nbsp;move.b   d0,$1C(a0)
    130.  &nbsp;rts 
    131. ; ===========================================================================
    132.  
    133. loc_966E:   &nbsp;; XREF: Obj1F_WalkOnFloor
    134.  &nbsp;subq.b   #2,$25(a0)
    135.  &nbsp;move.w   #59,$30(a0)
    136.  &nbsp;move.w   #0,$10(a0)
    137.  &nbsp;bsr.w    Obj1F_SetAni
    138.  &nbsp;move.b   d0,$1C(a0)
    139.  &nbsp;rts 
    140. ; ---------------------------------------------------------------------------
    141. ; Subroutine to set the correct animation for a Crabmeat
    142. ; ---------------------------------------------------------------------------
    143.  
    144. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    145.  
    146.  
    147. Obj1F_SetAni:   &nbsp;; XREF: loc_966E
    148.  &nbsp;moveq    #0,d0
    149.  &nbsp;move.b   $26(a0),d3
    150.  &nbsp;bmi.s    loc_96A4
    151.  &nbsp;cmpi.b   #6,d3
    152.  &nbsp;bcs.s    locret_96A2
    153.  &nbsp;moveq    #1,d0
    154.  &nbsp;btst #0,$22(a0)
    155.  &nbsp;bne.s    locret_96A2
    156.  &nbsp;moveq    #2,d0
    157.  
    158. locret_96A2:
    159.  &nbsp;rts 
    160. ; ===========================================================================
    161.  
    162. loc_96A4:   &nbsp;; XREF: Obj1F_SetAni
    163.  &nbsp;cmpi.b   #-6,d3
    164.  &nbsp;bhi.s    locret_96B6
    165.  &nbsp;moveq    #2,d0
    166.  &nbsp;btst #0,$22(a0)
    167.  &nbsp;bne.s    locret_96B6
    168.  &nbsp;moveq    #1,d0
    169.  
    170. locret_96B6:
    171.  &nbsp;rts 
    172. ; End of function Obj1F_SetAni
    173.  
    174. ; ===========================================================================
    175.  
    176. Obj1F_Delete:   &nbsp;; XREF: Obj1F_Index
    177.  &nbsp;dc.l DeleteObject
    178.  &nbsp;rts 
    179. ; ===========================================================================
    180. ; ---------------------------------------------------------------------------
    181. ; Sub-object - missile that the Crabmeat throws
    182. ; ---------------------------------------------------------------------------
    183.  
    184. Obj1F_BallMain:     &nbsp;; XREF: Obj1F_Index
    185.  &nbsp;addq.b   #2,$24(a0)
    186.  &nbsp;move.l   #Map_obj1F,4(a0)
    187.  &nbsp;move.w   #$400,2(a0)
    188.  &nbsp;move.b   #4,1(a0)
    189.  &nbsp;move.b   #3,$18(a0)
    190.  &nbsp;move.b   #$87,$20(a0)
    191.  &nbsp;move.b   #8,$19(a0)
    192.  &nbsp;move.w   #-$400,$12(a0)
    193.  &nbsp;move.b   #7,$1C(a0)
    194.  
    195. Obj1F_BallMove:     &nbsp;; XREF: Obj1F_Index
    196.  &nbsp;lea  (Ani_obj1F).l,a1
    197.  &nbsp;dc.l AnimateSprite
    198.  &nbsp;dc.l ObjectFall
    199.  &nbsp;dc.l DisplaySprite
    200.  &nbsp;move.w   ($FFFFF72E).w,d0
    201.  &nbsp;addi.w   #$E0,d0
    202.  &nbsp;cmp.w    $C(a0),d0; has object moved below the level boundary?
    203.  &nbsp;bcs.s    Obj1F_Delete2; if yes, branch
    204.  &nbsp;rts 
    205. ; ===========================================================================
    206.  
    207. Obj1F_Delete2:
    208.  &nbsp;dc.l DeleteObject
    209. ; ===========================================================================
    210. ; ---------------------------------------------------------------------------
    211. ; Animation script - Crabmeat enemy
    212. ; ---------------------------------------------------------------------------
    213. Ani_obj1F:  dc.w byte_10972A-Ani_obj1F, byte_10972E-Ani_obj1F, byte_109732-Ani_obj1F
    214.  &nbsp;dc.w byte_109736-Ani_obj1F, byte_10973C-Ani_obj1F, byte_109742-Ani_obj1F
    215.  &nbsp;dc.w byte_109748-Ani_obj1F, byte_10974C-Ani_obj1F
    216. byte_10972A:    dc.b $F, 0, $FF, 0
    217. byte_10972E:    dc.b $F, 2, $FF, 0
    218. byte_109732:    dc.b $F, $22, $FF, 0
    219. byte_109736:    dc.b $F, 1, $21, 0, $FF, 0
    220. byte_10973C:    dc.b $F, $21, 3, 2, $FF, 0
    221. byte_109742:    dc.b $F, 1, $23, $22, $FF, 0
    222. byte_109748:    dc.b $F, 4, $FF, 0
    223. byte_10974C:    dc.b 1, 5, 6, $FF
    224.  
    225. ; ---------------------------------------------------------------------------
    226. ; Sprite mappings - Crabmeat enemy (GHZ, SYZ)
    227. ; ---------------------------------------------------------------------------
    228. Map_obj1F:  dc.w byte_1975E-Map_obj1F, byte_19773-Map_obj1F
    229.  &nbsp;dc.w byte_19788-Map_obj1F, byte_1979D-Map_obj1F
    230.  &nbsp;dc.w byte_197B2-Map_obj1F, byte_197D1-Map_obj1F
    231.  &nbsp;dc.w byte_197D7-Map_obj1F
    232. byte_1975E: dc.b 4
    233.  &nbsp;dc.b $F0, 9, 0,  0, $E8
    234.  &nbsp;dc.b $F0, 9, 8,  0, 0
    235.  &nbsp;dc.b 0,  5, 0, 6, $F0
    236.  &nbsp;dc.b 0,  5, 8, 6, 0
    237. byte_19773: dc.b 4
    238.  &nbsp;dc.b $F0, 9, 0,  $A, $E8
    239.  &nbsp;dc.b $F0, 9, 0,  $10, 0
    240.  &nbsp;dc.b 0,  5, 0, $16, $F0
    241.  &nbsp;dc.b 0,  9, 0, $1A, 0
    242. byte_19788: dc.b 4
    243.  &nbsp;dc.b $EC, 9, 0,  0, $E8
    244.  &nbsp;dc.b $EC, 9, 8,  0, 0
    245.  &nbsp;dc.b $FC, 5, 8,  6, 0
    246.  &nbsp;dc.b $FC, 6, 0,  $20, $F0
    247. byte_1979D: dc.b 4
    248.  &nbsp;dc.b $EC, 9, 0,  $A, $E8
    249.  &nbsp;dc.b $EC, 9, 0,  $10, 0
    250.  &nbsp;dc.b $FC, 9, 0,  $26, 0
    251.  &nbsp;dc.b $FC, 6, 0,  $2C, $F0
    252. byte_197B2: dc.b 6
    253.  &nbsp;dc.b $F0, 4, 0,  $32, $F0
    254.  &nbsp;dc.b $F0, 4, 8,  $32, 0
    255.  &nbsp;dc.b $F8, 9, 0,  $34, $E8
    256.  &nbsp;dc.b $F8, 9, 8,  $34, 0
    257.  &nbsp;dc.b 8,  4, 0, $3A, $F0
    258.  &nbsp;dc.b 8,  4, 8, $3A, 0
    259. byte_197D1: dc.b 1
    260.  &nbsp;dc.b $F8, 5, 0,  $3C, $F8
    261. byte_197D7: dc.b 1
    262.  &nbsp;dc.b $F8, 5, 0,  $40, $F8
    263.  
    264. art_obj1F: BINCLUDE &nbsp;"art\nemesis\crabmeat.bin"
     
  18. Varion Icaria

    Varion Icaria

    He's waiting.... Tech Member
    1,010
    0
    16
    S4: Cybernetic Outbreak
    The Mappings don't look converted.... Look at Hive's guide on Sonicology for the S2 format there is a second set of FF and TT for 2P mode, You divide each value by half and place the value as the second FFTT since 2P mode is actually half of the main screen size. Hope this helps.
     
  19. Tweaker

    Tweaker

    Misfit
    12,389
    1
    0
    Also, did you even add the art for the Crabmeat to the pattern load cues? Until you do, you'll never see the art.

    Also make sure you load it to the right place in VRAM, where the object calls it from. You can also change where it reads in VRAM for the art, but for that you'll need to know VDP programming, and I doubt you know anything even relatively related to that.
     
  20. .hack//zero

    .hack//zero

    Member
    2,998
    0
    16
    Learning NES ASM, Finding a girlfriend.
    umm, let's just call this a double post.
     
Thread Status:
Not open for further replies.