Playing Megatizer music with GFABASIC: Difference between revisions

From Atari Wiki
Jump to navigation Jump to search
m (categorise)
No edit summary
 
Line 30: Line 30:
   
   
[[Category:Programming]][[Category:GFA Basic]]
+
[[Category:GFA Basic]]

Latest revision as of 13:23, 13 October 2011

'Whaddaya do if you want to call a -Megatizer- music in GfA-Basic ???
'Peek at this...
'Coded by Jedi of Sector One from The Heavy Killers
'
FILESELECT "\*.thk","",file$  ! Choose a file
IF EXIST(file$)=0             ! Does it exist ???
  EDIT                        ! No => Back to the editor
ENDIF
'
OPEN "i",#1,file$             ! Open the file
len%=LOF(#1)                  ! Length of that file
RESERVE FRE(0)-len%           ! Reserve a part of the memory
music%=MALLOC(len%)           ! Define a buffer ( to put the music )
BGET #1,music%,len%           ! Transfer the datas into the buffer
CLOSE #1                      ! Close the file
'
~XBIOS(&H26,L:music%)         ! Initialize the music
SLPOKE &H4D2,music%+8         ! Play it at each VBL
'
KEYGET zzz%                   ! Wait for a key
'
SLPOKE &H4D2,0                ! Stop playing
~XBIOS(&H26,L:music%+4)       ! Switch off all voices and set back interrupts
SPOKE &H484,15                ! Enable this fuckin' 'Bip' of the keyboard
'
~MFREE(music%)                ! There's no use anymore
EDIT                          ! Back to the editor or desktop

(Editor's note: the calling interface looks similar to Madmax tunes. You probably can play all MAdmax tunes which do not use timer effects with the same method.)