Exploring SmartBASIC
by Guy Cousineau

The Exploring SmartBASIC series by Guy Cousineau is one of the finest set of articles written about SmartBASIC. The series originally appeared in The ADAM User Friendly Group (AUGF) newsletter and was very wisely brought over to NIAD.

Each article is packed with knowledge and programming insight. It was written for beginners and advanced users alike, providing more insight into the world of SmartBASIC programming with each read.

Overall, this series is a triumph! It is amazing to see what the efforts of one individual can do to both inform and educate the greater ADAM community. On behalf of Guy and myself, Enjoy!!!

Table of Contents

Exploring SmartBASIC Part I: Looping by Guy Cousineau "Looping is a method of repeating a group of instructions several times; it helps reduce the number of program lines required for a task..." (12/28/99)  

Exploring SmartBASIC Part II: Decisions and Branching by Guy Cousineau "Decision making is a very important part of BASIC programs and is often the cause of tedious gymnastics. This article will cover five BASIC statements dealing with decisions and subroutines..." (1/8/00)  

Exploring SmartBASIC Part III: Input Commands by Guy Cousineau "There are various ways of getting values into your programs: keyboard, joystick, peeking around, or using the program itself. This article will cover using the keyboard and program... the others will follow later..." (1/19/00)

Exploring SmartBASIC Part IV: Basic Output by Guy Cousineau "Odd as it may seem, there is only one way to send out anything from a BASIC program: the PRINT statement. It is, however, a very versatile command..." (added 1/28/00)

Exploring SmartBASIC Part V: Screen Format Commands by Guy Cousineau "Before discussing INVERSE video, let’s look at the way that BASIC handles the screen. There are 2 tables in VIDEO RAM which control characters. BASIC routinely alternates between these 2 tables regardless of the FLASH INVERSE and NORMAL settings..." (12/31/99)

Exploring SmartBASIC Part VI: Screen Position Commands by Guy Cousineau "Smart BASIC has a variety of commands that control the position of the cursor on the screen. Though some may appear similar, each has its own features which makes it different from the rest..." (added 1/31/00)

Exploring SmartBASIC Part VII: Miscellaneous Commands by Guy Cousineau "This article covers a few elementary commands which don't readily fit in any other category. This will be the last series before we start the really big stuff..." (added 2/1/00)

Exploring SmartBASIC Part VIII: Reading the Joysticks by Guy Cousineau "PDL is a versatile command which can return several sets of values depending on the application. The first controller is assigned odd PDL numbers, and the second controller is assigned even PDL numbers. For this purpose, 0 is treated as an even number which complicates things since the equivalent SECOND controller value is one less than the FIRST controller value..." (added 2/5/00)

Exploring SmartBASIC Part IX: Low Resolution Graphics by Guy Cousineau "The GR command places you in low resolution graphics mode. This mode is similar to the graphics mode in APPLE BASIC and you can copy some of those programs directly with only minor changes..." (added 2/6/00)

Exploring SmartBASIC Part X: High Resolution Graphics by Guy Cousineau "High Resolution Graphics can be invoked in 2 fashions. The HGR command leaves a few lines for text at the bottom and provides a DRAW window of 256 by 160. The HGR2 command leaves no text window so the full 256 by 192 screen is available for drawing..." (added 2/10/00)

Exploring SmartBASIC Part XI: Program Control Commands by Guy Cousineau "For those who have been following these articles on SmartBASIC, the last few have dealt with complex subjects and routines. For a change of pace, we will deal here with elementary commands, which are useful if not essential to programs. Rather than technical notes on routine addresses, we will concentrate on making effective use of the elementary CONTROL commands..." (added 2/12/00)

Exploring SmartBASIC Part XII: Error Trapping by Guy Cousineau "If you want a professional looking program which does not crash upon improper input or behavior, you can use error trapping. You can use complicated error traps to make it virtually impossible to break into your programs..." (added 3/2/00)

Exploring SmartBASIC Part XIII: Playing with RAM by Guy Cousineau "All of the 64K available under SmartBASIC is RAM area. This means that different values may be placed in any memory location, and modified, as required, by the controlling program..." (added 3/11/00)

Exploring SmartBASIC Part XIV: String Functions by Guy Cousineau "This article will deal with string manipulation. We will cover the basic operations and show a few tricks to make your string operations more effective."

Exploring SmartBASIC Part XV: Mathematics Functions by Guy Cousineau "In the several previous articles on SMARTBASIC, I have mentioned variable commands. Although most of them are mathematical functions, a few are not; notably FRE and USR. Variable commands are those commands which pass a parameter within brackets: eg INT(123.45). The parameter is evaluated by the function in order to determine the result. Presumably to save on interpretation and parsing code, the designers of SMARTBASIC adopted a complicated technique which dynamically relocates these variable commands based on the LOMEM setting. Each of the variables is defined as an array and the array simply point back to the execution routine for each function."

Exploring SmartBASIC Part XVI: Random Numbers by Guy Cousineau "I have written on several occasions about random numbers. I will probably continue to do so until such time as we have exhausted all the questions, gripes, and hacks. This expose will explain how and why RANDOM works, and help you get the most out of it."

Exploring SmartBASIC Part XVII: Logicals by Guy Cousineau "Logicals are perhaps the most misunderstood portion of BASIC programming. Yet they can be one of the most powerful programming tools. Not only can logicals make programs shorter, they can make them run much faster."

Exploring SmartBASIC Part XVIII: File Commands by Guy Cousineau "This article will cover the elementary file related commands in SMARTBASIC. The special commands related to data files will be dealt with in subsequent articles. There are 9 elementary commands which allow you to perform housekeeping functions:"

Exploring SmartBASIC Part XIX: Reading Data Files by Guy Cousineau "This chapter will cover the mechanics of data file manipulation in SMARTBASIC. We will also touch on some examples of data file structure and some productivity hints. The first part will only deal with the basic mechanics of data file access. Article 2 will further refine the strategies."

Exploring SmartBASIC Part XX: Random Access Files by Guy Cousineau "Random access files are supposed to be the best way to access data in various parts of a data file. Unfortunately, the COLECO SMARTBASIC has serious problems creating random files. Reading them, however, works as expected and reasonably fast."

Exploring SmartBASIC Part XXI: Binary Files by Guy Cousineau "Prior to explaining the so-called binary file commands, a bit of explanation about file structure. The EOS uses 2 standard file types. The "A" file types signify ASCII files which can be read and manipulated by a Word Processing program. The "H" files have a HEADER (thus the H) which clarify the structure of the file. All H files start with a 3-byte pre-header. There are 3 KNOWN types of "H" files:"

Exploring SmartBASIC Part XXII: Integer Variables by Guy Cousineau "Have you ever seen a program with lines like c%=a%+2*e%? The PERCENT sign tells SMARTBASIC that your numbers are signed integers in the range of -(2^15) to 2^15. So how much is that? from -65536 to +65535. You may wonder where the extra number went; don't forget we need to express zero as well. Since 0 is technically a positive number, we have 65536 positive numbers and the same number of negatives."

Exploring SmartBASIC Part XXIII: Shape Tables by Guy Cousineau "After taking a short break from BASIC commands, we must now return to take care of our last set of commands to cover; they deal with to shape tables. Although the related commands were briefly covered in the chapter on HI RESOLUTION GRAPHICS, we will go over them again in a bit more detail. Remember that shape tables can only be used in HGR and HGR2 mode. Consequently, you must be in one of these modes in order to use the commands listed below."

Exploring SmartBASIC Part XXIV: Making Sound by Guy Cousineau "As you have probably heard in games, ADAM is capable of creating complex sounds. This article will explain how to make those sounds from any program which lets you write and use a machine language routine. Although the explanations given here apply to making sound in BASIC, they can also be adapted to any other environment, including CP/M or TDOS."

Exploring SmartBASIC Part XXV: More on Machine Language Routines by Guy Cousineau "In SMARTBASIC, any PROTECTED RAM area may be used to write machine language routines. But why machine language? Because there are some operations which simply cannot be performed by standard BASIC commands or functions. Additionally, some processor intensive tasks will execute very slowly in BASIC; machine language is one way to speed them up."

Back to Top