home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / DBA / ST / DBA_03.MSA / GFA_PROG.S / DBA.TXT next >
Encoding:
Text File  |  1989-04-06  |  3.5 KB  |  103 lines

  1. HOW TO BEGIN IN GFA
  2.  
  3. (Written by someone who really started from the bottom but is getting 
  4.  better very fast...)
  5. Hello, 
  6.  
  7. Bonus asked me to write a text for the DBA Diskmagazine 3. So I wrote 
  8. a bit on programming. Bonus and K.G.E. ( the coders of this magazine) 
  9. are trying to learn me how to program in GFA-Basic. It is not very 
  10. difficult because the instructions are very simple, and GFA-Basic is 
  11. very fast. Not as fast as ASM ofcourse but still for a Basic it is 
  12. very fast. 
  13.  
  14. If you want to learn how to program you have to observe and remember!
  15. ( If you are not so good at remembering you may have to write it 
  16. down! (could come in handy later! ( maybe! ))) As you probably know 
  17. there are some small GFA programs in the DBA Diskmagazines. These are 
  18. great help because they give you a good example of what GFA is capable 
  19. of. And the explanation is very good. 
  20.  
  21. If you start programming don't start too difficult. You have to start
  22. with a simple concept, and make it more complicated later on. 
  23. For example: 
  24. ' Small Gfa example  (I)
  25. '
  26. x%=1                         ! X-coordination.
  27. y%=1                         ! Y-coordination.
  28. dx%=1                        ! counter for x%
  29. dy%=1                        ! counter for y%
  30. '
  31. ' Main program
  32. '
  33. REPEAT
  34.  ADD x%,dx%                  ! count x% up with dx%
  35.  ADD y%,dy%                  ! count y% up with dy%
  36.  IF x%<1 OR x%>319 THEN      ! check for not going out of screen.
  37.   dx%=-dx%                   ! if dx%=1 then dx%=-1 and vice versa
  38.  ENDIF
  39.  IF y%<1 OR y%>199 THEN      ! check for not going out of screen.
  40.   dy%=-dy%                   ! same as dx% go and see there.
  41.  ENDIF
  42.  PLOT x%,y%                  ! show coordinations.
  43. UNTIL INKEY$<>""             ! if any key is pressed then
  44. EDIT                         ! go to editor. 
  45.  
  46. This is a simple example, but you can make it much more difficult, 
  47. you could try to show only ten x-,and y-coordinations.
  48.  
  49. '
  50. ' Small Gfa Example (II)
  51. '
  52. DIM x%(10),dx%(10),y%(10),dy%(10)      ! create some variables.
  53. FOR i%=1 TO 10
  54.  x%(i%)=i%                             ! give each x% a number.
  55.  y%(i%)=i%                             ! give each y% a number.
  56.  dx%(i%)=1                             ! every x-counter=1
  57.  dy%(i%)=1                             ! every y-counter=1
  58. NEXT i%
  59. REPEAT
  60.  FOR i%=1 TO 10
  61.   ADD x%(i%),dx%(i%)                   ! count up x% with dx%
  62.   ADD y%(i%),dy%(i%)                   ! count up y% with dy%
  63.   IF x%(i%)<1 OR x%(i%)>319 THEN       ! check if not out of screen.
  64.    dx%(i%)=-dx%(i%)                    ! if dx%=1 then dx%=-1 and vice 
  65.   ENDIF                                ! versa.
  66.   IF y%(i%)<1 OR y%(i%)>199 THEN       ! same as above
  67.    dy%(i%)=-dy%(i%)
  68.   ENDIF
  69.   PLOT x%(i%),y%(i%)                   ! show x and y
  70.  NEXT i%
  71.  CLS                                   ! clear screen
  72. UNTIL INKEY$<>""                       ! if any key is pressed then
  73. EDIT                                   ! go to editor
  74.  
  75. The program is a bit more complicated, but you can make it much more 
  76. difficult just use your imagination. 
  77.  
  78. If you want to learn how to program then you try to gather (small) 
  79. Gfa-sources, and you try to understand them. You experiment with them, 
  80. and you compare it with other programs. 
  81.  
  82. As you see you don't have to make it very difficult. 
  83.  
  84. If you have questions or remarks  you could write a lettre to:
  85.  
  86. O.T.M.
  87. Rembrandtstraat 48
  88. 8331 RP  Steenwijk
  89. The netherlands.
  90.  
  91.  
  92. Text by O.T.M. of Digital.
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.                  
  102.