24 October 2021, 17:45 | #1 |
Registered User
Join Date: Sep 2021
Location: Norway
Posts: 20
|
Playing a module from INCBIN in AmiBlitz 3.8
I'm banging my head on this.
This code works in BB2.1 and plays the song, but in AmiBlitz3.8 the song isn't played. There are no errors, just quiet. Any thoughts on this? Code:
fastmem.b=AvailMem_(4) ; 4=fast, 2=chip If fastmem ; is fastmem available? if so, better copy the module to chipmem music_length.l=?title_music_end-?title_music_start InitBank 0,music_length,2 dn.l=0 For dn=0 To music_length-1 Step 4 Poke.l Bank(0)+dn, Peek.l(?title_music_start+dn) Next MTInit 0,0 Else ; if no fastmem is detected, the module must be in chipmem MTInit ?title_music_start,0,0 EndIf MTPlay On MouseWait MTEnd If fastmem FreeBank 0 EndIf End title_music_start: IncBin "files/title.mod" title_music_end: |
25 October 2021, 16:21 | #2 |
Registered User
Join Date: Mar 2018
Location: Austria
Posts: 617
|
Seems like (unlike in older versions of Blitz) now it's needed to use the MTInstall command before using the mtInit command.
Code:
mtInstall True; true..pal false..ntsc FreeBank throws a "Program Error 8000.002B" every time here. Which is "Trap Vector. Pgm out of control." So I guess, we just omit it? Oh, and maybe you should add something like "4" to music_length at InitBank to avoid overwriting unallocated memory in the loop... Regards, Stefan Edit: And also note that the vbr must not be moved IIRC, otherwise ptPlayer is muted/doesn't play. This did cost me a few hours in the past to find out. Last edited by Nightshft; 25 October 2021 at 16:47. |
29 October 2021, 08:51 | #3 | |||
Registered User
Join Date: Sep 2021
Location: Norway
Posts: 20
|
Quote:
Quote:
Quote:
Thanks for the reply. |
|||
29 October 2021, 12:39 | #4 |
Registered User
Join Date: Mar 2018
Location: Austria
Posts: 617
|
Vbr is the (Interrupt) Vector Base. It is possible to move it from adress zero (chipram) to fastmem for some (small) speed gain.
Tools like vbrMove (link) do this. When you compile and run a program in debug mode in AB3, the debugger complains if you don't have the vbr moved. That's why I have put vbrMove in my AB3 startup script in the first place. But AFAIK there's a bug in the ptPlayer library (or core) and it's muted when the vbr-adress is moved, so it should just stay untouched/at the default zero adress when using ptPlayer. Check if your debugger complains about the vbr. It should. |
29 October 2021, 18:44 | #5 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
At the beginning you have to call _mt_install_cia with the VBR in a0 and a PAL/NTSC-flag in d0. The Blitz Basic MTinstall function probably passes the PAL-flag and calls that _mt_install_cia core function. But who knows what it passes for VBR... |
|
10 November 2021, 22:31 | #6 | |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
Quote:
https://github.com/idrougge/blitz_ptplayer |
|
11 November 2021, 11:27 | #7 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Code:
movem.l a3-a6,-(sp) lea CUSTOM,a6 move.l #0,a0 Your only option would be to insert an Exec Supervisor()call here, to switch to supervisor mode and read the VBR with movecon 68010 and greater. So it is a hack, but you could replace the code from above with this: Code:
movem.l a3-a6,-(sp) sub.l a0,a0 move.l 4.w,a6 btst #0,297(a6) ; check for 68010 beq .novbr lea getvbr(pc),a5 jsr -30(a6) ; Supervisor() .novbr: lea CUSTOM,a6 Code:
mc68010 getvbr: movec vbr,a0 rte mc68000 |
|
11 November 2021, 17:43 | #8 | |
Registered User
|
Quote:
There are multiple (though rare) occasions where your code will fail, e.g. running NoFastMem AFTER starting your program. In that case, your code and module will be in fast RAM, but AvailMem for MEMF_FAST will return 0, therefore not copying module to chip RAM, although it would be needed. EDIT: Also note that your executable (and thus module) could be in chip RAM, even if there is fast RAM available. For example, there is only 40KB of continuous fast RAM available, but your executable needs, let's say 48KB of continuous memory, then it will be loaded to chip RAM, causing an unnecessary copy of the module. Last edited by BastyCDGS; 11 November 2021 at 17:49. Reason: Mention the other way around |
|
12 November 2021, 13:09 | #9 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
I rebuilt the library with this. I don't have an Amiga handy, could someone with a moved VBR have a go?
I updated the rest of the library to the latest 6.1 from aminet while I was at it. https://github.com/E-Penguin/blitz_ptplayer Last edited by E-Penguin; 13 November 2021 at 11:58. Reason: removed attachement, now use link to github |
13 November 2021, 12:20 | #10 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
So, yes, I can confirm the updated library no longer causes BB2 to crash at MTInstall.
The library is ~2kb larger than idrougge's, I dunno if that'd due to vasm options or because ptplayer has grown between v5 and v6.1 I used this to assemble it: Code:
vasm -phxass -Faout ptplayer.asm |
15 November 2021, 19:41 | #11 |
Registered User
Join Date: Nov 2019
Location: Celle / Germany
Posts: 145
|
It is possible to change the libnumber from #195 or #48?
The older release had that number when I remember correctly. #195 is within a range of Lotan's blitzlib collection, in this case LotanArgs. |
15 November 2021, 20:05 | #12 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Quote:
Blitz Basic requires object files in a.out format, not hunk-format? |
||
16 November 2021, 00:12 | #13 | ||
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
Quote:
Quote:
I tried -Fhunk and it's smaller but it crashes WinUAE. btw -Fhunkexe doesn't assemble. I have to confess to being a monkey pushing buttons here, I'm not really sure what I'm doing. |
||
16 November 2021, 01:16 | #14 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Hmm...
Quote:
Quote:
|
||
16 November 2021, 14:46 | #15 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
I got -Fhunkexe working, there were some undefined symbols in the original, and a whole load of missing stubs used to save/restore a3-a6 (which blitz needs to be unaltered).
However, I don't know what's going on now, nothing works and WinUAE crashes when I try to compile anything... I fear I've broken my install and will need to start again. Anyway, @Honitos I've changed the library number to 48. ------------------------------------------- Edited to add; I found the magic sauce on a thread here, the correct vasm options are: Code:
vasmm68k_mot.exe -devpac -Fhunkexe -kick1hunks -nosym ptplayer.asm -o ptplayer.obj Whilst I was at it, I added blitz functions for _mt_loopfx (MTLoopFx) and mt_stopfx (MTStopFx). The former takes a SfxStructurePointer which is described in the source; I've not created a .res for it. Last edited by E-Penguin; 16 November 2021 at 15:22. Reason: fixed it! |
16 November 2021, 15:10 | #16 |
Registered User
Join Date: Nov 2019
Location: Celle / Germany
Posts: 145
|
Thanks!
Gesendet von meinem SM-P610 mit Tapatalk |
05 December 2021, 13:06 | #17 | |
Registered User
Join Date: Jan 2009
Location: Barcelona / Spain
Posts: 432
|
Thanks for compilib the lib to Blitz, I am planning to use it for the next version of the Redpill game creator.
Everything goes smoothly except the MTStopFx function,which it's giving me some trouble when it's not in the main blitz source file. It's weird but maybe I am doing something wrong with deflibs... Quote:
|
|
09 December 2021, 16:51 | #18 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
what errors are you getting? I have to confess I've not tried the two functions I added
|
10 December 2021, 08:39 | #19 | |
Registered User
Join Date: Jan 2009
Location: Barcelona / Spain
Posts: 432
|
Quote:
As said, it could be my fault at generating deflibs |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Toy Story on Megadrive playing Amiga module | Galahad/FLT | Nostalgia & memories | 6 | 23 September 2019 23:23 |
Playing a protracker module? | mcgeezer | Coders. Asm / Hardware | 15 | 07 May 2018 09:58 |
Playing module makes shapes to flicker | Shatterhand | Coders. Blitz Basic | 34 | 07 February 2017 08:22 |
HippoPlayer very slow down system when playing module | michaljarz | support.WinUAE | 6 | 21 February 2016 20:34 |
blitz incbin.. | yoki | Coders. General | 5 | 03 April 2009 12:29 |
|
|