home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / STOSBTS1.ARJ / stosbts1.msa / PROGRAMM / MENU.BAS (.txt) < prev    next >
Atari STOS Basic  |  1987-04-22  |  16KB  |  139 lines

  1. 10 REM ***** This is a short program to demonstrate the menu routine
  2. 100 ON
  3. 10000 REM ***** A seemingly trivial routine follows, yet I have used it
  4. 10010 REM ***** in every program I have written. It reads the mouse and
  5. 10020 REM ***** keyboard, returning the following when a key is pressed:
  6. 10030 REM ***** I$ : ASCII character of key, GS : ST scancode of key
  7. 10040 REM ***** MK : mouse key pressed, MX,MY : coords of mouse
  8. 10050 REM ***** ZM : zone the mouse is in
  9. 10060 VARNAME
  10. 10070 REPEAT
  11. 10080 VARNAME
  12. 10090 RETURN
  13. 110 REPEAT
  14. 120 FADE
  15. 130 UNTIL
  16. 140 STOP
  17. 150 DATA
  18. 160 DATA
  19. 170 DATA
  20. 180 DATA
  21. 20 REM ***** It is written by and copyright 1990,91 Philip Rankin
  22. 30 REM ***** You are free to use the menu and appearroutine if you so wish
  23. 40 KEY
  24. 4000 REM ***** Block appear - see Early Learning Maths title screen
  25. 4010 VARNAME
  26. 4020 REPEAT
  27. 4030 SCREEN COPY
  28. 4040 VARNAME
  29. 4050 UNTIL
  30. 4060 SCREEN COPY
  31. 4100 REM ***** roll picture onto screen as in ST News 4.4 and Ballistix
  32. 4110 FOR
  33. 4120 FOR
  34. 4130 SCREEN COPY
  35. 4140 SCREEN COPY
  36. 4150 SCREEN COPY
  37. 4160 SCREEN COPY
  38. 4170 WAIT VBL
  39. 4180 SCREEN COPY
  40. 4190 RETURN
  41. 4300 REM ***** another fairly simple appear
  42. 4320 GET PALETTE
  43. 4330 FOR
  44. 4340 FOR
  45. 4350 SCREEN COPY
  46. 4360 SCREEN COPY
  47. 4370 WAIT VBL
  48. 4380 SCREEN COPY
  49. 4400 REM ***** Roll the picture down the screen as if it is peeling off the bar
  50. 4420 GET PALETTE
  51. 4430 FOR
  52. 4440 FOR
  53. 4450 SCREEN COPY
  54. 4460 SCREEN COPY
  55. 4470 SCREEN COPY
  56. 4480 WAIT VBL
  57. 4490 SCREEN COPY
  58. 4500 REM ***** 'Pour' appear - pours picture onto screen
  59. 4530 FOR
  60. 4540 SCREEN COPY
  61. 4550 WAIT VBL
  62. 4560 SCREEN COPY
  63. 4570 RETURN
  64. 4600 REM ***** shows a screen, stored in bank 15 plane by plane - version 1
  65. 4610 FOR
  66. 4620 VARNAME
  67. 4630 FOR
  68. 4640 NEXT
  69. 4650 SCREEN COPY
  70. 4700 REM ***** shows a screen, stored in bank 15 plane by plane - version 2
  71. 4710 FOR
  72. 4720 VARNAME
  73. 4730 FOR
  74. 4740 NEXT
  75. 4750 SCREEN COPY
  76. 50 DIM
  77. 5000 REM ***** This routine provides a simple menu
  78. 5010 REM ***** You can have as many options on the menu as will fit on the
  79. 5020 REM ***** screen. It requires the following variables
  80. 5030 REM ***** OPTION$() : an array holding all the menu options
  81. 5040 REM ***** WHERE     : a pointer to first line of data holding options
  82. 5050 REM ***** N_ITEMS  : the number of options in the menu
  83. 5060 REM ***** IX       : the x_coord of first option
  84. 5070 REM ***** IY       : the y_coord of first option
  85. 5080 REM ***** It returns the chosen option in the variable CURR_POS
  86. 5090 REM ***** EG: 10 WHERE=60000:N_ITEMS=10:IX=0:IY=0:gosub 5000
  87. 5095 REM ***** NOTE: THIS ROUTINE MAKES USE OF MY KEYBOARD/MOUSE INPUT ROUTINE
  88. 5100 VARNAME
  89. 5110 VARNAME
  90. 5120 REM ***** the above are constants, -- easier to understand than numbers
  91. 5130 GOSUB
  92. 5140 GOSUB
  93. 5150 REM ***** Now the main Loop: Use arrows to move to option
  94. 5160 REM ***** and return to select it
  95. 5170 WHILE
  96. 5180 VARNAME
  97. 5190 REPEAT
  98. 5210 VARNAME
  99. 5220 IF
  100. 5230 IF
  101. 5240 IF
  102. 5250 IF
  103. 5260 IF
  104. 5270 IF
  105. 5280 WEND
  106. 5285 RETURN
  107. 5290 REM ***** display the menu
  108. 5300 FOR
  109. 5310 LOCATE
  110. 5320 NEXT
  111. 5330 RETURN
  112. 5340 REM ***** invert the current option
  113. 5350 LOCATE
  114. 5360 INVERSE
  115. 5370 LOCATE
  116. 5380 INVERSE
  117. 5390 RETURN
  118. 5400 REM ***** Read in and Process the option$() so all options are same length
  119. 5410 RESTORE
  120. 5420 FOR
  121. 5430 READ
  122. 5440 IF
  123. 5450 NEXT
  124. 5460 FOR
  125. 5470 VARNAME
  126. 5480 NEXT
  127. 5490 RETURN
  128. 60 FADE
  129. 61 REPEAT
  130. 62 FADE
  131. 80 HIDE
  132. 82 PEN
  133. 84 PEN
  134. 85 PEN
  135. 86 PEN
  136. 88 REM ***** call the menu routine
  137. 90 PEN
  138. 95 FADE
  139.