CompuServe Thread

#DoCollision

3 messages in this thread
#105225From: Kevin KelmJan 25, 1988 10:02 AM
I got real SICK of messing with SetCollision in Modula-2, so I wrote an Assembly Language program to pass to SetCollision. Somehow, though, it drops mew back to CLI when I do a DoCollision. Check it out and tell me what I'm doing wrong: start MOVEM.L D0/D1/A0/A1/A6, -(A7) LINK A6, #0 MOVE.L 4(A6), A0 ; GET ADR OF VSPRITE #1 MOVE.L 8(A6), A1 ; GET ADR OF VSPRITE #2 MOVE 58(A0), D0 ; GET BOB ID # FROM VUSEREXT MOVE 58(A1), D1 ; " " " " " " MOVE.L #data, A0 ; SET BASE DATA ADR MOVE D1, 0(A0, D0.L) ; PUT #1'S ID IN #2'S HIT REG MOVE D0, 0(A0, D1.L) ; PUT #2'S ID IN #1'S HIT REG UNLK A6 MOVEM.L (A7)+, D0/D1/A0/A1/A6 RTS data DC.W $0 DC.W $0 DC.W $0 ; THESE ARE THE HIT REGS… DC.W $0 DC.W $0 DC.W $0 DC.W $0 DC.W $0 Sorry I left out then END's. The source compiles alright, but kicks out when it runs. Does ANYBODY know what I !#!#@#@$'d up? Any & all responses will be greatly appreciated. Thank You, Kevin.
#105304From: Glenn NielsenJan 25, 1988 7:15 PM
Kevin, From looking at your code, it appears that you are calling this from C, if so: 1. The MOVEM at the start of the routine changed the stack pointer, and would have to be accounted for in retrieving the values from the stack. 2. #1 implies that you should have done the LINK before the MOVEM, if you had done that, the first value passed on the stack would have been at an offset of 8. 3. Since you don't use the local stack frame, you could get rid of the LINK and UNLK instructions. 4. Since the system expects registers d0,d1,a0,a1 to get trashed, and you don't need a local stack frame, there is no need to do the save and restores to the stack using MOVEM. 5. So, if you remove both the local stack frame and the register save/ restore, you can get the first value passed on the stack at an offset of 4(a7). Good luck, hope this helps get you started. <Glenn
#105546From: Kevin KelmJan 26, 1988 8:21 PM
Thanks much. I'm pretty new at 68K asm, the help is appreciated. Actually, though, I'm calling it fro Modula-2. Since Modula is SUCH a pain about stuff like that, I loaded the code into an array of words and passing starting address directly to the collHandler list as an ADDRESS. What a PAIN! Thanks for the help, Kevin.