07-15-2011, 07:54 AM
LCD Wrote:I would say, the issue is the ASM data and the RET from ASM, before PLAY_MUSIC label.That's right :!: However, it's possible to use directly RET by telling the compiler this is a "non standard procedure nor function". Standard procedure and functions deals with the stack to take parameters (as many as the user wants) and local variables, and need to clean up the stack upon return or the program will crash.
this is a procedure, so RET would not return back to BASIC but to nirvana, and the ASM datas at the end would prevent correct returning further. I faced the same problem. The solution looks so:
If you want it to make completely "ASM compatible" use FASTCALL, but then you will need to deal yourself with parameters and return value. Since this is a procedure with NO parameters and NO return value, there's nothing to do, just pure ASM!

Code:
Procedure FASTCALL ProcedureName
;; ASM Routine (without RET), JP to [ASM Label Ending] replaces RET
You can use RET here now
[ASM label data]:
All Data
[ASM Label Ending]:
You can use RET here, but it's needless since there is an implicit RET
at the END Procedure
END Procedure