Developing Programs in Assembler


By examining the requirements of a sample program whose logic is already familiar we can follow the logical development of an assembler level program.


Sample Problem: Calculation of the Greatest Common Divisor




Decomposition of the Algorithm

    It must be possible to produce code which will perform certain higher level activities
  1. Enter a number
  2. Perform a loop while two data values are not equal
  3. Perform a conditional activity if one data value is less than another
  4. Exchange two data values
  5. Subtract one value from another
  6. Output a number
  7. Stop program execution
    In addition to these activities explicit in the algorithm, we will need to be able to:
  1. Handle errors caused by user input
  2. Package the code in a form acceptable to the assembler program




Enter a number




Perform a loop while two data values are not equal




Perform a conditional activity if one data value is less than another




Exchange two data values




Subtract one value from another




Output a number




Stop program execution




Embedding in Complete Program Source File

download complete source