Machine Independent Assembler Features
Machine Independent Assembler Features
TYPES OF LOADER
ABSOLUTE LOADER BOOTSTRAP LOADER RELOCATING LOADER DIRECT LINKING LOADER
ABSOLUTE LOADER
Begin read Header record verify program name and length read first Text record E.g., convert the pair of while record type is <> E do characters 14 (two bytes) in the object program to a single begin byte with hexadecimal value 14 {if object code is in character form, convert into internal representation} move object code to specified location in memory read next object program record end jump to address specified in End record end
Bootstrap Loader
When a computer is first turned on or restarted, a special type of absolute loader, called bootstrap loader is executed This bootstrap loads the first program to be run by the computer -- usually an operating system The bootstrap itself begins at address 0 It loads the OS starting address 0x80 No header record, end record and control information, the object code is consecutive bytes of memory
Example: Character:2(50) 50-48=2 2<10,the conversion is complete. Character: A(65) 65-48=17 17 is not less than 10.i.e)the conversion is not complete. 17-7=10
zModification record A modification record is used to describe each part ofthe object code that must be changed when theprogram is relocated. Relocation bit A relocation bit associated with each word of object code is used to indicate whether or not this word should be changed when the program is relocated. Hardware relocation Some computers provide a hardware relocation capability that eliminates some of the need for the loader to perform program relocation.
In the object program, there is one Modification record for each value that must be changed during relocation. Each modification record specifies the starting address and length of the field whose value is to be altered. Col. 1 M Col. 2-7 Starting location of the address field to be modified, relative to the beginning of the program Col. 8-9 Length of the address field to be modified, in halfbytes If the field contains an odd number of half-bytes, the starting location begins in the middle of the first byte.
Modification Record
For complex machines Also called RLD specification
Relocation and Linkage Directory
Modification record col 1: M col 2-7: relocation address col 8-9: length (halfbyte) col 10: flag (+/-) col 11-17: segment name
Fig. 3.4
Fig. 3.7