' *****************************************************************************
' ** ************************** Local On/Off **********************************
' ******************************* by ******************************************
' *************************** Wayne Steinert **********************************
' *****************************************************************************
'
'                               Version 1.2
'
'
'                              July 23,1991
'
'
'
' ************************** Local On/Off ********************************
'
'
$m5500                     ! Reserves Memory (mainly for .ACC version)
ap_id&=APPL_INIT()         ! Tell's GEM it's there
'
IF ap_id&<>0               ! If it's not started as an .ACC
  me_id&=MENU_REGISTER(ap_id&,"Local Control")    ! Register with GEM
  DO                       ! Continuous .ACC "LOOP"
    ~EVNT_MESAG(0)
    IF MENU(1)=40          ! If selected
      @midi_channel        ! GOSUB
      OUT 2,7
      ALERT 0,"Select",3,"L-On|L-Off|Exit",sel%
      IF sel%=1
        @local_on
      ENDIF
      IF sel%=2
        @local_off
      ENDIF
    ENDIF
  LOOP
  '
ELSE                        ! If started as a .PRG
  @midi_channel
  OUT 2,7
  ALERT 0,"Select",3,"L-On|L-Off|Exit",sel%
  IF sel%=1
    @local_on
  ENDIF
  IF sel%=2
    @local_off
  ENDIF
  END
ENDIF
'
PROCEDURE midi_channel
  rez%=XBIOS(4)          ! Get resolution
  SELECT rez%            ! Select case according to value of rez% (Great Command, better than lots of IF/THEN's
  CASE 0                 ! If rez% = 0
    scrux%=65            ! Low rez co-ords
    scruy%=60
    scrlx%=255
    scrly%=110
    t1x%=110
    t1y%=100
    t2x%=110
    t2y%=108
    note1x%=226
    note1y%=92
    note2x%=80
    note2y%=80
    note3x%=236
    note3y%=70
    prnt1x%=14
    prnt1y%=9
    prnt2x%=14
    prnt2y%=11
  CASE 1                 ! If rez% = 1 (med)
    scrux%=225
    scruy%=60
    scrlx%=415
    scrly%=110
    t1x%=270
    t1y%=100
    t2x%=270
    t2y%=108
    note1x%=386
    note1y%=92
    note2x%=240
    note2y%=80
    note3x%=396
    note3y%=70
    prnt1x%=34
    prnt1y%=9
    prnt2x%=34
    prnt2y%=11
  CASE 2                 ! If rez% = 2 (hi)
    scrux%=225
    scruy%=100
    scrlx%=415
    scrly%=210
    t1x%=270
    t1y%=190
    t2x%=270
    t2y%=208
    note1x%=396
    note1y%=162
    note2x%=240
    note2y%=140
    note3x%=400
    note3y%=120
    prnt1x%=34
    prnt1y%=9
    prnt2x%=34
    prnt2y%=11
  ENDSELECT
  '
  GET scrux%,scruy%,scrlx%,scrly%,spot$ !Grab screen <only where box will be>
  DEFFILL 3,2,1
  OUT 2,7
  PBOX scrux%,scruy%,scrlx%,scrly%
  DEFTEXT 2,1,0,4          ! Little Text
  TEXT t1x%,t1y%,"Local Control 1.2"
  TEXT t2x%,t2y%,"by Wayne Steinert"
  TEXT t3x%,t3y%,"1.1"
  DEFTEXT 1,1,0,4          ! Blk little Text
  PRINT AT(prnt1x%,prnt1y%);"Please select"
  PRINT AT(prnt2x%,prnt2y%);"MIDI Channel ";
  ACHAR 11,note1x%,note1y%,1,0,0    ! This nifty command lets you use an ASCII Char. at "X,Y"
  ACHAR 11,note2x%,note2y%,1,0,0    !
  ACHAR 11,note3x%,note3y%,1,0,0    !
  FORM INPUT 2,midi$       ! Allows max. of 2 chr.'s for input
  midichan%=VAL(midi$)     ! Changes FORM INPUT string into a number
  PUT scrux%,scruy%,spot$  ! PUT screen spot back
RETURN
'
PROCEDURE local_off
  a=BIOS(3,3,175+midichan%)
  a=BIOS(3,3,122)
  a=BIOS(3,3,0)
RETURN
'
'
PROCEDURE local_on
  a=BIOS(3,3,175+midichan%)
  a=BIOS(3,3,122)
  a=BIOS(3,3,127)
RETURN
'
'
'          *********** This was written GFA BASIC 3.5 *************
'
'    ######################### by Wayne Steinert ##########################
' ######## I can be reached at: CodeHead Quarters BBS (213) 461-2095 #########
'    ######################### A GREAT Atari BBS ! ########################
