Hi,
I'm currently developping a BASIC game with a background music.For it I hacked PlayerAkgTester_CPC.asm from Arkos Tracker 2
https://github.com/renaudhelias/tron-pixel (https://github.com/renaudhelias/tron-pixel) <= PlayerAkgTester_CPC.asm file + TRON-PIXEL.dsk
For that I :
- added 3 jumps at begin of asm, for calling them from BASIC (Start/call &4000, StartMusic/call &4003, StopMusic/call &4006) as done on BasicAkgTester_CPC.asm, and added (merge) btw "StopMusic" feature
- add a "ret" at end of main asm program (Start/call &4000)
- install during the Start the personalized instruction vector (asm label Sync) at #38/#39
- removed the VSYNC detection, and set a "compteur" variable counting from 5 downto 0, launching PLY_AKG_Play 1 time per 6.
- call the original BASIC interruption vector (jp #B941) at end of my personalized interruption vector
After a call to &4000, I return to BASIC, but music stop. And run back while launching instructions like "list" or "40 goto 40"/"goto 40".
So music does run quite fine while my BASIC program runs (that's cool), but has some latency.
I know that it is makable : at ReSeT#20, Chemin by Madram / Overlanders does return to BASIC if I press "ESC".
What do I miss :picard2: ?
Finally I used LASER BASIC to compile all of that into a .BIN ;D
I don't really understand what your code is trying to achieve, but you can NOT have a safe Basic program along with a redirection of the #38 jump.
In Basic, simply use the firmware for it to call your asm code (music code, for example) every 50 or 300hz.
Check my answer here (http://www.cpcwiki.eu/forum/programming/cpc-drivers-16348/msg181145/#msg181145) with links to a program that does that.
https://www.youtube.com/watch?v=6rxwH9OKupU (https://www.youtube.com/watch?v=6rxwH9OKupU)
Thanks, it runs :)
Good! But what is the point in using compiled basic?
Just a quick note: &4000-1 = &3fff, not &3999 :).
Quote from: Targhan on 15:30, 07 December 19
Good! But what is the point in using compiled basic?
I subscribed a dev challenge in Facebook group called "Amstrad CPC pour toujours and beyond !" (French/English/Spanish)
I'm currently developping a simple Tron game, using compiled basic the game is about 10 times faster (and then cool to play with)
My game got a special stuff, Tron does walk only if one of both player does move joystick. If one player does move its snake, the other snake does move also. If both does stop using joystick, snakes does stop.
Sound track is played after level loaded, until end of level.
https://github.com/renaudhelias/tron-pixel (https://github.com/renaudhelias/tron-pixel) (wip)
I implemented 8 levels. I'm currently writing the sound track "Game of Thrones" on it (using StarKos v1.21 on my MiST-board). It's the first time I use a sound tracker by myself.
I show that CPC-Power did subscribe also, the challenge does end in march, I think you can subscribe until end of december something like that.
Always sounds interesting to me what others can code in other languages.