go to previous page   go to home page   go to next page        

Answer:

Of course.

Addresses in Memory

An address is a 32-bit pattern, and any 32-bit word of main storage can hold it. For example, here is a fragment of a program:

          .text
sub1:     li       $v0,4
          la       $a0,messH
          syscall
          jr       $ra
          .data
messH:    .asciiz  "Hello "

          .text
sub2:     li       $v0,4
          la       $a0,messW
          syscall
          jr       $ra
          .data
messW:    .asciiz  "World\n"

          .data
sub1add:  .word sub1
sub2add:  .word sub2

The symbolic address sub1 stands for whatever 32-bit address the first byte of the first subroutine gets loaded into at run time. In the .data section at the end of the program, the address represented by sub1 is stored in memory, at the symbolic address sub1add.

The source code interleaves text and data, but the assembler and loader will put all machine code into the text section of memory and all data into the data section of memory.

QUESTION 2:

If the address of sub1 is 0x00400000, what bit pattern do you expect to see at sub1add?