h02 - cpu (assembly)

Upload: sullivan583

Post on 04-Apr-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 H02 - CPU (Assembly)

    1/1

    Computer Studies 2012 Syllabus

    Ms. Sullivan 1

    Handout 02 CPU (Assembly Language)

    1. Explain an advantage of mnemonics in Assembly language by giving an example. [1]2. Write a sentence on the following Assembly statements to explain what they do: [1

    each]

    a. MOV ax, dxb. SUB ax, cxc. INP ax, 190

    3. In a program there might be the need for jumps to access different parts of theprogram. Explain the difference between a conditional jump and an unconditional jump.

    [3]

    4. Why is symbolic addressing helpful to a programmer? [2]5. Explain the difference between absolute and relative addressing (use examples to

    sustain your answer). [3]

    6. Explain what the following program does. [3]

    INP ax, 105 Input a value from the keyboard and store it in memory location ax.

    INP bx, 105 Input a value from the keyboard and store it in memory location bx.CMP ax, bx Compare the value in ax with bx.

    JG lb Jump to label lb if greater.

    MUL ax, bx Multiply the value in ax with bx and store the result in ax.

    HLT End program

    lb: DIV ax, bx Divide the value in ax by bx and store the result in ax.

    HLT End program

    7. Consider the previous program. What is the outcome of the program if the first inputtednumber is 6 and the other number is 4? [2]