home *** CD-ROM | disk | FTP | other *** search
/ Old Hackers Atari User Group Newsletter / Old_Hackers_Atari_User_Group_Newsletter_OHJA90B.atr / obasic.txt < prev    next >
Text File  |  2023-02-26  |  5KB  |  1 lines

  1. ¢¢  BASIC PROGRAMMING FOR BEGINNERS¢         By Stan Schenfeld¢¢    This  month  we will touch lightly¢on  Atari graphics.  We will look into¢some of the graphic modes, and some of¢the  command  statements.   The  XL-XE¢computers have 16 graphics modes (5 of¢them are text modes).  The mode we are¢most  familiar  with  is  GRAPHICS  0,¢which  is  the  default  mode when the¢computer  is  turned  on.  The other 4¢text  modes  offer different sizes and¢colors of text display.¢¢    The  other  11  graphics modes are¢true  graphics  modes.  They allow you¢to  plot  points,  draw  lines  in any¢direction, with the modes differing in¢the   number   of   colors   and   the¢resolution available.¢¢    In  this  month's  column  we will¢cover  graphics  modes zero and seven.¢Graphics  0 is automatically installed¢when you turn on your computer, and is¢used  for regular text.  If you are in¢another graphics mode, and you want to¢switch  to  graphic  0,  type the word¢GRAPHICS  followed  by  the  number  0¢which is the mode you want to go to.¢   Ex:-  GRAPHICS  0  will  put you in¢the  default 0 mode.  This is the mode¢we  use for print statements. The next¢command  that  we will consider is the¢"POSITION"  statement.  It  is used in¢programs  in  the  deferred mode only.¢This  command  allows  you  to move to¢anyplace  on  the  screen  before  you¢start to "PRINT" our text.  When using¢the "POSITION" statement, you name the¢row  and column that you wish to start¢at.  The  screen is 40 columns wide (0¢to  39),  and  24 rows high (0 to 23).¢ POSITION   30,15   would   start  the¢printing  30  spaces to the right, and¢15  spaces down.  POSITION 19,11 would¢put  the printing in approximately the¢center of the screen.  If the position¢command  is  followed  by  the "PRINT"¢command,  the  text  will start at the¢point  you  have  specified. Here is a¢quick  example:- ¢    Type-10 POSITION 19,11                       20  PRINT "CENTER"¢    Then  type-RUN  &  hit  return  If¢there  is  text there already, the new¢text  will  be  printed  over  the old¢text.        Experiment    with    the¢"POSITION"    and   "PRINT"   commands¢together  in  the deferred mode.  This¢will  familiarize you with the results¢of  these commands.  In other graphics¢modes,  the number of rows and columns¢will   differ,   but  the  basic  idea¢remains  the same. Next we will switch¢to  a  true  graphics mode, which will¢allow  us  to plot points and actually¢draw  on  the  screen.   To get into a¢four    color   graphics   mode   type¢"GRAPHICS  7".   The top of the screen¢will  turn black, and the ready prompt¢will  appear  along  the  bottom.  The¢bottom   four   lines   is  the  "text¢window",  while  the the area above is¢the "graphics screen".¢    In   GRAPHICS  7  there  are  four¢colors  to  work  with.   The  default¢values (preset colors) are:¢      color 1......Orange¢      color 2......Green¢      color 3......Blue¢      color 0......Black(background)¢Before starting to draw, you must pick¢a  color  to  draw  with  by using the¢"COLOR"   command.   "COLOR  1"  picks¢orange  as  the  drawing  color.   The¢GRAPHICS  7  screen  has  160  columns¢across  (0 to 159) and 80 rows high (0¢to 79)(not including the text window).¢ This  results  in a higher resolution¢than the 0 mode. The next two commands¢will  be  "PLOT" and "DRAWTO".  "PLOT"¢will  put  the  cursor at any specific¢point  on  the  graphics  screen.  The¢"DRAWTO"  command will draw a straight¢line between two points.¢    Let's    start    from   scratch:-¢Type-"COLOR1"-this  gives  us  drawing¢color    orange.     Then   type-"PLOT¢15,30"-this  places  the  cursor  at a¢point  15 spaces across, and 30 spaces¢down.   Then type "DRAWTO 140,70"-this¢draws a straight line from coordinates¢15,30 to 140,70 in the orange color.¢    Again,  experiment using different¢coordinates  to  "PLOT"  and "DRAWTO",¢and  different  "COLORS" to draw with.¢Note  that "COLOR 0" is the background¢color  and  may  be  used  to  "erase"¢previously  drawn lines.  If you use a¢series   of  "DRAWTO"  statments,  one¢after  another, you will draw one line¢from  the  end of the previous line to¢the  beginning of the next line, etc.,¢as in the following example:-¢     GRAPHICS 7¢     COLOR 1¢     PLOT 12,12¢     DRAWTO 70,12¢     DRAWTO 70,70¢     DRAWTO 12,70¢     DRAWTO 12,12¢¢Lines may be erased by using "COLOR 0"¢and  plotting  the proper coordinates.¢From our last example:-¢     COLOR 0¢     PLOT 12,12¢     DRAWTO 70,12¢should  erase the top line of the box.¢The   whole  graphics  screen  can  be¢erased by typing "GRAPHICS 7".¢                                      ¢