Wednesday, November 7, 2007

Self-Test Questions

Most low-level programming is carried out using assembly language. What typical scenario might mean that a program has to be written in the machine code?

When you are writing a program for a specific coomputer or a specific group of computers that are of the same make. An example could be for a super computer where the computer will be programed to do a unique job and therefor will be one of a kind. Also as it is coded in machine code, the program will run alot quicker as it does not need to be decoded.

Why do assembly language instructions written for one type of machine not run in another?

Because the instructions will be written for the specific processor installed which may not be the same in any other computer. The registers will be named differnetly and will therefor not run properly

What is the purpose of the following part of a typical assembly language instruction?:
  • Label - To name the instruction involved

  • Operation code - To carry out the job required

  • Operands - To define the registers used

  • Comments - To let a reader know what is going on.


  • Why are different modes of addressing encountered when programming in assembly language? Explain what is meant by immediate, direct, indirect and indexed addressing.
    So that you can load different registers into the ALU for example and do different things with them.
    Immediate Addressing where the data appears immediatly after the operation code
    Direct Addressing where the address is referring to a specific location
    Indirect Addressing The use on a number inside the register as a memory location.
    Indexed Addressing where the number in one address is used in combination with an other address to get the memory location.


    An assembly language instruction set may be broken down into subsets like logical and arithmetical and control. Show how 2 simple one-byte integer binary numbers may be added together.
    op codeoperands
    addal, bx


    Explain how a mask may be used to prevent alteration of top(most significant) three bits and the bottom (least significant) two bits but set the rest of the bits in the register to 1

    Not sure how to do this question. Ideas are that you must use the AND and OR op codes but i don't know how.

    No comments: