Page 64 - DCAP507_SYSTEM_SOFTWARE
P. 64

System Software




                    Notes          4.1 Design of Assembler


                                   4.1.1 Addressing Options

                                   Absolute Addresses: These are the address fields that will not require to be customized by the
                                   loader.

                                   Relocatable Addresses: These are the addresses that will require to be accustomed if and only if
                                   the loader choose to position this program at a dissimilar memory location than the assembler
                                   allocated.
                                   Externally defined Symbols/Labels: The assembler does not recognize the addresses (or values)
                                   of these symbols and it depends on the loader to locate the programs comprising these symbols,
                                   load them into memory, and position the addresses of these symbols in the calling program.
                                   Indirect Addresses: The address refers to a location in memory that comprises the target address.
                                   Direct Addresses: Address of an explicit position in the physical memory.

                                   Immediate: The normal address will be utilized for an immediate value instead of an address.

                                       !
                                     Caution  Inside the instruction there must be a flag to specify this.




                                      Task  Make distinction between direct addresses and indirect addresses.

                                   4.1.2 Statement of Problem

                                   Assume that we are the "assembler"  attempting to  convert the program in the first  column
                                   below. We read the START instruction and observe that it is pseudo-op (directive) instruction
                                   (to the assembler) providing JOHN as the name of this program; the assembler must pass the
                                   name of this program to the loader. Observe that in this example the location counter depends
                                   on the number of bytes (4 per word).

                                   Intermediate Steps on Assembling a Program











                                   The program begins by setting the signed load address at 0. Next appears a LOAD instruction:
                                   LOAD l, VAL2. We require to ensure it is valid syntax. Look up the bit/hex configuration for the
                                   mnemonic in a table (machine operations table) and put the bit configuration for the LOAD
                                   (0001b) in the suitable place in the machine language instruction. Next we require the address of
                                   VAL2. Here, however, we do not recognize where VAL2 is, so we cannot supply its address.
                                   So we move on, we preserve a location counter representing the relative address of the instruction
                                   being processed; this counter is incremented by 4 bytes (length of a LOAD instruction). The next
                                   instruction is an ADD instruction. We observe the op-code (1000b), but we do not recognize the



          58                                LOVELY PROFESSIONAL UNIVERSITY
   59   60   61   62   63   64   65   66   67   68   69