'
'         Co-ordinate and Ascii Monitor V1.2 
'                  by Ivor King  
'
'     Read the DOCS on disk for more information 
'
'Screen Close 0
Break Off 
Screen Open 2,640,300,16,Hires
Screen Open 1,640,300,16,Hires
Curs Off 
Colour 1,0
Screen 2
Get Palette 1
Curs Off 
Screen Copy 2,0,0,640,300 To 1,0,0
Screen 1
Screen To Front 1
Colour 1,0
Limit Mouse 0,0 To 700,500
Global NOB,LEG,KSA,RES$,ODE,TE$,COMREG,OPREG,PREG,F$,OVEREG,SUBB,PLOC
COMREG=True
RES$="med"
LEG=False
SCOB=2
PLOC=2
NOB=2
ODE=0
PREG=False
OPREG=2
SUBB=2
Curs Off 
Writing ODE
MENU_INIT
MENU_ACT
On Menu Goto MEBDU
Change Mouse 2
BEGINNING:
   Under On 
   Pen 5
   If RES$="med"
      Centre "Co-ordinate & Ascii Monitor V1.2"
   End If 
   Under Off : Cdown 
   Pen 10
   If RES$="med"
      Centre "by Ivor King"
   End If 
   If RES$="med"
      SETUP_MED
   Else 
      SETUP_LOW
   End If 
   GOGGLE:
      Pen 4
      On Menu On 
      Do 
         XH=X Mouse
         YH=Y Mouse
         XS=X Screen(XH)
         YS=Y Screen(YH)
         XT=X Text(XS)
         YT=Y Text(YS)
         MC=Mouse Key
         K$=Inkey$
         If K$=" " Then Locate XT,YT : Print "          "
         If RES$="med"
            KSA=Asc(K$)
            If K$<>""
               If KSA<>13
                  If KSA<>0
                     If KSA<>9
                        Locate 6,29 : Print K$ : Locate 6,30 : Print KSA;"  "
                     Else 
                        Locate 6,29 : Print "  " : Locate 6,30 : Print KSA;"  "
                     End If 
                  Else 
                     Locate 6,29 : Print "  " : Locate 6,30 : Print KSA;"  "
                  End If 
               Else 
                  Locate 6,29 : Print "  " : Locate 6,30 : Print KSA;"  "
               End If 
            End If 
         End If 
         If XS>631
            OVEREG=True
         Else 
            OVEREG=False
         End If 
         If MC=1
            Writing ODE
            If OPREG=1 and OVEREG=False
               Plot XS,YS,PLOC
               Pen 11
               Locate XT+1,YT
               Print XH;" ";YH
               If LEG
                  Lprint "HARD:  ";XH;" ";YH
               End If 
               Pen 4
            Else 
               If OPREG=2 and OVEREG=False
                  Plot XS,YS,PLOC
                  Pen 12
                  Locate XT+1,YT
                  Print XS;" ";YS
                  If LEG
                     Lprint "SCREEN:  ";XS;" ";YS
                  End If 
                  Pen 4
               Else 
                  If PREG and OVEREG=False
                     Pen PLOC
                     Locate XT,YT
                     Print "#"
                     Pen 14
                     Locate XT+1,YT
                     Print XT;" ";YT
                     If LEG
                           Lprint "TEXT:  ";XT;" ";YT
                     End If 
                     Pen 4
                  Else 
                     If OVEREG=False
                        Plot XS,YS,PLOC
                        Pen 14
                        Locate XT+1,YT
                        Print XT;" ";YT
                        If LEG
                           Lprint "TEXT:  ";XT;" ";YT
                        End If 
                        Pen 4
                     End If 
                  End If 
               End If 
            End If 
         End If 
         Writing 0
         If RES$="med"
            Locate 10,31
            Print XH;" "
            Locate 18,31
            Print YH;" "
            Locate 38,31
            Print XS;" "
            Locate 46,31
            Print YS;" "
            Locate 63,31
            If XT>0
               Print XT;" "
            End If 
            Locate 71,31
            If YT>0
               Print YT;" "
            End If 
         Else 
            Locate 5,31
            Print XH;" "
            Locate 9,31
            Print YH;" "
            Locate 18,31
            Print XS;" "
            Locate 22,31
            Print YS;" "
            Locate 31,31
            If XT>0
               Print XT;" "
            End If 
            Locate 34,31
            If YT>0
               Print YT;" "
            End If 
         End If 
      Loop 
