Comparison of RT-11 and PDP-11 Unix binary code headers ======================================================= -------+---------------------------------------+------------------------------------------+ File | | | Offset | RT-11 | Unix | =======+=======================================+==========================================+ | Normally ignored by RT-11: | Read by Unix when code executed: | 000000 | VIR in Radix-50 | amagic: Magic word, also Branch opcode | 000002 | Virtual high limit | atext: Size of code | 000004 | Job definition word ($JSX) | adata: Size of initialised data | 000006 | Reserved | abss: Size of uninitialised data | 000010 | Reserved | asyms: Size of symbol table | 000012 | Reserved | aentry: Entry address | 000014 | BPT trap PC | aunused: Not used | 000016 | BPT trap PSW | aflag: Relocation info | | +------------------------------------------+ 000020 | IOT trap PC | Start of Unix code, loaded to 000000 | 000022 | IOT trap PSW | | 000024 | Reserved | | 000026 | Reserved | | 000030 | Reserved | | 000032 | Overlay definition word | | 000034 | Trap vector PC (TRAP) | | 000036 | Trap vector PSW (TRAP) | | -------+---------------------------------------+ | | Read by RT-11 when code executed: | | 000040 | Entry address | | 000042 | Initial stack pointer | | 000044 | Job Status Word | | 000046 | USR swap address | | 000050 | Program high limit | | 000052 | Reserved | | 000054 | Reserved | | 000056 | Reserved | | -------+---------------------------------------+ | | Normally ignored by RT-11: | | 000060 | Reserved | | 000062 | Reserved | | 000064 | Overlay handler address | | | | | 000066 | Window definition blocks | | 000070 | | | to | Reserved | | 000356 | | | -------+---------------------------------------+ | | Read RT-11 when code executed: | | 000360 | Bitmap area | | to | Bit set for each 512-byte block to | | 000377 | be loaded | | -------+---------------------------------------+ | 000400 | Not loaded, usually used as initial | | | stack area with sp=001000 | | -------+---------------------------------------+ | 001000 | Start of RT-11 code, loaded to 001000 | | | | | | +------------------------------------------+ | | atext: Initialised data | -------+---------------------------------------+------------------------------------------+ | | atext+adata: Uninitialised data | | | End of loaded code | -------+---------------------------------------+------------------------------------------+ | Program high limit | atext+adata+bss: Symbol data | -------+---------------------------------------+------------------------------------------+ | atext+adata+abss+asyms: End of file Sample assembler code --------------------- ; Unix header at &0000-&000F (&o0000 to &o0017) ; --------------------------------------------- .word &0107 ; Magic number &o000407 .word CodeEnd-UxStart ; size of text .word DataEnd-CodeEnd ; size of initialised data .word ObjectEnd-DataEnd ; size of uninitialised data .word &0000 ; size of symbol data .word UxEntry-UxStart ; entry point .word &0000 ; not used .word &0001 ; no relocation info ; &o0020 : Unix loads code from here onwards to memory at &o0000 ; -------------------------------------------------------------- .UxStart ; RT-11 startup info at &0020 (&o0040) ; ------------------------------------ .blkb 32-$ ; Pad to &o40 .word RtEntry ; RT-11 entry point .word RtStackTop ; RT-11 top of stack .word &0000 ; Job Status Word .word &0000 ; USR swap address .word ObjectEnd ; Program high memory limit ; RT-11 code bitmap ; ----------------- .blkb 240-$ ; Pad to bitmap .byte %11000000 ; First two 512-byte blocks used .byte %00000000 .blkb 256-$ ; Pad to end of bitmap ; RT-11 stack space ; ----------------- .align &200 ; Pad to end of RT-11 header .RtStackTop ; RT-11 usually has stack here ; &o1000 : RT-11 loads code from here onwards into memory at &o1000 ; ----------------------------------------------------------------- RtEntry: ; Code entered by RT-11 UxEntry: ; Code entered by Unix CodeEnd: ; End of code for Unix header ; Initialised data here DataEnd: ; End of initialised data for Unix header ; Uninitialised data here, Unix sets all to zero on loading ObjectEnd: ; End of entire object ; Running RT-11 programs can move this limit upwards with the SETTOP call. ; Running Unix programs can move this limit upwards with the brk() call.