Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; swap using just A + stack
- .macro swapa mema, memb
- lda mema
- pha
- lda memb
- sta mema
- pla
- sta memb
- .endmacro
- .proc ChkTouch16x16 ; Carry is set if collision is detected between TouchLeftA,TouchTopA and TouchLeftB,TouchTopB
- jsr :+
- swapa TouchLeftA, TouchLeftB
- swapa TouchTopA, TouchTopB
- jsr :+
- clc ; no collision
- rts
- : lda TouchLeftB
- add #16
- sta TouchRight
- lda TouchTopB
- add #16
- sta TouchBottom
- lda TouchLeftA
- cmp TouchLeftB
- bcc :+
- lda TouchLeftA
- cmp TouchRight
- bcs :+
- lda TouchTopA
- cmp TouchTopB
- bcc :+
- lda TouchTopA
- cmp TouchBottom
- bcs :+
- pla
- pla
- sec ; collision detected
- : rts
- .endproc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement