/* * File: lput.c * * Object file output routine for IMP80 compiler * * Bob Eager August 2002 * */ #include "imp.h" #include "lput.h" /* * This is the routine that provides the sole interface to the compiler * proper. The action taken is determined by the parameter 'type'; this * also decides the meanings of the other parameters. * * The possible values for 'type', and their meanings, are as follows: * * type = 0 -- Initialisation call. Local initialisation is carried * out, and a module record is written to the object file. * p1 = address of module name (C string) * p2 = file pointer for object file * p3 = address of info record: * %integer (release << 16) | version * %byteintegerarray ladate(0:31); ! C string * %byteintegerarray translator ident(0:31); ! C string * * type = 1 -- Plant a fragment into the code area. * p1 = number of bytes to plant * p2 = destination offset in code area * p3 = address of bytes to be planted * If p3 is < 256, plant p1 bytes each containing the value * p3 at the location specified by p2. * type = 2 -- As for type 1, but plant in GLA. * type = 3 -- As for type 1, but plant in PLT. * type = 4 -- As for type 1, but plant in SST. * type = 5 -- As for type 1, but plant in UST. * * type = 6 -- Part of module complete. * p1 = (MAXAREA+1)*4 (size of information) * p2 = not used * p3 = address of (MAXAREA+1) word information field * containing the length of each area, and total for the * preceding set of part-module areas. * * type = 7 -- Module complete. Buffers are flushed, and a module end * record is written to the object file. * p1 = (MAXAREA+1)*4 (size of information) * p2 = not used * p3 = address of (MAXAREA+1) word information field * containing the length of each area, and total, for the * complete set of part-module areas. * * type = 10 -- Define a common area reference. * p1 = (AREA << 24) ! minimum expected length of common area, * where AREA defines the area containing the reference * p2 = location of a word relative to the start of the area * defined by AREA which will have the address of the * common area added to it when the object file is loaded * p3 = address of a string defining the name of the * referenced common area; this is truncated to the * first MAXNAME characters * * type = 11 -- Define an entry point. * p1 = code of area containing entry descriptor (usually * the GLA or the PLT). If the most significant bit is * set, this signifies that the entry point is to a main * program unit * p2 = location of the entry descriptor relative to the * start of the area defined by p1 * p3 = address of a string defining the entry point name; * this is truncated to the first MAXNAME characters * * type = 12 -- Define an external routine reference. * p1 = code of area containing reference block (usually * the GLA or the PLT). * p2 = location of the entry descriptor relative to the * start of the area defined by p1 * p3 = address of a string defining the name of the * referenced routine; this is truncated to the * first MAXNAME characters * * type = 13 -- Define an external routine reference which is to be * satisfied dynamically; i.e., when it is actually called. * If dynamic loading is not available, this is treated as * type 12. * p1 = code of area containing reference block (usually * the GLA). * p2 = location of the entry descriptor relative to the * start of the area defined by p1 * p3 = address of a string defining the name of the * referenced routine; this is truncated to the * first MAXNAME characters * * type = 14 -- Define a data entry point in GLA, UST or initialised * common. * p1 = (AREA << 24) ! length of data area, where AREA * identifies the area containing the data area. * If AREA is 6, this is an initialised common area * p2 = location of the data area relative to the start of * area AREA * p3 = address of a string defining the name of the * referenced data area; this is truncated to the * first MAXNAME characters * * type = 15 -- Define a data area reference in GLA, PLT or initialised * stack. * p1 = (AREA << 24) ! minimum expected length of data area, * where AREA defines the area containing the reference * p2 = location of a word relative to the start of the area * defined by AREA which will have the address of the * data area added to it when the object file is loaded * p3 = address of a string defining the name of the * referenced data area; this is truncated to the * first MAXNAME characters * * type = 17 -- Define a data entry point in UST. * p1 = length of data area * p2 = location of the data area relative to the start of * UST * p3 = address of a string defining the name of the * referenced data area; this is truncated to the * first MAXNAME characters * * type = 19 -- Relocate a 32 bit word. * p1 = code for area containing the reference * p2 = byte displacement within area p1 of a word to be * relocated at load time by the base of the area * specified by p3 * p3 = code for area base * * type = 25 -- Request a library which is to be searched during the * link process. * p1 = unused * p2 = unused * p3 = address of a string defining the name of the * the library to be searched; this is truncated to * the first MAXNAME characters * * type = 31 -- Plant a fragment into the code area. * p1 = number of bytes to plant * p2 = destination offset in code area * p3 = address of bytes to be planted * If p3 is < 256, plant p1 bytes each containing the value * p3 at the location specified by p2. * type = 32 -- As for type 31, but plant in GLA. * type = 33 -- As for type 31, but plant in PLT. * type = 34 -- As for type 31, but plant in SST. * type = 35 -- As for type 31, but plant in UST. * type = 36 -- As for type 31, but plant in initialised common area. * type = 37 -- As for type 31, but plant in initialised stack area. * * type = 41 -- Repeated initialisation of code area with up to * 255 bytes of information. * p1 = (number of bytes << 24) ! number of copies * p2 = displacement from area start at which initialisation * is to commence * p3 = address of the initialising data * type = 42 -- As for type 41, but plant in GLA. * type = 43 -- As for type 41, but plant in PLT. * type = 44 -- As for type 41, but plant in SST. * type = 45 -- As for type 41, but plant in UST. * type = 46 -- As for type 41, but plant in initialised common area. * type = 47 -- As for type 41, but plant in initialised stack area. * */ void lput(int type, int p1, int p2, int p3) { return; } /* * End of file: lput.c * */