AmiBlitz / AmiBlitz3

Complete package of AmiBlitz3 including all sources.
https://www.amiblitz.de/
123 stars 9 forks source link

ciatrackerlib: Mungwall hit when freeing a module #3

Closed deuteros76 closed 2 years ago

deuteros76 commented 4 years ago

The debugger shows an error when executing a program using ciatrackerlib to play music. Indeed, the problem arises when FreeTrackerModule is called.

The example code is the following, the repository below contains the module used in this program:

; Load a module, set the volume and use the first three channels
ModuleLoaded = LoadTrackerModule  (0,"galgox-blastoff.mod")
If ModuleLoaded
    TrackerVolume 64
    ModulePlaying = StartTracker (0) 
    If ModulePlaying
        ChangeTrackerMask 1+2+3
    EndIf
EndIF 

VWait 200

;Stop the musix and free the module resources
If ModulePlaying
    Stoptracker
EndIf
If ModuleLoaded
    FreeTrackerModule 0
EndIF

https://github.com/deuteros76/Blitz-Basic-Music-Example

After four seconds of music the error shown is this

image

Tested using Amiblitz3 3.7.0 and 3.7.2 under FS-UAE 2.8.3 on Linux


# FS-UAE configuration saved by FS-UAE Launcher
# Last saved: 2019-12-19 22:35:10
[fs-uae]
amiga_model = A1200/3.0
bsdsocket_library = 0
chip_memory = 2048
cpu = 68030
fast_memory = 8192
floppy_drive_speed = 400
hard_drive_0 = amigawave.hdf
hard_drive_1 = Exchange
hard_drive_2 = Work
kickstart_file = KICK_unamiga.rom
zorro_iii_memory = 32768
stevetronic commented 4 years ago

Tried it here and it happens too (Amiblitz 3.7.3, Winuae) If I load but don't start the track it does not happen. Maybe starting/playing the track with xbCiaTrackerLib trashes some memory ?

looks like this has been spotted before...

stevetronic commented 4 years ago

A quote from xbCiaTrackerLib.guide/bugs: Because of some unknown problem, the routine actually reserves 3 bytes of memory (added to the actual module size.) Keep this in mind when calling the function to find out the byte-size of a module.

I'm not experienced in Amiga debugging and do not know if this explains the mungwall hit.

honitos commented 4 years ago

I added ptplayerlib as a replacement for CIATRACKERLIB, as the latter needs kick2.0.