MEBDU:
   Pen 2
   If Choice(2)=10 Then PRNT : Goto GOGGLE
   If Choice(2)=15 Then Screen Close 1 : Screen Close 2 : End 
   If Choice(2)=12 Then WB : Goto GOGGLE
   If Choice(2)=14 Then SCR_CHANGE : Goto BEGINNING
   If Choice(2)=9 Then CLEP : Goto BEGINNING
   If Choice(2)=2 Then OPTIONS : Goto GOGGLE
   If Choice(2)=3 Then INFO : Goto GOGGLE
   If Choice(2)=4 Then Cls : Screen Copy 2,0,0,640,300 To 1,0,0 : Goto BEGINNING
   If Choice(2)=1 Then HAP : Goto GOGGLE
   If Choice(2)=11 Then COMM : Goto GOGGLE
   If Choice(3)=1 or 2 or 3 or 4 or 5 Then Goto LOP
PIX:
   If Choice(3)=1 Then Goto PIX1
   If Choice(3)=2 Then Goto PIX2
PIX2:
   TE$="Low resolution"
   If COMREG
      WIPEOUT
   End If 
   F$=Fsel$("","","Load a Lowres IFF picture","(MUST be medres or lowres only!)")
   If F$<>""
      Cls 
      Screen 2
      Cls 
      If RES$="med"
         COPIER_LOW
         Screen 2
      End If 
      Load Iff F$,2
      Get Palette 1
      Screen Copy 2,0,0,640,300 To 1,0,0
      Screen 1
      Screen To Front 1
      If RES$="med"
         Menu Base 0,0
         Menu$(1,14)="Medres"
      End If 
      RES$="low"
      Goto BEGINNING
   Else 
      Goto GOGGLE
   End If 
PIX1:
   TE$="Medium resolution"
   If COMREG
      WIPEOUT
   End If 
   F$=Fsel$("","","Load a Medres IFF picture","(MUST be medres or lowres only!)")
   If F$<>""
      Cls 
      Screen 2
      Cls 
      If RES$="low"
         COPIER_MED
         Screen 2
      End If 
      Load Iff F$,2
      Get Palette 1
      Screen Copy 2,0,0,640,300 To 1,0,0
      Screen 1
      Screen To Front 1
      If RES$="low"
         Menu Base 0,0
         Menu$(1,14)="Lowres"
         On Menu Goto MEBDU
      End If 
      RES$="med"
      Goto BEGINNING
   Else 
      Screen 1
      Goto GOGGLE
   End If 
LOP:
   If Choice(2)=5 Then LEP1 : Goto GOGGLE
   If Choice(2)=8 Then CLOS : Goto GOGGLE
   If Choice(2)=6 Then Goto PIX
   If Choice(2)=13 Then SCRAP : Goto GOGGLE
   LEP2
   Goto GOGGLE
'
Procedure CLOS
   If Choice(3)=1
      PLOC=4
      Menu Inactive(1,8,1)
      Menu Active(1,8,NOB)
      NOB=1
   Else 
      If Choice(3)=2
         PLOC=2
         Menu Inactive(1,8,2)
         Menu Active(1,8,NOB)
         NOB=2
      Else 
         If Choice(3)=3
            PLOC=0
            Menu Inactive(1,8,3)
            Menu Active(1,8,NOB)
            NOB=3
         Else 
            If Choice(3)=4
               PLOC=6
               Menu Inactive(1,8,4)
               Menu Active(1,8,NOB)
               NOB=4
            Else 
               PLOC=5
               Menu Inactive(1,8,5)
               Menu Active(1,8,NOB)
               NOB=5
            End If 
         End If 
      End If 
   End If 
End Proc
'
Procedure LEP1
   If Choice(3)=1
      Menu Inactive(1,5,1)
      Menu Active(1,5,OPREG)
      OPREG=1
   Else 
      If Choice(3)=2
         Menu Inactive(1,5,2)
         Menu Active(1,5,OPREG)
         OPREG=2
      Else 
         Menu Inactive(1,5,3)
         Menu Active(1,5,OPREG)
         OPREG=3
      End If 
   End If 
End Proc
'
Procedure LEP2
   If Choice(3)=1
      Change Mouse 1
      Menu Inactive(1,7,1)
      Menu Active(1,7,SUBB)
      SUBB=1
   Else 
      If Choice(3)=2
         Change Mouse 2
         Menu Inactive(1,7,2)
         Menu Active(1,7,SUBB)
         SUBB=2
      Else 
         Change Mouse 3
         Menu Inactive(1,7,3)
         Menu Active(1,7,SUBB)
         SUBB=3
      End If 
   End If 
End Proc
'
Procedure SETUP_MED
   Pen 2
   Locate 0,29 : Print "CHAR:"
   Locate 0,30 : Print "ASCII:"
   Locate 0,31 : Pen 11 : Print "<" : Pen 2
   Locate 1,31
   Print "HARD" : Pen 11 : Locate 5,31 : Print ">" : Pen 2
   Locate 8,31
   Print "X:"
   Locate 16,31
   Print "Y:"
   Locate 26,31 : Pen 12 : Print "<" : Pen 2
   Locate 27,31
   Print "SCREEN" : Pen 12 : Locate 33,31 : Print ">" : Pen 2
   Locate 36,31
   Print "X:"
   Locate 44,31
   Print "Y:"
   Locate 53,31 : Pen 13 : Print "<" : Pen 2
   Locate 54,31
   Print "TEXT" : Pen 13 : Locate 58,31 : Print ">" : Pen 2
   Locate 61,31
   Print "X:"
   Locate 69,31
   Print "Y:"
End Proc
'
Procedure SETUP_LOW
   Pen 2
   Locate 2,31 : Pen 11 : Print "<" : Pen 2
   Locate 3,31 : Print "H" : Locate 4,31 : Pen 11 : Print ">"
   Locate 15,31 : Pen 12 : Print "<" : Pen 2
   Locate 16,31 : Print "S" : Locate 17,31 : Pen 12 : Print ">"
   Locate 28,31 : Pen 13 : Print "<" : Pen 2 : Locate 29,31 : Print "T"
   Locate 30,31 : Pen 13 : Print ">" : Pen 2
End Proc
'
Procedure COPIER_LOW
   Screen Close 2
   Screen Close 1
   Screen Open 2,320,270,64,Lowres
   Colour 1,0
   Curs Off 
   Screen Open 1,320,270,64,Lowres
   Colour 1,0
   Curs Off 
End Proc
'
Procedure COPIER_MED
   Screen Close 2
   Screen Close 1
   Screen Open 2,640,300,16,Hires
   Colour 1,0
   Curs Off 
   Screen Open 1,640,300,16,Hires
   Colour 1,0
   Curs Off 
End Proc
'
Procedure WIPEOUT
   If RES$="low"
      Screen Open 3,600,300,16,Hires
      Screen To Front 3
      Colour 1,0
   Else 
      Wind Save 
   End If 
   Wind Open 3,70,70,60,16,1
   Curs Off 
   Pen 11
   Print " You have chosen to load a ";TE$;" screen." : Cdown 
   Cdown : Centre "Note: if you choose something that IS NOT a medres or"
   Cdown : Centre "lowres screen with the correct co-ords, it will NOT be"
   Cdown : Centre "Loaded!" : Cdown 
   Centre "This option deletes EVERYTHING on the screen !"
   Cdown : Centre "Your picture will be loaded into the current"
   Cdown : Centre "screen colours."
   Cdown : Centre "It's O.K. to load a lowres picture into a medres"
   Cdown : Centre "screen or vice versa, but its appearance will change"
   Cdown : Centre "Select quit to abort loading. MB to continue."
   Repeat : Until Mouse Key
   Wind Close 
   If RES$="low"
      Screen 1
      Screen To Front 1
      Screen Close 3
   End If 
End Proc
'
Procedure MENU_INIT
   Menu$(1)="Options"
   Menu$(1,2)="Help"
   Menu$(1,3)="Credits"
   Menu$(1,6)="Load iff         =>"
   Menu$(1,7)="Mouse type       =>"
   Menu$(1,14)="Lowres"
   Menu$(1,15)="Quit"
   Menu$(1,1)="Plot hash"
   Menu$(1,4)="Clear"
   Menu$(1,13)="Screen output    =>"
   Menu$(1,13,1)="REPLACE"
   Menu$(1,13,2)="OR"
   Menu$(1,13,3)="XOR"
   Menu$(1,13,4)="AND"
   Menu$(1,5)="Co-ord type      =>"
   Menu$(1,5,1)="Hard"
   Menu$(1,12)="Close Workbench"
   Menu$(1,10)="Printer output  OFF"
   Menu$(1,11)="Comm screens     ON"
   Menu$(1,5,2)="Screen"
   Menu$(1,5,3)="Text"
   Menu$(1,8)="Point colour     =>"
   Menu$(1,7,1)="Pointer"
   Menu$(1,7,2)="Crosshair"
   Menu$(1,7,3)="Clock"
   Menu$(1,8,1)="Red"
   Menu$(1,8,2)="White"
   Menu$(1,8,3)="Black"
   Menu$(1,9)="Clear All/New"
   Menu$(1,8,4)="Blue"
   Menu$(1,8,5)="Green"
   Menu$(1,6,1)="Medres"
   Menu$(1,6,2)="Lowres"
   Menu Static(1)
   Menu Static(1,1)
   Menu Static(1,8,1)
   Menu Static(1,6,1)
   Menu Static(1,5,1)
   Menu Static(1,7,1)
   Menu Static(1,13,1)
   Menu On 
End Proc
'
Procedure MENU_ACT
   Menu Inactive(1,5,2)
   Menu Inactive(1,7,2)
   Menu Inactive(1,8,2)
   Menu Inactive(1,13,1)
End Proc
'
Procedure OPTIONS
   If RES$="low"
      Screen Open 3,600,300,16,Hires
      Screen To Front 3
      Colour 1,0
   Else 
      Wind Save 
   End If 
   Wind Open 2,70,70,60,16,1
   Curs Off 
   Pen 6
   Centre "Help"
   Cdown : Pen 11
   Centre "SPACE to delete individual co-ordinates" : Cdown 
   Centre "Select 'Close Workbench' to save memory" : Cdown 
   Centre "Select 'plot hash' from the menu to plot # symbols" : Cdown 
   Centre "instead of points (in text co-ord mode only)" : Cdown 
   Centre "Select 'Lowres' to go switch to Lowres mode" : Cdown 
   Centre "'Comm screens' toggles communications screens ON/OFF" : Cdown 
   Centre "'Clear' clears text, 'Clear All/New' clears everything" : Cdown 
   Centre "Left MB to plot a point and co-ords" : Cdown 
   Centre "Press any key to display its ascii code" : Cdown 
   Centre "the colours are as follows:" : Cdown 
   Pen 11 : Centre "dark green=> hardware co-ordinates " : Cdown 
   Pen 12 : Centre "beigey/brown=> screen/graphic co-ordinates" : Cdown 
   Pen 13 : Centre "dark blue/purple=> text co-ordinates "
   Repeat : Until Mouse Key
   Wind Close 
   If RES$="low"
      Screen 1
      Screen To Front 1
      Screen Close 3
   End If 
End Proc
'
Procedure INFO
   If RES$="low"
      Screen Open 3,600,300,16,Hires
      Screen To Front 3
      Colour 1,0
   Else 
      Wind Save 
   End If 
   Wind Open 1,70,70,60,16,1
   Curs Off 
   Pen 6
   Centre "Weclome to COAMV1.2"
   Cdown 
   Centre "programmed in AMOS by Ivor King, completed 13/7/92"
   Cdown : Cdown : Pen 11
   Centre "This is public domain and can be freely distributed" : Cdown 
   Centre "and used by anyone." : Cdown 
   Centre "This program is mainly designed as a programming" : Cdown 
   Centre "aid for all those AMOSites out there, I hope" : Cdown 
   Centre "you find it useful !" : Cdown 
   Centre "you can contact me at:" : Cdown 
   Centre "23 Waterford avenue Waterford Perth W.A" : Cdown 
   Centre "6152 Australia" : Cdown 
   Centre "PLEASE, if you copy this program, copy the DOCS" : Cdown 
   Centre "WITH IT!.. Please spread it around!"
   Repeat : Until Mouse Key
   Wind Close 
   If RES$="low"
      Screen 1
      Screen To Front 1
      Screen Close 3
   End If 
End Proc
'
Procedure CLEP
   Screen 2
   Cls 
   Screen 1
   Cls 
End Proc
'
Procedure PRNT
   If LEG=False
      LEG=True
      Menu$(1,10)="Printer output   ON"
      If COMREG
         If RES$="low"
            Screen Open 3,600,300,16,Hires
            Screen To Front 3
            Colour 1,0
         Else 
            Wind Save 
         End If 
         Wind Open 3,70,70,60,16,1
         Curs Off 
         Cdown : Cdown : Cdown 
         Pen 3
         Centre "Make sure printer is READY "
         Pen 4
         Cdown : Centre "(or the computer will freeze up!)"
         Pen 2
         Cdown : Cdown 
         Centre "If it won't print properly, or the computer crashes," : Cdown 
         Centre "just alter the preferences to suit your printer"
         Cdown : Cdown 
         Centre "MB to continue"
         Repeat : Until Mouse Key
         Wind Close 
         If RES$="low"
            Screen 1
            Screen To Front 1
            Screen Close 3
         End If 
      End If 
   Else 
      LEG=False
      Menu$(1,10)="Printer output  OFF"
   End If 
End Proc
'
Procedure COMM
   If COMREG
      COMREG=False
      Menu$(1,11)="Comm Screens    OFF"
   Else 
      COMREG=True
      Menu$(1,11)="Comm Screens     ON"
   End If 
End Proc
'
Procedure HAP
   If PREG
      PREG=False
      Menu$(1,1)="Plot hash" : On Menu On 
   Else 
      PREG=True
      Menu$(1,1)="Plot points" : On Menu On 
   End If 
End Proc
'
Procedure WB
   Close Workbench 
   Menu$(1,12)="Workbench closed"
   Menu Inactive(1,12)
End Proc
'
Procedure SCR_CHANGE
   If RES$="med"
      COPIER_LOW
      Screen 1
      Screen To Front 1
      Menu Base 0,0
      Menu$(1,14)="Medres"
      RES$="low"
   Else 
      COPIER_MED
      Screen 1
      Screen To Front 1
      Menu Base 0,0
      Menu$(1,14)="Lowres"
      RES$="med"
   End If 
End Proc
'
Procedure SCRAP
   If Choice(3)=1
      Menu Active(1,13,ODE+1)
      Menu Inactive(1,13,1)
      ODE=0
   Else 
      If Choice(3)=2
         Menu Active(1,13,ODE+1)
         Menu Inactive(1,13,2)
         ODE=1
      Else 
         If Choice(3)=3
            Menu Active(1,13,ODE+1)
            Menu Inactive(1,13,3)
            ODE=2
         Else 
            Menu Active(1,13,ODE+1)
            Menu Inactive(1,13,4)
            ODE=3
         End If 
      End If 
   End If 
End Proc
'
End 
'
'
'(C) 1992 KING Software
