Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sound effects?
#16
LTee Wrote:Hmm... or maybe not. Something's not *quite* right still. The music will play once, but it doesn't exit properly at the end of the tune (or if you press a key) - the Spectrum locks up rather than ending play gracefully.

I'll paste what I've been messing around with, maybe someone else can see what the issue is:
I would say, the issue is the ASM data and the RET from ASM, before PLAY_MUSIC label.
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:
Code:
Procedure
  ASM Routine (without RET), JP to [ASM Label Ending] replaces RET
  [ASM label data]:
    All Data
  [ASM Label Ending]:
    Again no RET! This is empty or ending code
END Procedure
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply
#17
LCD Wrote:I would say, the issue is the ASM data and the RET from ASM, before PLAY_MUSIC label.
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:
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.

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! Tongue

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
Reply
#18
Okay, thats true, but the posted code cannot use the implicit RET at the end of procedure in present form, because it has ASM Data before the end, and the real RET is only few bytes after start. It needs more modifications to use fastcall, but if the routines are written with fastcall in mind, it will work much better.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply
#19
oblo Wrote:Hi all

LTee, How a song created with Beepola can be integrated in ZX Basic? I don't know how to handle the .bbsong format in Basic.

Thanks and regards
Hi oblo,

You don't have to handle the bbsong format yourself, you can get Beepola to export the song and a player as executable code. On Beepola's 'tools' menu, select 'Compile Song' and you can export in a variety of formats that you can use elsewhere. I compile to a code block only .tap file using an address high in memory (away from ZX Basic code) and then call it with RANDOMIZE USR xxxxx from within my game code (although there are a couple of quirks at the minute, see http://www.boriel.com/forum/help-support...-t633.html).

Hope that helps!
Reply
#20
boriel/LCD - interesting stuff. Maybe I can make that way work after all? I think I'll go back to running a few experiments, as it's nicer to do it this way than having to hack .tap files together at the end. Thanks for the info!
Reply
#21
LTee Wrote:boriel/LCD - interesting stuff. Maybe I can make that way work after all? I think I'll go back to running a few experiments, as it's nicer to do it this way than having to hack .tap files together at the end. Thanks for the info!
Surely it can be done. The first version of ODINs proportional font routine was crashing too on return, so the solution was to rearrange add some JP and labels to jump to the end of procedure after all the data. Nothing is impossible.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply
#22
LTee Wrote:
oblo Wrote:Hi all

LTee, How a song created with Beepola can be integrated in ZX Basic? I don't know how to handle the .bbsong format in Basic.

Thanks and regards
Hi oblo,

You don't have to handle the bbsong format yourself, you can get Beepola to export the song and a player as executable code. On Beepola's 'tools' menu, select 'Compile Song' and you can export in a variety of formats that you can use elsewhere. I compile to a code block only .tap file using an address high in memory (away from ZX Basic code) and then call it with RANDOMIZE USR xxxxx from within my game code (although there are a couple of quirks at the minute, see http://www.boriel.com/forum/help-support...-t633.html).

Hope that helps!


Thanks, good post about it Smile I was thinking to define a bi-dimensional array, one for the pitch and the other for with the duration; then, put a BEEP x,y: x+1:y+1 in every game loop, but it looks like your solution is more elegant Smile

Cheers
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)