;***************************************************************************** ; MORNING.ASM - by David Kühling 1998 * ;----------------------------------------------------------------------------* ; This is an example for the SoundLib sound library. It plays the song * ; "Morning Has Broken" by Cat Stevens. * ; * ; Last modification: 13.8.1998 * ; * ; Contacting me: * ; Email: dkuehlin@hell1og.be.schule.de (don't mix up 'l' and '1') * ; - valid till june 2000 * ; Mail: * ; David Kühling * ; Lion-Feuchtwanger-Str. 44 * ; 12619 Berlin * ; GERMANY * ; * ;***************************************************************************** INCLUDE "flib.h" INCLUDE "tios.h" INCLUDE "soundlib.h" XDEF _main XDEF _comment ;----------------------------------------------------------------------; ; Callback routine for soundlib::Play. It sets d4, if the ON key is ; ; hold down. This will cause soundlib::Play to exit ; ;----------------------------------------------------------------------; SoundCallback: btst.b #1,$60001A ; test the ON key seq d4 ; set d4, if it is zero (0 = down; 1=up) rts ;----------------------------------------------------------------------; ; MAIN ; ; Initializes Soundlib, display's some text and plays the song. ; ;----------------------------------------------------------------------; _main: jsr soundlib::Init ; initialize Soundlib jsr flib::clr_scr pea PressOn(PC) ; display some text in the status line jsr tios::ST_showHelp addq.l #4,a7 ; BYTE FontSetSys(BYTE font) move.w #1,-(a7) jsr tios::FontSetSys ; void DrawStrXY(WORD x, WORD y, BYTE *string, WORD color) move.w #4,-(a7) ; display some other text pea Str1(PC) move.l #$000A0032,-(a7) jsr tios::DrawStrXY move.w #4,-(a7) pea Str2(PC) move.l #$000A003C,-(a7) jsr tios::DrawStrXY lea 22(a7),a7 ; remove all those arguments clr.b tios::OSOnBreak ; clear the ON key flag lea Tune(PC),a0 ; load address of tune lea SoundCallback(PC),a1 ; load address of callback routine jsr soundlib::Play ; play the tune rts ;----------------------------------------------------------------------; ; Tune data ; ;----------------------------------------------------------------------; Tune: dc.b TEMPO, 120 ; set the tempo to 120 beats/minute dc.b NOTED, 240 ; set the note fill duration to 240 dc.b _D4,32,_F#4,32,_A4,32,_D5,96,_E5,96, dc.b _C#5,32,_B4,16,_A4,48,_B4,48,_C#5,16,_B4,32,_A4,96 dc.b _D4,32,_E4,32,_F#4,32,_A4,96,_B4,96 dc.b _A4,32,_E4,16,_E4,48,_E4,160,PAUSE,32 dc.b _A4,32,_F#4,32,_A4,32,_D5,96,_B4,96 dc.b _A4,32,_F#4,32,_D4,32,_D4,96,_E4,96 dc.b _F#4,32,_E4,32,_F#4,32,_A4,96,_B4,96 dc.b _E4,32,_F#4,48,_E4,16,_D4,160,PAUSE,32 dc.b TEND PressOn: dc.b "Hold the [ON]-Key down to abort",0 Str1: dc.b '"Morning Has Broken" by Cat Stevens',0 Str2: dc.b "Ported to Soundlib by David Kühling",0 _comment: dc.b "Sound: Morning Has Broken",0 END