Action! › and› BBS Express! PRO› Tutorial›› by› Thomas M. Johnson ››› Available from ›› Villa Video's Bargain Cellar › (414) 265-5149 › ExpressNet Node X11 ››Action! is copyright of ACS, OSS, ICD.›BBS Express! PRO is copyright Orion›Micro Systems.› ›This tutorial is copyright Thomas M.›Johnson.››This tutorial can be distributed under›the following conditions:› 1) It is free.› 2) All of the above› information is intact.››--------------------------------------››We have just finished pretty much of›the basics of Action! Now it's time›to get into the more advanced topic›that Action! offers.››The first of these is the POINTER.›A POINTER does not hold a value like›a "normal" variable. Instead it tells›us where that value physically is ›inside your Atari. To declare a ›POINTER we first have to declare what›type it will point to.››BYTE POINTER a››CARD POINTER b››There are 2 new operators that can›be used with POINTERS. If we have›a variable i of type INT we can›use this:››INT POINTER g›› g=@i››This means g points to i. Well, it›really mean that we have assigned›g to point to the same memory location›as i. g holds the memory location›of i.››Another new operator we now have is:›› g^=5››This says to put the value 5 into›the memory location that g points to.››Try APROG11.001 and try and follow›what is going on. You can see that›POINTERs are a nice way of simulating›the BASIC POKE command. But Action!›has even better ways to accomplish›that.››They say "A picture is worth a›thousand words" to I'll try it now.›I'll try and show you this PROC›graphicly. ››PROC m()›› CARD c›› CARD POINTER cp›› c=10› cp=@c› › cp^=6››RETURN››Ok, we have 2 objects to begin with: ›I'll use ? to mean we don't know for›sure that these value hold since we›didn't assign them to anything yet.›› ? ?› cp c› ›When the assignment c=10 come up›the variable look like this:›› ? 10› cp c››When cp=@c is executed, cp is assigned›to point to the memory location that›c occupies. NOT to the value in c.›› -------| 10› cp -------> c››Then, we change the value in the›location cp points to to 6.›› -------| 6› cp -------> c›››I hope that helped a little.››Have you ever wanted to change the›value of parameter you passed to a›PROC or FUNC? Well, before now you›have to create a global and not use›a parameter at all. POINTERs allow›you to keep PROCs and FUNCs›independent by not using globals›and allowing you to change the value›of a parameter outside of the PROC. ››PROC add(BYTE POINTER a)›› a^==+10›RETURN››PROC main()› BYTE a›› a=5› PrintBE(a)› add(@a)› PrintBE(a)›RETURN›››Well, I bet you are saying, "That's›nice, I MIGHT use that once in a›while, but big deal otherwise." I am›going to introduce 2 more types of›new Action! ideas then you will see›the importance of POINTERs.› ›We are going to leave POINTER for a›moment to talk about 2 things. The›first is VERY short. It is the ›Action! directive DEFINE. You use›DEFINE to clarify your programs and›make them easier to read. And they›take up no extra memory so you can›use tons of them without any overhead.››DEFINEs simply substitute one thing›for another. We know from a previous›APROG that Put(125) clears the screen.›But you really can't tell that just›by looking at it can you? But CLS›looks like it might mean clear screen.›So we can use:››DEFINE CLS = "Put(125)"››PROC m()›› CLS› Print("hi")››Or you can use it like this:››DEFINE MAX = "25"››PROC any()›› FOR i=1 TO MAX› DO› ;read in values› OD› FOR i=1 TO MAX› DO› ;print out values› OD››This way, if you want to increase the›maximum number of entries, you only›have to change the value in MAX, and›all the times it is used are changed.››The next thing is records. You may›have noticed that when you declare›an ARRAY, all the items have to be›the same type. All INTs, all CARDs›etc. Records allow us to mix types›into one object.››TYPE new = [ BYTE player_number,› points_per_game›› CARD season_total,› lifetime_total ]› ›new bball_player››We have just made a new type of›variable. When we use the››new bball_player››it is just like››INT g››"new" is the type and bball_player is›the variable name. To use a record›we have "dot notation". That is just›a fancy way of saying we do this:››bball_player.player_number=12›bball_player.points_per_game=28›bball_player.season_total=300›bball_player.lifetime_total=InputC()››And to retrieve this information we›can just:››PrintBE(bball_player.player_number)››I think this is a good time to stop.›We have gone over alot in a short›time and this stuff is pretty hard to›get the hang of right away. And it›is probably hard to think of what›you can use this for. And your›also saying, "Hey, you said there ›would be more with POINTERs!" We'll›go over how to get more out of›records using POINTERs next time.››