home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / totallyamos / issue3 / source_progs / recursion2.amos / recursion2.amosSourceCode
AMOS Source Code  |  1991-07-30  |  2KB  |  61 lines

  1. '=================================================================== 
  2. '
  3. 'DATE: 23/02/92  
  4. 'TIME: 21:31 
  5. 'NAME: RECURSION2.AMOS 
  6. 'CODE: UNCLE SIME
  7. 'NOTE: SIMPLE EXAMPLE OF RECURSION. SEE TUTORIAL RECURTION.DOC 
  8. '
  9. '===================================================================   
  10. '                       * MODULE LEVEL CODE *
  11. '=================================================================== 
  12. '
  13. MAIN
  14. End 
  15. '
  16. '=================================================================== 
  17. '                      * PROCEDURE LEVEL CODE *
  18. '=================================================================== 
  19. '
  20. Procedure MAIN
  21.     '
  22.     ' This procedure sets up the environment, initialises strings etc, 
  23.     ' prints text messages, performs the initial call to procedure BACKCOUNT.    
  24.     '  
  25.     Screen Open 0,320,200,2,Lowres
  26.     SET_SCREEN
  27.     Locate 7,10
  28.     Centre "COUNTING BACKWARDS FROM 15 TO 0"
  29.     Locate 7,11
  30.     Centre "-------------------------------"
  31.     Locate 0,16
  32.     BACKCOUNT[0]
  33.     Locate ,22
  34.     Centre "Press A Key To End"
  35.     Wait Key 
  36. End Proc
  37. '
  38. Procedure BACKCOUNT[COUNT]
  39.     '
  40.     ' This procedure performs the recursive bit (see tutorial) 
  41.     ' I would recomend that you run this with the follow command 
  42.     ' below active (take out the ') and watch what happens, this 
  43.     ' will help you understand what is happening.  
  44.     '
  45.     ' follow count 
  46.     If COUNT<15
  47.         BACKCOUNT[COUNT+1]
  48.     End If 
  49.     Print COUNT;
  50. End Proc
  51. '
  52. Procedure SET_SCREEN
  53.     '
  54.     ' Yeh old procedure to set environment 
  55.     '
  56.     Flash Off 
  57.     Curs Off 
  58.     Hide On 
  59.     Cls 0
  60.     Colour 1,$FFF
  61. End Proc