ThomasSpeedrunner icon

Untitled

ThomasSpeedrunner | PRO | 08/08/13 01:31:27 AM UTC | 0 ⭐ | 7909 👁️ | Never ⏰ | []
M68000 Assembler |

0 B

|

None

|

0 👍

/

0 👎

; ===========================================================================
; ---------------------------------------------------------------------------
; Subroutine to find which tile the object is standing on
; d2 = y_pos
; d3 = x_pos
; returns relevant block ID in (a1)
; a1 is pointer to block in chunk table
; ---------------------------------------------------------------------------
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
; loc_1E596:
Floor_ChkTile:
    move.w  d2,d0           ; Store y_pos.
    add.w   d0,d0           ; Double it.
    andi.w  #$F00,d0        ; Round the result.
    move.w  d3,d1           ; Store x_pos.
    lsr.w   #3,d1           ; Do something to it.
    move.w  d1,d4           ; Store it again...? Doesn't make sense...
    lsr.w   #4,d1           ; x_pos/128 = x_of_chunk.
    andi.w  #$7F,d1         ; Do a different something to it.
    add.w   d1,d0           ; Add it to d0.
    ; Now, d0 is the relevant chunk ID.
    moveq   #-1,d1          ; Set d1 to the value "$FFFFFFFF".
    clr.w   d1          ; Uhh...clear d1? This doesn't make sense! Anyway, clear a word from d1.
    lea (Level_Layout).w,a1 ; get level layout
    move.b  (a1,d0.w),d1        ; move 128*128 chunk ID to d1
    add.w   d1,d1           ; double it (?)
    move.w  word_1E5D0(pc,d1.w),d1  ; Get the value for the chunk from the table of precalculated ones (huge improvement from S1 in my opinion).
    move.w  d2,d0           ; store y_pos
    andi.w  #$70,d0         ; do something to it
    add.w   d0,d1           ; Add it to d1.
    andi.w  #$E,d4          ; Divide the previously stored x_pos by 8.
    add.w   d4,d1           ; Add it to d1.
    movea.l d1,a1           ; Using d1, get the address of the block ID.
    rts             ; Go back to whatever we were doing before running this routine.
; ===========================================================================

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