Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running some Fortran software (LBLRTM) and a shell-script that prepares input generates a number of files with names TAPE3, TAPE4, etc. For debugging purposes, I used file to identify the file type. file tells me:

TAPE3:  8086 relocatable (Microsoft)

My guess is that file is wrong here, and that it's just a binary file that happens to look like a 8086 relocatable. But what is a 8086 relocatable?

share|improve this question
    
oh, god, this is old school as hell. My dad used to use fortran when I was in diapers. –  Journeyman Geek Oct 25 '12 at 9:51
    
Fortran is still quite frequently used in science and engineering. See e.g. here. The code I'm trying to run is not mine, and I'm not proficient in Fortran, so my problem is kind of hard to debug (but this question is not about the actual debugging, but just a curiosity thingy). –  gerrit Oct 25 '12 at 9:57

1 Answer 1

up vote 2 down vote accepted

I think relocatable code predates Virtual Memory (VM). The alternative is absolute code, which has to be loaded at a specific location in physical memory (e.g. because it contains "Jump" instructions that have physical addresses as destinations)

The 8086 was backwards compatible with older processors which could only address 64KB of memory using 16-bit address registers. The 8086 also had 16-bit segment registers which were taken into account (e.g. when performing a jump instruction) basically the real address = address + segment<<4. This allowed (relocatable) programs to be located anywhere in 1MB memory aligned to 16 Byte "paragraph" boundaries (the 4-bit shift in the calculation above). Such programs can only address 64KB. Obviously the OS changes the segment register appropriately on a context-switch.

It seems clear that if your program manipulated the segment registers, perhaps so it could use more than 64 KB memory, it could not be relocated in this way.

Intel 8086/8088 program are sometimes relocatable or, more precisely, position independent, if they do not attempt to manipulate the segment registers. In this case, the OS can load the program anywhere in available memory on a 16 byte boundary, set the segment registers accordingly, and the program will run correctly. In this mode, however, the program only has access to four 64KB segments of memory.

It is also possible to be position independent and have access to more memory of the program takes the approach of biasing all segment manipulations to the initial values present at program startup.

Note that this discussion does not take into account the possibility that the load module format is, in itself, relocatable, requiring relocation by the loader. That is a third possibility.

From http://wiki.answers.com/Q/Why_are_8086_programs_called_relocatble_programs

Also

The 8086 object module formats permit specification of relocatable memory imaqes that may be linked to one another. Capabilities are provided that allow efficient use of the memory mapping facilities of the 8086 microprocessor.

8086 RELOCATABLE OBJECT MODULE FORMATS
An Intel Technical Specification

And

http://en.wikipedia.org/wiki/Intel_8086#Segmentation

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.