4. Stores the results of manipulation in a specificlocation5. Provides the user with an useful outputEven with a simple program, such as theresistance program, each step must be broken downinto a series of machine operations. Theseinstructions, along with the parameters and data, mustbe translated into a language or code that thecomputer can understand.Programming is a complex problem that mayinvolve writing a large number of instructions. It mayalso involve keeping track of a great many memorycells that are used for instruction and data storage,which is time-consuming and can lead to errors.To reduce time and the possibility of errors forcomplex program preparation, the compiler has beendeveloped. The compiler is a program that takescertain commands and then writes, in a form themachine understands, the instructions necessary for acomputer to execute these commands. Compilers canbring many instructions into the final program whencalled upon or signaled by a single source statement.The compiler is problem oriented because theoperations produced are those needed to work theproblem as set out by the problem statement.Compilers are built at various levels or degrees ofcomplexity. The simplest form of compiler takes onemnemonic phrase and writes one machine instruction.A mnemonic code is an abbreviated term describingsomething to assist the human memory. For example,to shift the contents of the A-register right nine places,the mnemonic code RSH.A9 is used. This causes thecompiler to write an instruction that shifts thecontents of the A-register right 118 places. Acompiler written on this level is commonly called anassembler. Note the advantages as follows:1. No opportunity to use the wrong function code2. No necessity to convert the shift count to octalA more sophisticated compiler may take astatement, such as “multiply principal by rate,” andgenerate all the instructions necessary for thecomputer to do the following:1. Locate the factors involved (in this case theprincipal and rate)2. Transfer these factors to the arithmetic unit3. Perform the indicated arithmetic operation (inthis case multiplication)4. Store the resultant (which, in this case, will bethe interest or the principal)The compiler also keeps track of all memoryallocations, whether being used for data orinstructions.Depending on the complexity of the problem to besolved, programs may vary in length from a fewinstructions to many thousands of instructions.Ultimately, the program could occupy a significant,perhaps even an excessive, portion of computermemory.One method used to preclude thispossibility is to segment the program, storing seldomused portions in auxiliary storage, and reading theseportions into the main memory only when they arerequired. An important method of developing thisability is through the use of subroutines.SUBROUTINESAs a program grows larger, certain functions mustbe repeated. The instructions necessary to performeach of these repeated functions are grouped togetherto form subroutines. These subroutines may then bereferenced by a relatively few instructions in the mainprogram. This eliminates repeating certain groups ofinstructions throughout the program.EXECUTIVE ROUTINESThe instructions that control access to the varioussubroutines are called the executive routine of themain program.Depending upon the complexity ofthe program, there may also be subexecutive routineswithin the executive routines.Housekeeping is a term used frequently withsubroutines. At the time of entry into a subroutine,the contents of the various addressable registers mayor may not be of value. An addressable register isdefined as any register whose contents can be alteredunder program control. The programmer must takesteps to preserve the contents of these registers unlessthey are of no value.JUMP AND RETURN JUMPINSTRUCTIONSThe jump and return jump instructions are used toassist in the construction of executive routines. Theseinstructions provide the computer with the ability toleave the sequential execution of the main program,execute any of the subroutines, and then return to themain program.8-14
Integrated Publishing, Inc. - A (SDVOSB) Service Disabled Veteran Owned Small Business