hewlett-packard HP 9835A — 015

Getting Started 15 Also, assembly lines do not have to be in any special place in the BASIC program. The above example could be re-arranged as follows - 40 ISOURCE NOP Thus, you are free to enter your assembly statements anywhere in your BASIC program. But, you may ask, what is the effect of spreading them out like this? The answer is, simply, none. When the time comes to use them, assembly statements and BASIC statements are separated by the operating system and treated differently. When the BASIC program is run, ONLY the BASIC statements are executed.

The ISOURCE statements are ignored, and, as you will be shown in Chapter 4, when the assembly language lines are assembled, the BASIC statements are ignored. A way to consider it is that there are two programs in one - BASIC's and the assembler's. So you can envision the example above as being this way - BASIC ASSEMBLER LET fi:::: 10 LET J::::::2!J ~,-----,source ~ F'R I hT f1, J:: You should note, then, that ISOURCE statements are not "executable" in the usual BASIC sense. Their location in the program does not indicate the place where they will be executed. Assembly instructions are not executed until a routine is "called"; this is discussed in detail in Chapter 4.

Now that it has been said that the two types of statements can be thoroughly intermixed, it should also be said that the practice is not recommended. As a good programming practice - i.e., for readability and to preserve the self-documenting features of BASIC - it is recom- mended that assembly statements be collected together and placed in one spot in the program. The first example is a recommended practice over the second, even though the second is permissible.