CSc 3210, Computer Organization and Programming
Fall 1998 
Quiz 2, 5 October 1998
Solutions


(1) Which register holds the offset of the last value pushed on the stack?
    
    SP

(2) Which two registers combine to form the address of the next instruction 
    to be executed?

    CS and IP

(3) Convert the following two SEGMENT:OFFSET values into a 20-bit absolute 
    address (Give your answer in HEX):
    (a) 0950:0100    

         09600

    (b) 08F1:0200

         09110

(4) Give one possible SEGMENT:OFFSET value (in HEX) for the 20-bit absolute
    address 1F1FF.

    1F1F:000F

(5) Why is the PTR operator necessary in the following instruction:

        ADD  WORD PTR [BX], 5

    Because the assembler would not know if the 5 is to be moved to a byte or
    a word.

(6) Consider the following data definition:

       Nums db 200, 100, 50, 0

     What will the value of the AX register be in HEX after the following
     instruction executes:

       MOV  AX, word ptr Nums

       AX =   64C8

(7) Let AX = 0102h and BX = 0304h. Assume that SP = 0100h and the portion 
    of stack segment from offset 00FCh to 0103h is as follows:

    offset:    00FC  00FD  00FE  00FF  0100  0101  0102  0103
    contents:   FF    FF    FF    FF    FF    FF    FF    FF

    What will be the contents of SP and the portion of stack segment
    from offset 00FCh to 0103h after the following two instructions
    have executed:

      PUSH  AX
      PUSH  BX

    SP = 00FC

    offset:    00FC  00FD  00FE  00FF  0100  0101  0102  0103
    contents:   04    03    02    01    FF    FF    FF    FF

(8) Consider the following set of Intel 8086 register contents.
    All values are given in HEX. All answers are in HEX.  VARX is a
    variable that is offset 1A4 (hex) into the data segment.

    IP =   020C

    CS =   1000      SP = 0100      AX =  1234

    DS =   1800      BP = 1ACB      BX =  1020

    SS =   2000      SI = 0040      CX =  ABCD

    ES =   2400      DI = 00E0      DX =  01FE

    (a) What is the ABSOLUTE ADDRESS of the next instruction to be executed.

      A. 020C     B. 120C     C. 1020C     D. 20100     E. None of the previous
 
    Answer: C

    (b) What is the ABSOLUTE ADDRESS of the variable VARX

      A. 01A4     B. 19A4     C. 101A4     D. 181A4     E. None of the previous

    Answer: D