
Black Magic Composer14
© 1991 Ulf Petersen/Sven Tegethoff PDFied by Alphasys in 2010
graphics mode change is to inform Basic about the lowered memory top, and to free the memory area
by moving the graphics data to it's new, lower, location, making the area above it free to use. Make
sure your basic program will still function with the lesser memory!
This way works for Atari-Basic, aswell as for Turbo-Basic. (But Turbo-Basic will give you a higher
memory location, more memory, and higher overall execution speed.)
19 Using songs in Assembly
Using songs within Assembly, is somewhat easier than using it in basic, because you can use any
starting adress, aslong as it goes along with system equates and your program.
Calling the sound routine will work best from the VBlank interrupt. But for good order, a call to it every
50th of a second should do. Before running a tune, it should be initialised anyway, which will also
select the song to play.
If a song has samples, the according routine should also be called from the main program. It'll play
the digi sounds untill a flag called "STOP" is set to a non-zero value. This flag is located at the
module start adress+9. The only thing to keep in mind otherwise, is that the quality of the samples
degrade by lessening the CPU load, aswell as the complexity of the display list.
A simple assembly program to call the sound module would be something like this, in BIBO-
Assembler:
00010 ; Starting adress of the music module = $4000
00020 ; Song #1 has samples!
00030 ;
00040 .or $0600
00050 ;
00060 INIT LDA #1 ;Initialise music routine, song is=1
00070 JSR MROUT
00080 LDA #VBI ;Set Vertical Blank Interrupt
00090 STA 548
00100 LDA /VBI
00110 STA 549
00120 LDA #0 ;Stop flag. Clear before running a song.
00130 STA STOP
00140 JSR MROUT+6 ;Play samples (Until STOP is set)
00150 LDA #$E4 ;Reset VBI vector
00160 STA 549
00170 LDA #$62
00180 STA 548
00190 LDA #0 ;Silence tone generators.
00200 JSR MROUT
00210 RTS
00220 ;
00230 VBI JSR MROUT+3 ;Call music routine
00240 LDA 53279
00250 CMP #6 ;Start pressed?
00260 BNE .1 ;Local label use
00270 LDA #1
00280 STA STOP
00290 .1 JMP $E462 ;Continue with the original VBI routine.
00300 ;
Komentáře k této Příručce