Last active
April 17, 2024 19:43
-
-
Save johngirvin/75da8854aa91052e08956e9e558f2dca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 68000 2xCMP AABB check between box A and B | |
; | |
; d0=ax1,ay1 coordinates of top-left of A | |
; d3=bx2,by2 coordinates of bottom-right of B | |
; d5=-(aw+bw) -(A width + B width) | |
; d6=-(ah+bh) -(A height + B height) | |
sub.w d3,d0 ;d0=ay1-by2 | |
cmp.w d6,d0 ;cmp #-(ah+bh) | |
bls .cd_done1 ;Skip if Y out of range | |
swap d0 ;Get ax1-bx2 in d0 | |
swap d3 | |
sub.w d3,d0 | |
cmp.w d5,d0 ;cmp #-(aw+bw) | |
bls .cd_done0 ;Skip if X out of range | |
; Handle Collision | |
... | |
.cd_done0: | |
swap d3 ;restore d3=bx2,by2 | |
.cd_done1: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment