home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d9xx / d969 / ace.lha / ACE / ACE-2.0.lha / PRGS.lha / Astronomy / Messier.b < prev   
Text File  |  1994-01-10  |  11KB  |  342 lines

  1. '..Messier Object Finder.
  2.  
  3. const true=-1&,false=0&
  4. const sentinel=-1
  5. const max_lines=15
  6.  
  7. shortint M
  8. single MAG,DEC,RA
  9. string OBJ$,CONSTEL$
  10.  
  11. '..main program
  12. window 1,"Messier Finder",(0,0)-(640,200)
  13.  
  14. finished=false
  15.  
  16. while not finished
  17. main:
  18.   restore
  19.   color 1
  20.   cls
  21.   locate 2,10: print "Options..."
  22.   locate 4,10: print "1. Show data for a single Messier object"
  23.   locate 5,10: print "2. List all Messier objects in a constellation"  
  24.   locate 6,10: print "3. List all Messier objects of a certain type"  
  25.   locate 7,10: print "4. List all Messier objects"
  26.   locate 8,10: print "5. Quit"
  27.   locate 10,10:print "Select an option (1..5)"
  28.   repeat
  29.     opt$=inkey$
  30.   until opt$>="1" and opt$<="5"
  31.   if opt$="5" then 
  32.     finished=true
  33.   else
  34.     on val(opt$) gosub one_obj,by_const,by_obj_type,all_objs
  35.   end if
  36. wend
  37.  
  38. window close 1
  39. STOP
  40.  
  41. '..return to main menu upon ctrl-c break detection 
  42. ON BREAK GOTO main
  43. BREAK ON
  44.  
  45. SUB display_titles
  46.    '..column headings
  47.    print "M#";tab(10);" MAG";tab(20);" DEC";tab(30);" RA";tab(45);
  48.    print "Object";tab(65);"Constellation"
  49.    print "--";tab(10);" ---";tab(20);" ---";tab(30);" --";tab(45);
  50.    print "------";tab(65);"-------------"
  51. END SUB
  52.  
  53. SUB dm_form$(n,first$)
  54.   '..convert n to hrs/degs & mins format
  55.   '..hrs/degs
  56.   dh$=str$(fix(n))        
  57.   if n<10 then dh$=" 0"+right$(dh$,1)
  58.   x$=dh$+first$
  59.   '..mins
  60.   mins=abs(n-fix(n))*60
  61.   min$=str$(fix(mins))
  62.   if mins<10 then min$=" 0"+right$(min$,1)
  63.   x$=x$+min$+"m"
  64.   '..return string        
  65.   dm_form$=x$
  66. END SUB
  67.  
  68. SUB show_data
  69. SHARED M,MAG,DEC,RA,OBJ$,CONSTEL$
  70.    '..object data
  71.    print "M";M;tab(10);MAG;
  72.    print tab(20);dm_form$(DEC,"d");tab(30);dm_form$(RA,"h");
  73.    print tab(45);OBJ$;tab(65);CONSTEL$
  74. END SUB
  75.  
  76. BREAK STOP
  77. SUB await_return(msg$)
  78.   print
  79.   print msg$
  80.   while inkey$<>chr$(13):wend  
  81. END SUB
  82. BREAK ON
  83.  
  84. '*************************************
  85.  
  86. one_obj:
  87.  '..display data about 1 Messier object.
  88.  cls
  89.  
  90.  locate 2,10:input "Enter Messier number: ",mes_num
  91.  
  92.  REPEAT
  93.   READ M, DEC, RA, MAG, OBJ$, CONSTEL$ 
  94.  UNTIL M = mes_num or M = sentinel
  95.  
  96.  if M <> mes_num or M = sentinel then 
  97.    locate 4,10:print "M";mes_num;"not found."
  98.  else
  99.    cls
  100.    display_titles
  101.    show_data
  102.  end if
  103.  
  104.  await_return("Hit <return> for menu...")
  105. RETURN
  106.  
  107. '*************************************
  108.  
  109. by_const:
  110.   '..display data about objects in a given constellation.
  111.   cls
  112.   locate 2,10
  113.   input "Enter name of constellation: ",target$
  114.   target$=ucase$(target$)
  115.  
  116.   obj_count=0
  117.   found=false
  118.  
  119.   cls
  120.   display_titles
  121.  
  122.   repeat
  123.     READ M, DEC, RA, MAG, OBJ$, CONSTEL$   
  124.     CONSTEL$=ucase$(CONSTEL$)   
  125.     if (instr(CONSTEL$,target$)or instr(target$,CONSTEL$)) and M<>sentinel then 
  126.       ++obj_count
  127.       found=true
  128.       show_data
  129.     end if
  130.     if obj_count = max_lines then
  131.       await_return("Hit <return> to continue...")
  132.       cls
  133.       display_titles
  134.       obj_count=0
  135.     end if  
  136.   until M = sentinel  
  137.  
  138.   if not found then 
  139.     print "No Messier objects were found in ";target$;"."
  140.   end if
  141.  
  142.   await_return("Hit <return> for menu...")
  143. RETURN
  144.  
  145. '*************************************
  146.  
  147. by_obj_type:
  148.   '..display data about objects of a given type.
  149.   cls
  150.   locate 2,10: PRINT "Object types..."
  151.   locate 4,10: PRINT "1. Diffuse Nebula"
  152.   locate 5,10: PRINT "2. Planetary Nebula" 
  153.   locate 6,10: PRINT "3. Globular Cluster"
  154.   locate 7,10: PRINT "4. Open Cluster"
  155.   locate 8,10: PRINT "5. Spiral Galaxy"
  156.   locate 9,10: PRINT "6. Elliptical Galaxy"
  157.   locate 10,10:PRINT "7. Irregular Galaxy"
  158.   locate 11,10:PRINT "8. None"
  159.   locate 13,10:PRINT "Select option (1..8)"
  160.   BREAK STOP
  161.   repeat
  162.     opt$=inkey$
  163.   until opt$>="1" and opt$<="8"
  164.   BREAK ON
  165.   opt=val(opt$)
  166.  
  167.   case
  168.     opt=1 : target$="Diffuse Nebula" 
  169.     opt=2 : target$="Planetary Nebula" 
  170.     opt=3 : target$="Globular Cluster" 
  171.     opt=4 : target$="Open Cluster" 
  172.     opt=5 : target$="Spiral Galaxy" 
  173.     opt=6 : target$="Elliptical Galaxy" 
  174.     opt=7 : target$="Irregular Galaxy" 
  175.     opt=8 : return
  176.   end case
  177.  
  178.   obj_count=0
  179.   found=false
  180.  
  181.   cls
  182.   display_titles
  183.  
  184.   repeat
  185.     READ M, DEC, RA, MAG, OBJ$, CONSTEL$      
  186.     if OBJ$ = target$ and M <> sentinel then 
  187.       ++obj_count
  188.       found=true
  189.       show_data
  190.     end if
  191.     if obj_count = max_lines then
  192.       await_return("Hit <return> to continue...")
  193.       cls
  194.       display_titles
  195.       obj_count=0
  196.     end if  
  197.   until M = sentinel  
  198.  
  199.   if not found then 
  200.     print "No Messier objects of type: ";target$;" were found."
  201.   end if
  202.  
  203.   await_return("Hit <return> for menu...")
  204. RETURN
  205.  
  206. '*************************************
  207.  
  208. all_objs:
  209.  '..display data about all Messier objects.
  210.  obj_count=0
  211.  
  212.  cls
  213.  display_titles
  214.  
  215.  REPEAT
  216.   READ M, DEC, RA, MAG, OBJ$, CONSTEL$ 
  217.   if M <> sentinel then 
  218.     show_data
  219.     ++obj_count
  220.     if obj_count = max_lines then
  221.       await_return("Hit <return> to continue...")
  222.       cls
  223.       display_titles
  224.       obj_count=0
  225.     end if  
  226.   end if
  227.  UNTIL M = sentinel
  228.  
  229.  await_return("Hit <return> for menu...")
  230. RETURN
  231.  
  232. '************ Messier Data ********************* 
  233.  DATA 1,21.59,05.31,9,"Diffuse Nebula","Taurus" 
  234.  DATA 2,-01.03,21.31,7,"Globular Cluster","Aquarius" 
  235.  DATA 3,28.38,13.40,7,"Globular Cluster","Canes Vena" 
  236.  DATA 4,-26.24,16.21,6,"Globular Cluster","Scorpio" 
  237.  DATA 5,02.16,15.16,6,"Globular Cluster","Serp Caput" 
  238.  DATA 6,-32.11,17.37,6,"Diffuse Nebula","Sagittar" 
  239.  DATA 7,-34.48,17.51,5,"Open Cluster","Scorpio" 
  240.  DATA 8,-24.23,18.01,0,"Diffuse Nebula","Sagittar" 
  241.  DATA 9,-18.28,17.62,8,"Globular Cluster","Ophiuchus" 
  242.  DATA 10,-04.02,16.55,7,"Globular Cluster","Ophiuchus" 
  243.  DATA 11,-06.20,18.48,6,"Open Cluster","Scutum" 
  244.  DATA 12,-01.52,16.45,7,"Globular Cluster","Ophiuchus" 
  245.  DATA 13,36.33,16.40,6,"Globular Cluster","Hercules" 
  246.  DATA 14,-03.13,17.35,9,"Globular Cluster","Ophiuchus" 
  247.  DATA 15,11.57,21.28,7,"Globular Cluster","Pegasus" 
  248.  DATA 16,-13.48,18.16,7,"Open Cluster","Serp Cauda" 
  249.  DATA 17,-16.12,18.18,7,"Diffuse Nebula","Sagittar" 
  250.  DATA 18,-17.09,18.17,7,"Open Cluster","Sagittar" 
  251.  DATA 19,-26.11,16.59,8,"Globular Cluster","Ophiuchus" 
  252.  DATA 20,-23.02,17.59,0,"Diffuse Nebula","Sagittar" 
  253.  DATA 21,-22.30,18.02,7,"Open Cluster","Sagittar" 
  254.  DATA 22,-23.58,18.33,6,"Globular Cluster","Sagittar" 
  255.  DATA 23,-19.01,17.54,7,"Open Cluster","Sagittar" 
  256.  DATA 24,-18.30,18.14,5,"Open Cluster","Sagittar" 
  257.  DATA 25,-19.17,18.29,6,"Open Cluster","Sagittar" 
  258.  DATA 26,-09.27,18.43,8,"Open Cluster","Scutum" 
  259.  DATA 27,22.35,19.58,8, "Planetary Nebula","Vulpecula" 
  260.  DATA 28,-24.54,18.22,8,"Globular Cluster","Sagittar" 
  261.  DATA 29,38.22,20.22,7,"Open Cluster","Cygnus" 
  262.  DATA 30,-23.25,21.38,8,"Globular Cluster","Capricorn" 
  263.  DATA 31,41.00,00.40,4,"Spiral Galaxy","Andromeda" 
  264.  DATA 32,40.36,00.40,9,"Elliptical Galaxy","Andromeda" 
  265.  DATA 33,30.24,01.31,6,"Spiral Galaxy","Triangulm" 
  266.  DATA 34,42.34,02.39,6,"Open Cluster","Perseus" 
  267.  DATA 35,24.21,06.06,6,"Open Cluster","Gemini" 
  268.  DATA 36,34.06,05.33,6,"Open Cluster","Auriga" 
  269.  DATA 37,32.32,05.49,6,"Open Cluster","Auriga" 
  270.  DATA 38,35.48,05.25,7,"Open Cluster","Auriga" 
  271.  DATA 39,48.13,21.30,5,"Open Cluster","Cygnus" 
  272.  DATA 40,58.05,12.22,9,"Double Star ","Ursa Major" 
  273.  DATA 41,-20.41,06.45,6,"Open Cluster","Canis Ma" 
  274.  DATA 42,-05.25,05.33,0,"Diffuse Nebula","Orion" 
  275.  DATA 43,-05.18,05.33,0,"Diffuse Nebula","Orion" 
  276.  DATA 44,20.10,08.37,4,"Open Cluster","Cancer" 
  277.  DATA 45,23.57,03.44,2,"Open Cluster","Taurus" 
  278.  DATA 46,-14.42,07.40,7,"Open Cluster","Puppis" 
  279.  DATA 47,-14.22,07.34,5,"Open Cluster","Puppis" 
  280.  DATA 48,-05.38,08.11,6,"Open Cluster","Hydra" 
  281.  DATA 49,08.16,12.27,9,"Elliptical Galaxy","Virgo" 
  282.  DATA 50,-08.16,7.01,6,"Open Cluster","Monoceros" 
  283.  DATA 51,47.27,13.28,9,"Spiral Galaxy","Canes Vena" 
  284.  DATA 52,61.19,23.22,8,"Open Cluster","Cassiopeia" 
  285.  DATA 53,18.26,13.11,8,"Globular Cluster","Coma Beren" 
  286.  DATA 54,-30.32,18.52,8,"Globular Cluster","Sagittar" 
  287.  DATA 55,-31.03,19.37,6,"Globular Cluster","Sagittar" 
  288.  DATA 56,30.05,19.15,9,"Globular Cluster","Lyra" 
  289.  DATA 57,32.58,18.52,9,"Planetary Nebula","Lyra" 
  290.  DATA 58,12.05,12.35,10,"Spiral Galaxy","Virgo" 
  291.  DATA 59,11.55,12.40,10,"Elliptical Galaxy","Virgo" 
  292.  DATA 60,11.49,12.41,10,"Elliptical Galaxy","Virgo" 
  293.  DATA 61,04.45,12.19,10,"Spiral Galaxy","Virgo" 
  294.  DATA 62,-30.03,16.58,7,"Globular Cluster","Ophiuchus" 
  295.  DATA 63,42.17,13.14,9,"Spiral Galaxy","Canes Vena" 
  296.  DATA 64,21.57,12.54,8,"Spiral Galaxy","Coma Beren" 
  297.  DATA 65,13.23,11.16,10,"Spiral Galaxy","Leo" 
  298.  DATA 66,13.17,11.18,9,"Spiral Galaxy","Leo" 
  299.  DATA 67,12.00,08.49,7,"Open Cluster","Cancer" 
  300.  DATA 68,-26.29,12.37,9,"Globular Cluster","Hydra" 
  301.  DATA 69,-32.23,18.28,8,"Globular Cluster","Sagittar" 
  302.  DATA 70,-32.12,18.40,8,"Globular Cluster","Sagittar" 
  303.  DATA 71,18.39,19.52,8,"Globular Cluster","Sagitta" 
  304.  DATA 72,-12.44,20.51,9,"Globular Cluster","Aquarius" 
  305.  DATA 73,-12.50,20.56,0,"(Four Stars)","Aquarius" 
  306.  DATA 74,15.32,01.34,10,"Spiral Galaxy","Pisces" 
  307.  DATA 75,-22.04,20.03,9,"Globular Cluster","Sagittar" 
  308.  DATA 76,51.19,01.39,11,"Planetary Nebula","Perseus" 
  309.  DATA 77,-00.14,02.40,10,"Spiral Galaxy","Cetus" 
  310.  DATA 78,00.02,05.44,8,"Diffuse Nebula","Orion" 
  311.  DATA 79,-24.34,05.22,8,"Globular Cluster","Lepus" 
  312.  DATA 80,-22.52,16.14,8,"Globular Cluster","Scorpio" 
  313.  DATA 81,69.18,09.52,7,"Spiral Galaxy","Ursa Major" 
  314.  DATA 82,69.56,09.52,9,"Irregular Galaxy","Ursa Major" 
  315.  DATA 83,-29.37,13.34,8,"Spiral Galaxy","Hydra" 
  316.  DATA 84,13.10,12.23,10,"Elliptical Galaxy","Virgo" 
  317.  DATA 85,18.28,12.23,10,"Elliptical Galaxy","Coma Beren" 
  318.  DATA 86,13.13,12.24,10,"Elliptical Galaxy","Virgo" 
  319.  DATA 87,12.40,12.28,10,"Elliptical Galaxy","Virgo" 
  320.  DATA 88,14.42,12.30,10,"Spiral Galaxy","Coma Beren" 
  321.  DATA 89,12.50,12.33,11,"Elliptical Galaxy","Virgo" 
  322.  DATA 90,13.26,12.34,10,"Spiral Galaxy","Virgo" 
  323.  DATA 91,14.30,12.35,9,"Unexplained ","Coma Beren" 
  324.  DATA 92,43.12,17.16,7,"Globular Cluster","Hercules" 
  325.  DATA 93,-23.45,07.43,6,"Open Cluster","Puppis" 
  326.  DATA 94,41.23,12.49,9,"Spiral Galaxy","Canes Vena" 
  327.  DATA 95,11.58,10.41,10,"Spiral Galaxy","Leo" 
  328.  DATA 96,12.05,10.44,10,"Spiral Galaxy","Leo" 
  329.  DATA 97,55.18,11.12,11,"Planetary Nebula","Ursa Major" 
  330.  DATA 98,15.11,12.11,10,"Spiral Galaxy","Coma Beren" 
  331.  DATA 99,14.42,12.16,10,"Spiral Galaxy","Coma Beren" 
  332.  DATA 100,16.06,12.20,10,"Spiral Galaxy","Coma Beren" 
  333.  DATA 101,54.35,14.01,8,"Spiral Galaxy","Ursa Major" 
  334.  DATA 103,60.26,01.30,7,"Open Cluster","Cassiopeia" 
  335.  DATA 104,-11.21,12.37,8,"Spiral Galaxy","Virgo" 
  336.  DATA 105,12.51,10.45,10,"Elliptical Galaxy","Leo" 
  337.  DATA 106,47.35,12.17,9,"Spiral Galaxy","Canes Vena" 
  338.  DATA 107,-12.57,16.30,9,"Globular Cluster","Ophiuchus" 
  339.  DATA 108,55.57,11.09,10,"Spiral Galaxy","Ursa Major" 
  340.  DATA 109,53.39,11.55,10,"Spiral Galaxy","Ursa Major" 
  341.  DATA -1,0,0,0,"",""    '..sentinel
  342.