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.››--------------------------------------››In the last lesson, we went over how›to compile and run a Action! program.›We also learned that the last PROC›in a program is the first one that›is run. Finally, we learned our ›first Action! library PROC - PrintE.››Now we are going to cover varibles.›In Action!, you must know what type›of values a variable will take on›before you can use it. This is so›the compiler can set aside the right›amount of space for that variable.››In Action!, we have 3 basic variable›types: BYTE, INT and CARD.››Note: the keywords BYTE and CHAR are›identical and can ALWAYS be used in›place of each other.››First the BYTE. A BYTE can have a›value from 0 to 255 and that is all.›When you add 1 to a BYTE with a›value of 255 you get 0. The same when›you subtract 1 from 0 you get 255.››BYTE values are used for loops and›most other general values.››The next basic type is a INT. INTs ›can have values from -32768 to 32767.›If you need to use negative numbers,›a INT is the only way to do it.››Lastly we have a CARD. CARDs can have›values from 0 to 65535. Use CARDs›when you need larger numbers. But›65535 is the largest number you can›have. When you add 1 to 65535 you›get 0 for an answer.››The are no real numbers like 5.7›in Action!. Nor are there scientific›notation like 5.8E4.››Why does Action! have these restric-›tions? I know BASIC programmers are›say "In BASIC we don't have to ›declare variables and they can be›real and larger than 65535."››But in BASIC, EVERY variable takes›up 6 bytes of memory. In Action!,›a BYTE takes up 1 byte and INTs and›CARDs take up only 2. And this›is the way the computer really›looks at numbers. The floating›point package is the thing that really›slows BASIC down.››So we have this chart:›› size in›name bytes low val. high val›-------------------------------------›BYTE 1 0 255›INT 2 -32768 32767›CARD 2 0 65535››Ok, so how do you use them? ›Here is a sample program.››› PROC main()›› BYTE i›› Print("Give me a number. ")› › i=InputB()› PrintBE(i)›› RETURN››The first line we know. It is ›required by all Action! program to›define a PROC.››The next line declares i and j as›variable of type BYTE. They will only›have a value from 0 to 255.››The Print statement prints what is›between the quotes without returning›the carriage after.››The i=InputB() line inputs a BYTE›from the keyboard and places its value›in i.››j=i set the value of j to be the same›as the value in i. ››PrintBE(j) prints the value of j as›a BYTE and returns the carriage. ››If a number larger than 255 is entered›the Action! system will take what is›called the "least significant byte" of›that number and place that in i. I›won't go into LSB right now. But if›you want to experiment...››What if you wanted INTs instead of›BYTEs?›› PROC main()›› INT i›› Print("Give me a number. ")› › i=InputI()› PrintIE(i)›› RETURN›››OK, the last thing I will do in this›lesson is the related Input and›Print functions. ››BYTE b›CARD c›INT i››Just declaring some dummy variables.››i=InputI() input a INT ››c=InputC() input a CARD››b=InputB() input a BYTE›››Print("hi") print string without› the carriage return››PrintE("hi") print the string with› the carriage return››PrintB(b) print a BYTE without› the CR ››PrintBE(b) print a BYTE with a CR››PrintC(c) print a CARD without a› CR››PrintCE(c) print a CARD with a CR››PrintI(i) print a INT without a› carriage return››PrintIE(i) print a INT with a CR››Next we will go into expressions and›the IF statement.››