; Synthlab NDA player ; Copyright 1990 Parik Rao, All Rights Reserved keep z mcopy macs/synth.macs LoadID gequ 1 LoadInstID gequ 2 PlayID gequ 3 SaveID gequ 4 RecordID gequ 5 StopID gequ 6 MidiInputID gequ 7 KeyWaitID gequ 8 MetronomeID gequ 9 TempoScrollID gequ 10 VelCmpScrollID gequ 11 InstPopUpID gequ 12 VolScrollID gequ 13 RecTrackID gequ 14 SongNameID gequ $8000 AboutTextID gequ $8001 TempoTextID gequ $8002 VelCompTextID gequ $8003 VolTextID gequ $8004 NDA START PLAYER dc i4'Open' dc i4'Close' dc i4'Action' dc i4'Init' dc i2'0' period dc i2'$FFFF' action mask dc c'##SynthLAB',h'AA',c' Player\*``H**',h'0' Open anop DataBank equ 1 ReturnAddress equ DataBank+1 Result equ ReturnAddress+3 phb phk plb lda WindowOpen bne WAlreadyOpen jsr SetUpWindow lda WindowPtr sta Result,s lda WindowPtr+2 sta Result+2,s _InitCursor WAlreadyOpen plb rtl SetUpWindow anop _WaitCursor jsr InitVars PushWord #0 PushWord #$5000 _GetNewID pla sta ProgramID ora #$100 sta MemoryID PushLong #0 PushLong #$100 PushWord MemoryID PushWord #$C015 PushLong #0 _NewHandle pla sta 0 pla sta 2 lda [0] sta OurDP stz MSStarted stz SoundStarted stz SFStarted stz SFStarted PushWord #0 _SoundToolStatus pla bne SoundOn ldx #8 ldy #0 jsr Load_A_Tool PushLong #0 PushLong #$100 PushWord MemoryID PushWord #$C015 PushLong #0 _NewHandle pla sta 0 pla sta 2 lda [0] pha _SoundStartUp inc SoundStarted SoundOn PushWord #0 _MSStatus pla bne MSOn ldx #35 ldy #0 jsr Load_A_Tool _MSStartUp inc MSStarted MSOn PushWord #0 _SFStatus pla bne SFOn ldx #$17 ldy #$300 jsr Load_A_Tool PushWord MemoryID PushLong #0 PushLong #$100 PushWord MemoryID PushWord #$C015 PushLong #0 _NewHandle pla sta 0 pla sta 2 lda [0] pha _SFStartUp inc SFStarted SFOn anop jsr Load_MIDI lda #1 sta AlreadyOpen ldx #0 MoveTempoTxt lda TempoText,x sta Text081111,x inx inx cpx #10 bne MoveTempoTxt ldx #0 MoveVelTxt lda VelocityText,x sta Text0B1111,x inx inx cpx #26 bne MoveVelTxt ldx #0 MoveVolTxt lda VolText,x sta Text121111,x inx inx cpx #12 bne MoveVolTxt PushLong #0 PushLong #WINDOW1111 _NewWindow lda 1,s sta WindowPtr lda 3,s sta WindowPtr+2 _SetSysWindow PushLong #0 _GetPort PushLong WindowPtr _SetPort PushLong #0 PushLong WindowPtr PushWord #3 PushLong #WINDOWCONTROLLIST1111 _NewControl2 pla pla PushLong #SBarAction lda #0 pha pha pha pha PushLong #TempoScrollID _GetCtlHandleFromID _SetCtlAction PushLong #SBar2Action lda #0 pha pha pha pha PushLong #VelCmpScrollID _GetCtlHandleFromID _SetCtlAction PushLong #SBar3Action lda #0 pha pha pha pha PushLong #VolScrollID _GetCtlHandleFromID _SetCtlAction ldx #1 SetLoop1 phx turn off all radio buttons lda #0 jsr SetCtlValue plx inx cpx #VelCmpScrollID+1 bne SetLoop1 ldx #TempoScrollID lda #55 jsr SetCtlValue ldx #VolScrollID lda #127 jsr SetCtlValue ldx #0 SetLoop1a stz PUItitle09111100,x inx inx cpx #16*16 bne SetLoop1a ldx #3 SetLoop2 phx enable load song & inst, disable rest lda #255 jsr SetCtlHilite plx inx cpx #RecTrackID+1 bne SetLoop2 PushWord #0 _SetVelComp lda MidiActive if midi off, turn off load inst bne SetLoop3 lda #255 ldx #2 jsr SetCtlHilite SetLoop3 PushLong WindowPtr _DrawControls _SetPort lda #$FFFF sta WindowOpen rts CheckSave lda SaveStatus beq CheckSaveEnd stz SaveStatus lda #0 pha pha pha pha PushLong #SaveAlert _AlertWindow pla bne CheckSaveEnd phd lda OurDP tcd jsr SaveSong pld CheckSaveEnd rts Close anop phb phk plb lda WindowOpen beq WNoClose Close_2 anop jsr CheckSave jsr TurnToolsOff PushLong WindowPtr _CloseWindow PushWord MemoryID _DisposeAll stz WindowOpen WNoClose lda #0 plb rtl TurnToolsOff lda MSStarted beq Close_3 _MSShutDown stz MSStarted Close_3 lda SoundStarted beq Close_4 _SoundShutDown stz SoundStarted Close_4 lda SFStarted beq Close_5 _SFShutDown stz SFStarted Close_5 rts Action anop phb phk plb cmp #1 beq HandleAction lda #0 plb rtl HandleAction anop phy phx PushLong #TaskRecord PushLong #16 _BlockMove PushLong #0 PushLong #TaskRecord _TaskMasterDA pla cmp #$21 bne NotwControl jmp WControl NotwControl cmp #$06 beq HandleRedraw cmp #$03 beq HandleKeyDown cmp #$08 bne HandleActionE HandleRedraw jsr WindowDraw HandleActionE lda #0 plb rtl HandleKeyDown lda TaskModifiers and #$100 beq HandleActionE lda TaskMessage and #$5F cmp #'W' beq HKD_Close ldx SynthMode cpx #3 beq HandleActionE cmp #'L' beq HKD_LoadSong cmp #'I' beq HKD_LoadInst cpx #0 beq HandleActionE cmp #'P' beq HKD_Play cmp #'S' beq HKD_Save bra HandleActionE HKD_Close PushWord #0 PushLong #HKD_CloseDo _SchAddTask pla lda #0 plb rtl HKD_LoadSong ldx #0 bra WControl2 HKD_LoadInst ldx #2 bra WControl2 HKD_Play ldx #4 bra WControl2 HKD_Save ldx #6 bra WControl2 HKD_Record ldx #8 bra WControl2 WControl anop lda TaskData4 beq WControlEnd cmp #VelCmpScrollID beq WControl4 cmp #InstPopUpID beq WControl3 cmp #MIDIInputID+1 bcs WControlEnd dec a asl a tax WControl2 tsc sta Stack phd tdc sta DP lda OurDP tcd jsr (WControlTbl,x) pld WControlEnd lda #0 plb rtl WControl3 jsr SetBasicChan bra WControlEnd WControl4 ldx #VelCmpScrollID jsr GetCtlValue pha _SetVelComp bra WControlEnd HKD_CloseDo phb phk plb PushLong WindowPtr _CloseNDAbyWinPtr plb rtl WControlTbl dc a'LoadSong' 0 dc a'LoadInst' 2 dc a'PlaySong' 4 dc a'SaveSong' 6 dc a'RecordSong' 8 dc a'StopRecord' 10 dc a'MIDIInput' 12 RecordSong anop lda #1 sta SaveStatus jsr Turn_Off_Song lda #3 sta SynthMode ldx #1 RecordSongz phx lda #255 jsr SetCtlHilite plx inx cpx #RecTrackID+1 bne RecordSongz ldx #StopID lda #0 jsr SetCtlHilite ldx #InstPopUpID lda #0 jsr SetCtlHilite PushWord #192 _SetBeat ldx #TempoScrollID jsr GetCtlValue asl a sec sbc #10 pha _SetTempo jsr SetBasicChan PushWord #$FFFF PushWord #0 _SetMIDIPort PushLong #0 PushLong #$020000 PushWord MemoryID PushWord #$C008 PushLong #0 _NewHandle pla sta 0 sta RecHandle pla sta 2 sta RecHandle+2 lda [0] sta RecBuffer sta RecBufferEnd sta 4 ldy #2 lda [0],y sta RecBuffer+2 sta 6 clc adc #2 sta RecBufferEnd+2 lda #$FFFF sta [4] lda #%1000000000 sta SeqFlags jsr SetUpFlags lda SongHandle ora SongHandle+2 beq RecordSong2 lda SeqFlags ora #%100000000 sta SeqFlags PushLong #0 ldx #RecTrackID jsr GetCtlValue sec sbc #$300 pha PushLong SeqPlayRec _DeleteTrack pla pla lda SeqPlayRec sta 0 lda SeqPlayRec+2 sta 2 lda [0] cmp #$FFFF bne RecordSong2 lda SeqFlags and #%011111111 sta SeqFlags RecordSong2 ldx #RecTrackID jsr GetCtlValue sec sbc #$300 sta TrackRecTemp pha _SetRecTrack PushLong #SeqPlayRec _SeqPlayer rts StopRecord anop jsr Turn_Off_Song ldx #LoadID lda #0 jsr SetCtlHilite jsr EnableRest lda SongHandle ora SongHandle+2 beq StopRecord2 PushLong SeqPlayRec PushLong RecBuffer _Merge PushLong SongHandle _DisposeHandle StopRecord2 lda RecHandle sta SongHandle lda RecHandle+2 sta SongHandle+2 lda RecBuffer sta SeqPlayRec lda RecBuffer+2 sta SeqPlayRec+2 stz RecBuffer stz RecBuffer+2 stz RecBufferEnd stz RecBufferEnd+2 lda #$100 sta SeqFlags Pushword TrackRecTemp PushWord #-1 _SetPlayTrack lda TrackRecTemp asl a tax lda #-1 sta TrackPlays,x jmp MIDIInput SetBasicChan ldx #InstPopUpID jsr GetCtlValue sec sbc #$200 pha _SetBasicChan rts MIDIInput anop ldx #MidiInputID jsr GetCtlValue cmp #0 beq MidiInput2 jsr SetBasicChan PushWord #$FFFF PushWord #0 _SetMIDIPort rts MidiInput2 PushWord #0 PushWord #0 _SetMIDIPort rts LoadSong anop jsr CheckSave ldx #LoadID lda #0 jsr SetCtlValue PushWord #70 PushWord #20 PushWord #0 PushLong #FilePrompt PushLong #0 PushLong #TypeList PushLong #ReplyRec _SFGetFile2 lda ReplyRec bne LoadSong1 rts LoadSong1 anop stz SaveStatus _WaitCursor jsr Turn_Off_Song lda SongHandle ora SongHandle+2 beq LoadSong2 PushLong SongHandle _DisposeHandle PushLong InstHandle _DisposeHandle PushLong WaveHandle _DisposeHandle stz SongHandle stz SongHandle+2 LoadSong2 lda SFNameRef sta 0 lda SFNameRef+2 sta 2 lda [0] inc a inc a tax ldy #2 lda [0],y tay jsr Read_A_File lda FileHandle sta SongHandle lda FileHandle+2 sta SongHandle+2 lda ReadBuffer sta 0 lda ReadBuffer+2 sta 2 stz RecBuffer stz RecBuffer+2 lda SeqFlags and #%1110000000000 ora #%0000100000000 sta SeqFlags ldy #6 lda [0],y clc adc ReadBuffer sta SeqPlayRec lda ReadBuffer+2 adc #0 sta SeqPlayRec+2 PushLong #0 PushLong WindowPtr PushLong #SongNameID _GetCtlHandleFromID pla sta 40 pla sta 42 lda [40] sta 44 ldy #2 lda [40],y sta 46 ldy #$1C lda [44],y sta 50 ldy #$1C+2 lda [44],y sta 52 lda ReadBuffer clc adc #$28+1 sta Temp lda ReadBuffer+2 adc #0 sta Temp+2 PushLong Temp ldy #$28 lda [0],y and #$FF pha PushLong 50 _LESetText ldx #0 LESetTextLoop lda SongNameRect,x sta Temp2,x inx inx cpx #2*4 bne LESetTextLoop PushLong #0 _GetPort PushLong WindowPtr _SetPort PushLong #Temp2 _InvalRect _SetPort short m ldy #$18 lda [0],y long m and #$FF sta Temp ldy #$19 ldx #0 MoveInstName lda [0],y sta Temp+2,x iny iny inx inx cpx #16 bcc MoveInstName ldy #$18A lda [0],y sec sbc #5 pha jsr ReWriteTempo pla ldx #TempoScrollID jsr SetCtlValue ldy #$190 lda [0],y sta SeqTicks pha _SetBeat stz 10 lda #$128 sta 12 stz 14 SetInstLoop ldy 12 PushWord #1 dest PushWord #2 2 bytes lda #$B0 $Bx ora 10 pha PushWord #7 stat byte 1 (volume) lda [0],y pha act volume _MIDIMessage lda 12 clc adc #$20 tay ldx 14 PushWord 10 lda [0],y sta TrackChannels,x pha _TrackToChan lda 12 clc adc #$40 tay ldx 14 PushWord 10 lda [0],y sta TrackPlays,x pha _SetPlayTrack PushWord 10 lda 12 clc adc #$6A tay ldx 14 lda [0],y sta TrackOutput,x pha _SetTrackOut inc 10 inc 12 inc 12 lda 10 cmp #16 bne SetInstLoop ldx #Temp ldy #^Temp jsr Load_IaW PushLong SFNameRef _DisposeHandle PushLong SFPathRef _DisposeHandle PushLong #SeqPlayRec _SeqPlayer ; jmp EnableRest EnableRest ldx #2 EnableRest2 phx lda #0 jsr SetCtlHilite turn on all radio buttons plx inx cpx #RecTrackID+1 bne EnableRest2 lda #1 sta SynthMode ldx #StopID lda #255 jsr SetCtlHilite EnableRest3 lda MidiActive if midi off, disable rec,metro, bne EnableRest4 and other ldx #RecordID lda #255 jsr SetCtlHilite ldx #MidiInputID lda #255 jsr SetCtlHilite ldx #KeyWaitID lda #255 jsr SetCtlHilite ldx #MetronomeID lda #255 jsr SetCtlHilite ldx #VelCmpScrollID lda #255 jsr SetCtlHilite ldx #InstPopUpID lda #255 jsr SetCtlHilite ldx #RecTrackID lda #255 jsr SetCtlHilite EnableRest4 _InitCursor rts Load_IaW anop stx 80 sty 82 jsr Read_A_File lda [80] and #$FF sta SeqInstFile sta 84 ldy #2 short m Load_IaW1 lda [80],y sta SeqInstFile-1,y iny dec 84 bne Load_IaW1 long m lda FileHandle sta InstHandle lda FileHandle+2 sta InstHandle+2 lda ReadBuffer sta 0 clc adc #$400 sta 22 lda ReadBuffer+2 sta 2 adc #0 sta 24 stz 20 SetInstLoop2 PushLong 22 PushWord 20 _SetInstrument lda 22 clc adc #$120 sta 22 lda 24 adc #0 sta 24 inc 20 lda 20 cmp #15 bcc SetInstLoop2 ldy #$300 MoveInstNames lda [0],y sta PUItitle09111100-$300,y iny iny cpy #$300+16*16 bne MoveInstNames short m ldy #$18 lda [0],y long m and #$FF sta Temp ldy #$19 ldx #0 MoveWaveName lda [0],y sta Temp+2,x iny iny inx inx cpx #16 bcc MoveWaveName ldx #Temp ldy #^Temp jsr Read_A_File lda FileHandle sta WaveHandle lda FileHandle+2 sta WaveHandle+2 lda ReadBuffer clc adc #$900 sta ReadBuffer lda ReadBuffer+2 adc #0 sta ReadBuffer+2 php sei PushLong ReadBuffer PushWord #0 PushWord #$FFFF _WriteRamBlock plp lda #0 pha pha pha pha _SetMetro rts LoadInst anop ldx #LoadInstID lda #0 jsr SetCtlValue PushWord #70 PushWord #20 PushWord #0 PushLong #FilePrompt2 PushLong #0 PushLong #TypeList2 PushLong #ReplyRec _SFGetFile2 lda ReplyRec bne LoadInst1 rts LoadInst1 anop _WaitCursor lda InstHandle ora InstHandle+2 beq LoadInst2 PushLong InstHandle _DisposeHandle PushLong WaveHandle _DisposeHandle LoadInst2 lda SFNameRef sta 0 lda SFNameRef+2 sta 2 lda [0] inc a inc a tax ldy #2 lda [0],y tay jsr Load_IaW lda SongHandle ora SongHandle+2 bne LoadInst3 bne ldx #VolScrollID jsr GetCtlValue jsr RewriteVol3 stz 10 stz 12 SetInstLoop99 PushWord 10 PushWord #-1 _TrackToChan PushWord 10 PushWord #0 turn off all tracks _SetPlayTrack PushWord 10 PushWord #0 _SetTrackOut ldx 12 lda #-1 sta TrackChannels,x stz TrackPlays,x stz TrackOutput,x inc 12 inc 12 inc 10 lda 10 cmp #16 bne SetInstLoop99 LoadInst3 PushLong SFNameRef _DisposeHandle PushLong SFPathRef _DisposeHandle jmp EnableRest InitVars anop ldy #VarsEnd-Vars ldx #0 InitVars1 stz Vars,x inx inx dey dey bpl InitVars1 stz SeqPlayRec stz SeqPlayRec+2 stz RecBuffer stz RecBuffer+2 stz RecBufferEnd stz RecBufferEnd+2 rts PlaySong anop ldx #PlayID lda #0 jsr SetCtlValue lda #%100000000 sta SeqFlags PushLong #SeqPlayRec _SeqPlayer rts SaveSong anop ldx #SaveID lda #0 jsr SetCtlValue PushWord #70 PushWord #20 PushWord #0 PushLong #FilePrompt3 PushWord #0 PushLong #0 PushLong #ReplyRec _SFPutFile2 lda ReplyRec bne SaveSong2 rts SaveSong2 _WaitCursor lda SFNameRef sta 0 lda SFNameRef+2 sta 2 lda [0] inc a inc a sta CreateName sta DestroyName sta OpenName ldy #2 lda [0],y sta CreateName+2 sta DestroyName+2 sta OpenName+2 _DestroyGS DestroyBlock _CreateGS CreateBlock _OpenGS OpenBlock jsr Get_SongName ldx #TempoScrollID jsr GetCtlValue sta SeqTempo lda openref sta writeref sta closeref lda #SeqHeader sta WriteBuffer lda #^SeqHeader sta WriteBuffer+2 lda #SeqHeaderEnd-SeqHeader sta WriteSize stz WriteSize+2 _WriteGS WriteBlock lda SeqPlayRec sta WriteBuffer lda SeqPlayRec+2 sta WriteBuffer+2 PushLong #0 PushLong SeqPlayRec _LocateEnd pla sec sbc SeqPlayRec sta WriteSize pla sbc SeqPlayRec+2 sta WriteSize+2 _WriteGS WriteBlock _CloseGS CloseBlock _InitCursor stz SaveStatus rts SetUpFlags anop ldx #KeyWaitID jsr GetCtlValue beq SUF_1 lda #%1000000000000 ora SeqFlags sta SeqFlags SUF_1 ldx #MetronomeID jsr GetCtlValue beq SUF_2 lda #%0100000000000 ora SeqFlags sta SeqFlags SUF_2 rts Init phb phk plb cmp #0 bne Init_End lda WindowOpen beq Init_End brl Close_2 Init_End plb rtl WindowDraw PushLong WindowPtr _BeginUpdate PushLong WindowPtr _DrawControls PushLong WindowPtr _EndUpdate rts ContentDraw phb phk plb PushLong WindowPtr _DrawControls plb rtl Get_SongName anop PushLong #0 PushLong WindowPtr PushLong #SongNameID _GetCtlHandleFromID pla sta 0 pla sta 2 lda [0] sta 4 ldy #2 lda [0],y sta 6 ldy #$1C lda [4],y sta 10 ldy #$1C+2 lda [4],y sta 12 PushWord #0 PushLong 10 _LEGetTextLen pla and #$0F sta 14 sta TrackNames PushLong #0 PushLong 10 _LEGetTextHand pla sta 0 pla sta 2 lda [0] sta 4 ldy #2 lda [0],y sta 6 ldy #0 short m MoveSongName lda [4],y sta TrackNames+1,y iny dec 14 bne MoveSongName long m rts SetCtlValue anop x = id, a = set val pha PushLong #0 PushLong WindowPtr PushWord #0 phx _GetCtlHandleFromID _SetCtlValue rts GetCtlValue anop x = id PushWord #0 PushLong #0 PushLong WindowPtr PushWord #0 phx _GetCtlHandleFromID _GetCtlValue pla rts SetCtlHilite anop x = id, a = hilite pha PushLong #0 PushLong WindowPtr PushWord #0 phx _GetCtlHandleFromID _HiliteControl rts Read_ErrorB lda Stack tcs lda DP tcd lda OpenName sta 0 lda OpenName+2 sta 2 lda [0] and #$0F sta 4 ldy #2 short m Read_Error1 lda [0],y sta FileAlert+6,y iny dec 4 bne Read_Error1 long m lda #0 pha pha pha pha PushLong #FileAlert _AlertWindow pla lda #0 plb rtl Read_Error brl Read_ErrorB Read_A_File stx OpenName sty OpenName+2 _OpenGS OpenBlock bcs Read_Error lda openref sta readref sta closeref lda filesize sta readcount lda filesize+2 sta readcount+2 PushLong #0 PushLong FileSize PushWord MemoryID PushWord #$C008 PushLong #0 _NewHandle plx stx 0 stx FileHandle plx stx 2 stx FileHandle+2 bcs Read_Error lda [0] sta ReadBuffer ldy #2 lda [0],y sta ReadBuffer+2 _ReadGS ReadBlock bcs Read_Error _CloseGS CloseBlock rts SBarAction phb phk plb short m pla sta SBarTemp db pla sta SBarTemp+1 rtl pla sta SBarTemp+2 rtl+1 pla sta SBarTemp+3 rtl+2 long m pla sta SBarTemp+4 ctlhandle pla sta SBarTemp+6 ctlhandle+2 pla cmp #5 bcc SBarActionEnd cmp #$81 beq SBarThumb cmp #9 bcs SBarActionEnd sec sbc #5 asl a pha PushWord #0 PushLong SBarTemp+4 _GetCtlValue pla plx jsr (SBar_Table,x) bmi SBarTooLow cmp #250 bcc SBarSet lda #250 SBarSet pha pha PushLong SBarTemp+4 _SetCtlValue pla jsr ReWriteTempo bra SBarActionEnd SBarTooLow lda #0 bra SBarSet SBarThumb PushWord #0 PushLong SBarTemp+4 _GetCtlValue pla bra SBarSet SBarActionEnd short m lda SBarTemp+3 pha lda SBarTemp+2 pha lda SBarTemp+1 pha lda SBarTemp pha plb long m rtl SBar2Action phb phk plb short m pla sta SBarTemp db pla sta SBarTemp+1 rtl pla sta SBarTemp+2 rtl+1 pla sta SBarTemp+3 rtl+2 long m pla sta SBarTemp+4 ctlhandle pla sta SBarTemp+6 ctlhandle+2 pla cmp #5 bcc SBarActionEnd2 cmp #$81 beq SBarThumb2 cmp #9 bcs SBarActionEnd2 sec sbc #5 asl a pha PushWord #0 PushLong SBarTemp+4 _GetCtlValue pla plx jsr (SBar_Table,x) bmi SBarTooLow2 cmp #127 bcc SBarSet2 lda #127 SBarSet2 pha pha PushLong SBarTemp+4 _SetCtlValue pla jsr ReWriteVel bra SBarActionEnd2 SBarTooLow2 lda #0 bra SBarSet2 SBarThumb2 PushWord #0 PushLong SBarTemp+4 _GetCtlValue pla bra SBarSet2 SBarActionEnd2 short m lda SBarTemp+3 pha lda SBarTemp+2 pha lda SBarTemp+1 pha lda SBarTemp pha plb long m rtl SBar3Action phb phk plb short m pla sta SBarTemp db pla sta SBarTemp+1 rtl pla sta SBarTemp+2 rtl+1 pla sta SBarTemp+3 rtl+2 long m pla sta SBarTemp+4 ctlhandle pla sta SBarTemp+6 ctlhandle+2 pla cmp #5 bcc SBarActionEnd3 cmp #$81 beq SBarThumb3 cmp #9 bcs SBarActionEnd3 sec sbc #5 asl a pha PushWord #0 PushLong SBarTemp+4 _GetCtlValue pla plx jsr (SBar_Table,x) bmi SBarTooLow3 cmp #127 bcc SBarSet3 lda #127 SBarSet3 pha pha PushLong SBarTemp+4 _SetCtlValue pla jsr ReWriteVol bra SBarActionEnd3 SBarTooLow3 lda #0 bra SBarSet3 SBarThumb3 PushWord #0 PushLong SBarTemp+4 _GetCtlValue pla bra SBarSet3 SBarActionEnd3 short m lda SBarTemp+3 pha lda SBarTemp+2 pha lda SBarTemp+1 pha lda SBarTemp pha plb long m rtl SBar_Table dc a'SBar_Left' dc a'SBar_Right' dc a'SBar_PgLeft' dc a'SBar_PgRight' SBar_Left dec a rts SBar_Right inc a rts SBar_PgLeft sec sbc #10 rts SBar_PgRight clc adc #10 rts ReWriteTempo anop clc adc #5 pha pha PushLong #Text081111+7 PushWord #3 PushWord #0 _Int2Dec ldx #0 RewriteTempo2 lda TempoRect,x sta Temp2,x inx inx cpx #2*4 bne RewriteTempo2 PushLong #0 _GetPort PushLong WindowPtr _SetPort PushLong #Temp2 _InvalRect _SetPort pla asl a sec sbc #10 pha _SetTempo rts ReWriteVel anop pha PushLong #Text0B1111+23 PushWord #3 PushWord #0 _Int2Dec ldx #0 RewriteVel2 lda VelRect,x sta Temp2,x inx inx cpx #2*4 bne RewriteVel2 PushLong #0 _GetPort PushLong WindowPtr _SetPort PushLong #Temp2 _InvalRect _SetPort rts ReWriteVol anop pha pha PushLong #Text121111+8 PushWord #3 PushWord #0 _Int2Dec ldx #0 RewriteVol2 lda VolRect,x sta Temp2,x inx inx cpx #2*4 bne RewriteVol2 PushLong #0 _GetPort PushLong WindowPtr _SetPort PushLong #Temp2 _InvalRect _SetPort pla RewriteVol3 sta SBarTemp+16 stz SBarTemp+18 RewriteVol4 PushWord #1 dest PushWord #2 2 bytes lda #$B0 $Bx ora SBarTemp+18 pha PushWord #7 PushWord SBarTemp+16 _MIDIMessage inc SBarTemp+18 lda SBarTemp+18 cmp #16 bne RewriteVol4 rts Load_A_Tool stx 0 x = tool, y = rev sty 2 LAT_Loop PushWord 0 PushWord 2 _LoadOneTool bcc LAT_End lda #0 pha pha pha pha PushLong #ToolAlert _AlertWindow pla bne LAT_Loop pla jsr TurnToolsOff stz WindowPtr stz WindowPtr+2 Lat_End rts Load_MIDI anop lda AlreadyOpen beq Load_MIDI2 lda MidiSetup+4 bne Load_MIDI3 rts Load_MIDI2 lda #MidiSetUpPath sta OpenName lda #^MidiSetUpPath sta OpenName+2 Load_MIDIGet _OpenGS OpenBlock bcc Load_MIDIOk cmp #$46 beq Lat_End lda #0 pha pha pha pha PushLong #MidiAlert _AlertWindow pla bne Load_MIDIGet rts Load_MIDIOk lda openref sta readref sta closeref lda #MidiSetup sta ReadBuffer lda #^MidiSetup sta ReadBuffer+2 lda #40 sta readcount stz readcount+2 _ReadGS ReadBlock _CloseGS CloseBlock Load_MIDI3 lda MidiSetup+4 and #$FF sta 0 clc adc #17 sta MidiSetupPath2 ldx #0 short m Load_MIDIM lda MidiSetup+5,x sta MidiSetupPath2+19,x inx dec 0 bne Load_MIDIM long m lda #0 pha pha pha pha pha PushWord MemoryID PushLong #MidiSetupPath2 PushWord #1 PushWord #1 _InitialLoad2 pla plx ply pla pla PushWord MidiSetup+2 PushWord MidiSetup PushWord MemoryID phy phx _InitMIDIDriver PushWord #0 _SetMIDIMode lda #1 sta MidiActive Load_MIDIB rts Turn_Off_Song anop lda SeqFlags pha lda #0 sta SeqFlags PushLong #SeqPlayRec _SeqPlayer _KillAllNotes pla sta SeqFlags rts copy vars.asm END