mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-10-23 08:24:18 +00:00
Upload
Digital Research
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
$ set noon
|
||||
$ cp68 :== $bin:c68.exe
|
||||
$ c068 :== $bin:c068.exe
|
||||
$ c168 :== $bin:c168.exe
|
||||
$ as68 :== $bin:as68.exe
|
||||
$ cp68 'p1'.c 'p1'.i
|
||||
$ c068 'p1'.i 'p1'.ic 'p1'.st 'p2'
|
||||
$ c168 'p1'.ic 'p1'.s -L
|
||||
$ as68 -l -u 'p1'.s
|
||||
$ delete 'p1'.s;*,'p1'.ic;*,'p1'.i;*,'p1'.st;*
|
@@ -0,0 +1,13 @@
|
||||
#define HDSIZE (sizeof couthd) /**.o file header size*/
|
||||
struct hdr {
|
||||
short ch_magic; /*c.out magic number 060016 = $600E*/
|
||||
long ch_tsize; /*text size*/
|
||||
long ch_dsize; /*data size*/
|
||||
long ch_bsize; /*bss size*/
|
||||
long ch_ssize; /*symbol table size*/
|
||||
long ch_stksize; /*stack size*/
|
||||
long ch_entry; /*entry point*/
|
||||
short ch_rlbflg; /*relocation bits suppressed flag*/
|
||||
} couthd={0};
|
||||
|
||||
#define MAGIC 0x601a /* bra .+26 instruction*/
|
@@ -0,0 +1,15 @@
|
||||
e:vax LINK68.C r
|
||||
e:vax LNKMESS.C r
|
||||
e:vax PREPROC.C r
|
||||
e:vax RELOC.C r
|
||||
e:vax LOADR.S r
|
||||
e:vax OVHDLR.S r
|
||||
e:vax TMAIN.S r
|
||||
e:vax TOVH.S r
|
||||
e:vax TOVH2.S r
|
||||
e:vax MACHINE.68K r
|
||||
e:vax MACHINE.H r
|
||||
e:vax MACHINE.I86 r
|
||||
e:vax MACHINE.VAX r
|
||||
e:vax cout.h r
|
||||
e:vax link68.h r
|
@@ -0,0 +1 @@
|
||||
[tex[500], abs, sym, locals] foo.688k = asdfasdf.o, ruitoof.o, adskoi.o, thisdd.o, junk.o, this.o, that.o, jfjfjf.o, ijijiji.o,adskoi.o, thisdd.o, junk.o, this.o, that.o, jfjfjf.o, ijijiji.o
|
2263
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v101/newlink/link68.c
Normal file
2263
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v101/newlink/link68.c
Normal file
File diff suppressed because it is too large
Load Diff
205
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v101/newlink/link68.h
Normal file
205
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v101/newlink/link68.h
Normal file
@@ -0,0 +1,205 @@
|
||||
|
||||
#define PROGNAME "LINK68" /* name of this program */
|
||||
#define CBMAIN "__cbmain" /* main entry point in CBASIC program */
|
||||
|
||||
#include "machine.h"
|
||||
/* format of a symbol entry in the main table*/
|
||||
|
||||
#define SEEKREL 1 /*relative seek flag*/
|
||||
|
||||
#define DRIVELEN 2 /* drive spec length -- FOO */
|
||||
|
||||
#define LINELEN 132 /* maximum input/output string length */
|
||||
#define FNAMELEN 15 /* drive, name, and type, null terminated */
|
||||
#define MAXOVLS 255 /* maximum number of overlays */
|
||||
#define MAXOVDEP 5 /* maximum nesting depth for overlays */
|
||||
#define ROOT 0 /* overlay number for root */
|
||||
#define EOS '\0' /* end of string */
|
||||
#define JSRL 0x4EB9 /* jsr to long address */
|
||||
#define JMPL 0x4EF9 /* jmp to long address */
|
||||
#define BDOSFNAM 12 /* length of a filename for a BDOS call */
|
||||
#define PREORDER 1 /* preorder search of command tree */
|
||||
#define POSTORDER 2 /* postorder search of command tree */
|
||||
#define DEFTYPE ".O" /* default file type */
|
||||
#define DEFLEN 2 /* length of deftype */
|
||||
|
||||
extern VOID banner(); /* prints sign-on banner */
|
||||
|
||||
/* stuff for error processor */
|
||||
|
||||
extern VOID errorx(); /* error handler in main module */
|
||||
extern VOID putarrow(); /* print arrow under bad token */
|
||||
|
||||
|
||||
extern char *errst1; /* used for passing values to */
|
||||
extern char *errst2; /* error processor */
|
||||
extern long errnum1;
|
||||
extern long errnum2;
|
||||
|
||||
/* some global file stuff */
|
||||
|
||||
extern char cmdline[]; /* command line buffer */
|
||||
extern FILE *fopen();
|
||||
extern FILE *fopenb();
|
||||
extern char tdisk[]; /* drive for temp files */
|
||||
|
||||
|
||||
/* option flag/switches */
|
||||
|
||||
extern int mapflg; /* generate a load map */
|
||||
extern int absflg; /* absolute load */
|
||||
extern int tdrflg; /* temp files go on spec. drive */
|
||||
extern int symflg; /* set to output symbol table */
|
||||
extern int ovflag; /* set if loading overlays */
|
||||
extern int ignflg; /* ignore 16-bit address overflow */
|
||||
extern int udfflg; /* allow undefined symbols */
|
||||
extern int chnflg; /* chained program */
|
||||
extern int dmpflg; /* dump symbols -- undocumented */
|
||||
|
||||
/* flags for input files */
|
||||
|
||||
#define FNALL 0100000 /* don't search library */
|
||||
#define FNINCL 0040000 /* load named symbol from file */
|
||||
#define FNSYM 0020000 /* symbol name -- not a file */
|
||||
#define FNLOCS 0010000 /* put locals in symbol table */
|
||||
|
||||
/* error numbers -- see errorx() in main module for exact messages */
|
||||
|
||||
#define BADCHAR 1 /* illegal character */
|
||||
#define BADSYNT 2 /* catchall syntax error */
|
||||
#define CMDTRUNC 3 /* unexpected end of command */
|
||||
#define BADOPT 4 /* junk or out-of-place option */
|
||||
#define NOROOM 5 /* no more heap space */
|
||||
#define BADNUM 6 /* ill-formed hex number */
|
||||
#define MORECMD 7 /* parse done - stuff left over */
|
||||
#define BADINFIL 8 /* can't open file for reading */
|
||||
#define XTRACFIL 9 /* nested command file */
|
||||
#define XESSOVLS 10 /* too many overlays */
|
||||
#define CMDLONG 11 /* command line too long */
|
||||
#define OVTODEEP 12 /* overlays nested too deep */
|
||||
#define DISCONTIG 13 /* discontig. load with overlays*/
|
||||
#define BADOVREF 14 /* illegal reference to overlay */
|
||||
#define READERR 15 /* file read error */
|
||||
#define FORMATERR 16 /* file format error */
|
||||
#define NORELOC 17 /* no relocation bits in file */
|
||||
#define BADSYMFLG 18 /* invalid symbol flags */
|
||||
#define DUPDEF 19 /* duplicate definition */
|
||||
#define SYMOFL 20 /* symbol table overflow */
|
||||
#define BADTEMP 21 /* cannot open temp file */
|
||||
#define INTERR 22 /* internal error */
|
||||
#define UNDEF 23 /* undefined symbol */
|
||||
#define BADOUT 24 /* cannot open output file */
|
||||
#define SEEKERR 25 /* seek read error */
|
||||
#define SHRTOFL 26 /* short address overflow */
|
||||
#define TSZERR 27 /* text size error */
|
||||
#define OWRTERR 28 /* output file write error */
|
||||
#define REOPNERR 29 /* unable to reopen temp file */
|
||||
#define RELADROFL 30 /* relative address overflow */
|
||||
#define BADRELOC 31 /* bad relocation flag */
|
||||
|
||||
|
||||
/* command tree structures */
|
||||
|
||||
#define NOPARENT -1 /* normal NULL == 0 */
|
||||
|
||||
|
||||
struct filenode { /* info about input file */
|
||||
char fnfname[FNAMELEN]; /* input file name */
|
||||
short fnflags; /* option flags for file */
|
||||
struct filenode *fnnext; /* next file in list */
|
||||
};
|
||||
|
||||
|
||||
struct jmpblock { /* used for building overlay calls */
|
||||
char *globref; /* pointer to global symbol */
|
||||
struct jmpblock *nxtjbl; /* next jump block in list */
|
||||
};
|
||||
|
||||
struct ovtrnode { /* info about each overlay */
|
||||
char ovfname[FNAMELEN]; /* output filename */
|
||||
long ovtxbase; /* base of text segment */
|
||||
long ovdtbase; /* base of init. data segment */
|
||||
long ovbsbase; /* base of local uninit. data */
|
||||
long ovcap; /* first word above overlay */
|
||||
char *ovfsym; /* 1st sym tab ent for module */
|
||||
short ovnxtsib; /* next sibling overlay node */
|
||||
short ovfstkid; /* first descendant overlay */
|
||||
short ovparent; /* parent node link */
|
||||
struct filenode *ovflist; /* list of input files */
|
||||
struct jmpblock *ovjblck; /* list of jump blocks */
|
||||
};
|
||||
|
||||
extern struct ovtrnode *ovtree[MAXOVLS+1]; /* leave room for root info */
|
||||
extern int numovls; /* number of actual overlays */
|
||||
|
||||
/* structure of entry in output overlay table */
|
||||
|
||||
struct ovtab {
|
||||
char tbname[8]; /* file name -- pad with blanks */
|
||||
char tbext[4]; /* file extension -- no dot (.) */
|
||||
long tbldpt; /* load point for module */
|
||||
};
|
||||
|
||||
/* structure of an indirect call to an overlay routine */
|
||||
|
||||
struct ovcalblk {
|
||||
short jsrovh; /* call overlay handler */
|
||||
long ovhandlr; /* address of overlay handlr */
|
||||
long ovtabad; /* pointer into overlay table */
|
||||
short jmprout; /* jump to overlayed routine */
|
||||
long routaddr; /* address to jump to */
|
||||
};
|
||||
|
||||
|
||||
/* symbol table stuff */
|
||||
|
||||
#define SYNAMLEN 8
|
||||
|
||||
struct symtab {
|
||||
char name[SYNAMLEN]; /*symbol name*/
|
||||
short flags; /*bit flags*/
|
||||
long vl1; /*symbol value*/
|
||||
short ovlnum; /*overlay number*/
|
||||
char *tlnk; /*table link*/
|
||||
};
|
||||
|
||||
#define OSTSIZE 14 /*entry length on object file without tlnk*/
|
||||
|
||||
/* flags for symbols*/
|
||||
# define SYDF 0100000 /*defined*/
|
||||
# define SYEQ 0040000 /*equated*/
|
||||
# define SYGL 0020000 /*global - entry or external*/
|
||||
# define SYER 0010000 /*equated register*/
|
||||
# define SYXR 0004000 /*external reference*/
|
||||
# define SYDA 0002000 /*DATA based relocatable*/
|
||||
# define SYTX 0001000 /*TEXT based relocatable*/
|
||||
# define SYBS 0000400 /*BSS based relocatable*/
|
||||
|
||||
struct irts {
|
||||
char *irle; /*ptr to last entry in chain*/
|
||||
char *irfe; /*ptr to first entry in chain*/
|
||||
};
|
||||
#ifdef VAX
|
||||
struct {
|
||||
short loword;
|
||||
short hiword;
|
||||
};
|
||||
#endif
|
||||
#ifdef PDP11
|
||||
struct {
|
||||
short loword;
|
||||
short hiword;
|
||||
};
|
||||
#endif
|
||||
#ifdef MC68000
|
||||
struct {
|
||||
short hiword;
|
||||
short loword;
|
||||
};
|
||||
#endif
|
||||
extern long textstart;
|
||||
extern long datastart;
|
||||
extern long bssstart;
|
||||
extern int Bflag;
|
||||
extern int Dflag;
|
||||
extern int Zflag;
|
@@ -0,0 +1 @@
|
||||
cl link68,preproc,lnkmess link68
|
@@ -0,0 +1,199 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include "link68.h"
|
||||
|
||||
char *errst1 = 0;
|
||||
char *errst2 = 0;
|
||||
long errnum1 = 0;
|
||||
long errnum2 = 0;
|
||||
|
||||
char progname[] = PROGNAME;
|
||||
|
||||
extern endit();
|
||||
extern int exstat;
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* banner() -- print the sign-on message */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
banner()
|
||||
{
|
||||
printf("--------------------------------------------------\n");
|
||||
printf("LINK68 Overlay Linker Release 0.f\n");
|
||||
printf("Serial No. XXXX-0000-654321 All Rights Reserved\n");
|
||||
printf("Copyright (c) 1983 Digital Research, Inc.\n");
|
||||
printf("--------------------------------------------------\n\n");
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* errorx(errnum, ptr) -- error processor for all modules. */
|
||||
/* */
|
||||
/* Does the action specified for the error number. The usual */
|
||||
/* action is to print a message and exit. */
|
||||
/* */
|
||||
/* Any values other than those passed through the two parameters */
|
||||
/* are passed in the global variables errst1, errval1, & errval2. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
extern putarrow();
|
||||
VOID
|
||||
errorx(errnum, st)
|
||||
|
||||
int errnum; /* error number */
|
||||
BYTE *st; /* usually a string, not always */
|
||||
|
||||
{
|
||||
switch (errnum)
|
||||
{
|
||||
case BADCHAR:
|
||||
putarrow();
|
||||
printf("%s: ILLEGAL CHARACTER: '%s'\n",
|
||||
progname, st);
|
||||
endit(-1);
|
||||
case BADSYNT:
|
||||
putarrow();
|
||||
printf("%s: SYNTAX ERROR, EXPECTED: %s\n",
|
||||
progname, st);
|
||||
endit(-1);
|
||||
case CMDTRUNC:
|
||||
putarrow();
|
||||
printf("%s: UNEXPECTED END OF COMMAND STREAM\n", progname);
|
||||
endit(-1);
|
||||
case BADOPT:
|
||||
putarrow();
|
||||
printf("%s: UNRECOGNIZED OR MISPLACED OPTION NAME: \"%s\"\n",
|
||||
progname, st);
|
||||
endit(-1);
|
||||
case NOROOM:
|
||||
printf("%s: HEAP OVERFLOW -- NOT ENOUGH MEMORY\n");
|
||||
endit(-1);
|
||||
case BADNUM:
|
||||
putarrow();
|
||||
printf("%s: IMPROPERLY FORMED HEX NUMBER: \"%s\"\n",
|
||||
progname, st);
|
||||
endit(-1);
|
||||
case MORECMD:
|
||||
putarrow();
|
||||
printf("%s: PARSE END BEFORE COMMAND STREAM END\n", progname);
|
||||
endit(-1);
|
||||
case BADINFIL:
|
||||
printf("%s: CANNOT OPEN %s FOR INPUT\n", progname, st);
|
||||
endit(-1);
|
||||
case XTRACFIL:
|
||||
putarrow();
|
||||
printf("%s: NESTED COMMAND FILES NOT ALLOWED\n", progname);
|
||||
endit(-1);
|
||||
case XESSOVLS:
|
||||
printf("%s: TOO MANY OVERLAYS\n", progname);
|
||||
endit(-1);
|
||||
case CMDLONG:
|
||||
printf("%s: COMMAND LINE TOO LONG\n", progname);
|
||||
endit(-1);
|
||||
case OVTODEEP:
|
||||
putarrow();
|
||||
printf("%s: OVERLAYS NESTED TOO DEEPLY\n", progname);
|
||||
endit(-1);
|
||||
case DISCONTIG:
|
||||
printf("%s: CANNOT SET DATA OR BSS BASE WHEN USING OVERLAYS\n",
|
||||
progname);
|
||||
endit(-1);
|
||||
case BADOVREF:
|
||||
printf("%s: ILLEGAL REFERENCE TO OVERLAY SYMBOL %s FROM MODULE %s\n",
|
||||
progname, st, errst1);
|
||||
exstat++;
|
||||
return;
|
||||
case READERR:
|
||||
printf("%s: READ ERROR ON FILE: %s\n", progname, st);
|
||||
endit(-1);
|
||||
case FORMATERR:
|
||||
printf("%s: FILE FORMAT ERROR IN %s\n", progname, st);
|
||||
endit(-1);
|
||||
case NORELOC:
|
||||
printf("%s: NO RELOCATION BITS IN %s\n", progname, st);
|
||||
endit(-1);
|
||||
case BADSYMFLG:
|
||||
printf("%s: INVALID SYMBOL FLAG IN %s, SYMBOL: \"%s\"\n",
|
||||
progname, st, errst1);
|
||||
endit(-1);
|
||||
case DUPDEF:
|
||||
printf("%s: \"%s\" DOUBLY DEFINED IN %s\n", progname, errst1, st);
|
||||
return;
|
||||
case SYMOFL:
|
||||
printf("%s: SYMBOL TABLE OVERFLOW\n", progname);
|
||||
endit(-1);
|
||||
case BADTEMP:
|
||||
printf("%s: UNABLE TO OPEN TEMPORARY FILE: %s\n", progname, st);
|
||||
endit(-1);
|
||||
case INTERR:
|
||||
printf("%s: INTERNAL ERROR IN %s\n", progname, st);
|
||||
endit(-1);
|
||||
case UNDEF:
|
||||
printf("%s: UNDEFINED SYMBOL(S):\n", progname);
|
||||
return;
|
||||
case BADOUT:
|
||||
printf("%s: UNABLE TO CREATE FILE: %s\n", progname, st);
|
||||
endit(-1);
|
||||
case SEEKERR:
|
||||
printf("%s: SEEK ERROR ON FILE: %s\n", progname, st);
|
||||
endit(-1);
|
||||
case SHRTOFL:
|
||||
printf("%s: SHORT ADDRESS OVERFLOW AT %lx IN %s\n", progname,
|
||||
errnum1, st);
|
||||
return;
|
||||
case TSZERR:
|
||||
printf("%s: TEXT SIZE ERROR IN %s\n", progname, st);
|
||||
return;
|
||||
case OWRTERR:
|
||||
printf("%s: WRITE ERROR ON FILE: %s\n", progname, st);
|
||||
return;
|
||||
case REOPNERR:
|
||||
printf("%s: UNABLE TO REOPEN FILE: %s\n", progname, st);
|
||||
endit(-1);
|
||||
case RELADROFL:
|
||||
printf("%s: RELATIVE ADDRESS OVERFLOW AT %lx IN %s\n", progname,
|
||||
errnum1, st);
|
||||
return;
|
||||
case BADRELOC:
|
||||
printf("%s: INVALID RELOCATION FLAG IN %s\n", st);
|
||||
endit(-1);
|
||||
default:
|
||||
printf("%s: INTERNAL ERROR -- UNSPECIFIED ERROR\n", progname);
|
||||
endit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* usage() -- prints a simple help message */
|
||||
/* */
|
||||
/* This routine is called if only the program name is typed */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
VOID
|
||||
usage()
|
||||
{
|
||||
printf("USAGE: %s [options] output = file, file, ...\n\n", progname);
|
||||
printf("THE OPTIONS ARE:\n\n");
|
||||
printf("\tABSOLUTE\n");
|
||||
printf("\tBSSBASE[hex number]\n");
|
||||
printf("\tCOMMAND[filename]\n");
|
||||
printf("\tCHAINED\n");
|
||||
printf("\tDATABASE[hex number]\n");
|
||||
printf("\tIGNORE\n");
|
||||
printf("\tLOCALS\n");
|
||||
/*printf("\tMAP\n");*/
|
||||
printf("\tNOLOCALS\n");
|
||||
printf("\tSYMBOLS\n");
|
||||
printf("\tTEMPFILES[drive]\n");
|
||||
printf("\tTEXTBASE[hex number]\n");
|
||||
printf("\tUNDEFINED\n");
|
||||
}
|
||||
|
||||
|
337
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v101/newlink/loadr.s
Normal file
337
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v101/newlink/loadr.s
Normal file
@@ -0,0 +1,337 @@
|
||||
|
||||
|
||||
|
||||
|
||||
*********************************
|
||||
* *
|
||||
* Relocating overlay loader *
|
||||
* modified from *
|
||||
* Function 59 -- Program Load *
|
||||
* *
|
||||
* March 17, 1983 *
|
||||
* *
|
||||
* Does not load program root. *
|
||||
* Leaves base page and stack as *
|
||||
* set up by actual BDOS 59 *
|
||||
* *
|
||||
*********************************
|
||||
|
||||
.globl _loadr * this routine is public
|
||||
|
||||
secsize = 128 * CP/M sector size
|
||||
|
||||
* d0 always contains the return parameter from pgmld
|
||||
* d1 is the return register from local subroutines
|
||||
* a0 contains the pointer to the Load Parm Block passed to pgmld
|
||||
|
||||
* Return parameters in d0 are:
|
||||
* 00 - function successful
|
||||
* 01 - insufficient memory or bad header in file
|
||||
* 02 - read error on file
|
||||
* 03 - bad relocation information in file
|
||||
|
||||
|
||||
* Entry point for Program Load routine
|
||||
_loadr:
|
||||
clr.l d0 * start with return parm cleared
|
||||
bsr gethdr * get header
|
||||
tst d0
|
||||
bne lddone * if unsuccessful, return
|
||||
bsr setaddr * set up load addresses
|
||||
tst d0
|
||||
bne lddone * if unsuccessful, return
|
||||
bsr rdtxt * read code and data text segments into mem
|
||||
tst d0
|
||||
bne lddone * if unsuccessful, return
|
||||
move.l tstart,d7
|
||||
cmp.l cseg,d7
|
||||
beq noreloc
|
||||
bsr reloc * do relocation if necessary
|
||||
noreloc:
|
||||
tst d0
|
||||
bne lddone
|
||||
lddone:
|
||||
rts
|
||||
|
||||
* Subroutines
|
||||
|
||||
readseq:
|
||||
* CP/M read sequential function
|
||||
move.l d0,-(sp) * save return parm
|
||||
move.l FCBPtr(a0),d1
|
||||
moveq #20,d0 * read seq function
|
||||
trap #2 * call bdos
|
||||
move.l d0,d1 * return parm in d1
|
||||
move.l (sp)+,d0
|
||||
rts
|
||||
|
||||
|
||||
setdma:
|
||||
* CP/M set dma function
|
||||
move.l d0,-(sp) * save return parm
|
||||
moveq #26,d0 * set dma function
|
||||
trap #2 * call bdos
|
||||
move.l (sp)+,d0 * restore d0
|
||||
rts
|
||||
|
||||
|
||||
gethdr:
|
||||
* Get header into buffer in data segment
|
||||
move.l BasPage(a0),d1
|
||||
move.l d1,basepg
|
||||
bsr setdma
|
||||
bsr readseq
|
||||
tst d1 * read ok?
|
||||
bne badhdr * if no, return bad
|
||||
moveq #18,d7
|
||||
movea.l BasPage(a0),a5
|
||||
movea.l #hdr,a6
|
||||
geth1: move.w (a5)+,(a6)+ * move header into hdr
|
||||
dbf d7,geth1
|
||||
rts
|
||||
badhdr: moveq #2,d0
|
||||
rts
|
||||
|
||||
|
||||
setaddr:
|
||||
* Set up load addresses for cseg, dseg, bss, basepg, and stack
|
||||
move.w magic,d6
|
||||
cmpi.w #$601a,d6
|
||||
bne badadr * if magic nmbr <> 601a, skip
|
||||
move.l bpsize,symsize
|
||||
move.l LoAdr(a0),cseg
|
||||
move.l cseg,d7
|
||||
add.l csize,d7
|
||||
addq.l #1,d7
|
||||
bclr #0,d7
|
||||
move.l d7,dseg
|
||||
add.l dsize,d7
|
||||
addq.l #1,d7
|
||||
bclr #0,d7
|
||||
move.l d7,bseg
|
||||
* cseg, dseg, bseg set up
|
||||
rts
|
||||
badadr: moveq.l #1,d0
|
||||
rts
|
||||
|
||||
|
||||
movebuf:
|
||||
* move (d3) bytes from the base page buffer to (a2)
|
||||
* uses d6
|
||||
movea.l basepg,a1
|
||||
move.l #secsize,d6
|
||||
sub.w bufbyts,d6 * address to move from =
|
||||
adda.w d6,a1 * (basepg) + secsize - (bufbyts)
|
||||
sub.w d3,bufbyts * update # bytes buffered
|
||||
bra moveb2
|
||||
moveb1: move.b (a1)+,(a2)+ * do the move
|
||||
moveb2: dbf d3,moveb1
|
||||
rts
|
||||
|
||||
|
||||
rdtxt:
|
||||
* Read code and data text into memory
|
||||
* during this routine, a2 is always the load address,
|
||||
* d2 is number of bytes left to load
|
||||
move.w #secsize-28,d7
|
||||
move.w d7,bufbyts * indicate # bytes of text in buffer
|
||||
move.w #2,loop * do for code, data segments
|
||||
move.l cseg,a2 * start at cseg
|
||||
move.l csize,d2 * for csize bytes
|
||||
rdtxt3:
|
||||
clr.l d3
|
||||
move.w bufbyts,d3
|
||||
cmp.l d2,d3 * # bytes in buffer >= # bytes to load?
|
||||
blt rdtxt4
|
||||
move.l d2,d3
|
||||
bsr movebuf * if yes, move # bytes to load
|
||||
bra finrd
|
||||
rdtxt4:
|
||||
sub.l d3,d2 * if no, update # bytes to load
|
||||
bsr movebuf * move remainder of buffer
|
||||
move.l #secsize,d3 * d3 = secsize fo following loop
|
||||
rdtxt5:
|
||||
cmp.l d3,d2 * have at least one more full sector?
|
||||
blt rdtxt6
|
||||
move.l a2,d1
|
||||
bsr setdma * if yes, set up dma address
|
||||
bsr readseq * read next sector
|
||||
tst.w d1
|
||||
bne rdbad * if no good, exit
|
||||
sub.l d3,d2 * decrement # bytes to load
|
||||
adda.l #secsize,a2 * increment dma address
|
||||
bra rdtxt5
|
||||
rdtxt6:
|
||||
tst.l d2 * any more bytes to read?
|
||||
beq finrd
|
||||
move.l basepg,d1
|
||||
bsr setdma
|
||||
bsr readseq * if yes, read into base page
|
||||
tst.w d1
|
||||
bne rdbad
|
||||
move.w d3,bufbyts * indicate that we've buffered a sector
|
||||
move.l d2,d3
|
||||
bsr movebuf * move remainder of segment
|
||||
finrd:
|
||||
move.l dseg,a2 * set up to load data segment
|
||||
move.l dsize,d2
|
||||
sub.w #1,loop
|
||||
bne rdtxt3
|
||||
move.l bseg,a2 * clear the bss segment
|
||||
move.l bsize,d2
|
||||
beq rdtxt8
|
||||
rdtxt7: clr.b (a2)+
|
||||
subq.l #1,d2
|
||||
bne rdtxt7
|
||||
rdtxt8: rts
|
||||
|
||||
rdbad: moveq.l #2,d0
|
||||
rts
|
||||
|
||||
|
||||
relocword:
|
||||
* relocate word at (a2) based on reloc bits at (a3)
|
||||
* lsb of d2 indicates whether previous word was 1st half of long-word
|
||||
move.w (a3)+,d7 * get relocation info
|
||||
andi.w #7,d7 * strip off symbol table bits
|
||||
lsl #1,d7 * multiply by 2
|
||||
jmp 2(pc,d7)
|
||||
|
||||
bra relabs
|
||||
bra reldata
|
||||
bra relcode
|
||||
bra relbss
|
||||
bra relbad
|
||||
bra rellong
|
||||
bra relbad
|
||||
bra relop
|
||||
|
||||
relbad: move.l (sp)+,d0 * pop return address
|
||||
moveq #3,d0 * return bad relocation to main routine
|
||||
rts
|
||||
|
||||
relabs:
|
||||
relop: bclr #0,d2 * reset long word flag
|
||||
tst.w (a2)+ * point to next word of segment
|
||||
rts
|
||||
|
||||
rellong:
|
||||
bset #0,d2 * set long word flag
|
||||
tst.w (a2)+ * point to next word of segment
|
||||
rts
|
||||
|
||||
reldata:
|
||||
relbss:
|
||||
relcode:
|
||||
bclr #0,d2 * long word flag set?
|
||||
bne relc1 * if yes, skip
|
||||
move.w (a2),d6
|
||||
add.w d5,d6
|
||||
move.w d6,(a2)+
|
||||
rts
|
||||
|
||||
relc1: tst.w -(a2) * point to first word of long
|
||||
move.l (a2),d6
|
||||
add.l d5,d6
|
||||
move.l d6,(a2)+ * note that a2 points past long word
|
||||
rts
|
||||
|
||||
|
||||
reloc:
|
||||
* Modify address references of code and data segments based on relocation bits
|
||||
* During this routine,
|
||||
* a2 points to text file to relocate
|
||||
* a3 points to relocation word in basepg
|
||||
* lsb of d2 is long word flag (set on reloc type 5, reset on next word)
|
||||
* d3 is # words in relocation buffer
|
||||
* d4 is nmbr of words left to relocate
|
||||
* d5 is relocation offset
|
||||
|
||||
move.l basepg,d1
|
||||
bsr setdma * we will always read into base page
|
||||
* skip past the symbol table
|
||||
move.l symsize,d7
|
||||
divu #secsize,d7 * calculate how many sectors to skip
|
||||
* note that max # symbols is 8k, which is 896 sectors of 128 bytes
|
||||
move.w d7,d6 * d6 is nmbr sectors to skip
|
||||
swap d7 * d7 is nmbr bytes to skip
|
||||
move.w bufbyts,d3
|
||||
sub.w d7,d3 * subtract bytes to skip from buffer
|
||||
bge skip1
|
||||
addi #secsize,d3 *if amt in buffer < # bytes to skip,
|
||||
addq #1,d6 * read in 1 extra sector
|
||||
skip1: move.l basepg,a3
|
||||
adda #secsize,a3
|
||||
suba.w d3,a3 * set up a3 to point to buffer
|
||||
lsr #1,d3 * d3 is nmbr words in buffer
|
||||
bra skip3
|
||||
skip2:
|
||||
bsr readseq * read next symbol table sector
|
||||
tst.w d1
|
||||
bne rdbad
|
||||
skip3: dbf d6,skip2
|
||||
* we got past symbol table
|
||||
* a3, d3 are set up
|
||||
move.l cseg,d5
|
||||
move.l d5,a2 * relocate cseg first
|
||||
sub.l tstart,d5 * d5 contains the relocation offset
|
||||
move.l csize,d4 * nmbr of bytes to relocate
|
||||
move.w #2,loop * we're going to relocate 2 segments
|
||||
reloc1:
|
||||
* relocate one segment
|
||||
clr.l d2 * clear long word flag
|
||||
lsr #1,d4 * make d4 indicate # words
|
||||
bra reloc4
|
||||
reloc2:
|
||||
subq.w #1,d3
|
||||
bpl reloc3
|
||||
bsr readseq * if no more words in buffer, refill it
|
||||
tst.w d1
|
||||
bne rdbad
|
||||
move.l basepg,a3
|
||||
move.w #(secsize/2)-1,d3
|
||||
reloc3:
|
||||
bsr relocword * relocate one word
|
||||
subq.l #1,d4
|
||||
reloc4:
|
||||
tst.l d4 * any more to relocate in this segment?
|
||||
bne reloc2 * if yes, do it
|
||||
move.l dseg,a2 * else, set up for dseg
|
||||
move.l dsize,d4
|
||||
sub.w #1,loop
|
||||
bne reloc1
|
||||
rts
|
||||
|
||||
|
||||
|
||||
.bss
|
||||
|
||||
* offsets from start of parameter block
|
||||
FCBPtr = 0
|
||||
LoAdr = 4
|
||||
BasPage = 12
|
||||
|
||||
hdr:
|
||||
* load file header is read into here
|
||||
magic: .ds.w 1
|
||||
csize: .ds.l 1
|
||||
dsize: .ds.l 1
|
||||
bsize: .ds.l 1
|
||||
bpsize: .ds.l 1 * symb tbl size is swapped with base page size
|
||||
stksize: .ds.l 1
|
||||
tstart: .ds.l 1
|
||||
rlbflg: .ds.w 1
|
||||
dstart: .ds.l 1
|
||||
bstart: .ds.l 1
|
||||
|
||||
cseg: .ds.l 1
|
||||
dseg: .ds.l 1
|
||||
bseg: .ds.l 1
|
||||
basepg: .ds.l 1
|
||||
|
||||
symsize: .ds.l 1
|
||||
temp: .ds.l 1
|
||||
loop: .ds.w 1
|
||||
bufbyts: .ds.w 1
|
||||
|
||||
.end
|
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Use this file to determine what kind of machine you want the
|
||||
* Alcyon stuff to run on ....
|
||||
*/
|
||||
#define MC68000 1 /* 68000 version */
|
||||
/*#define VAX 1*/ /* VAX Version */
|
||||
/*#define PDP11 1*/ /* PDP-11 Version*/
|
||||
#define CPM 1 /* CP/M Operating System*/
|
||||
/*#define UNIX 1*/ /* UNIX Operating System*/
|
||||
/*#define VMS 1*/ /* VMS Operating System*/
|
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Use this file to determine what kind of machine you want the
|
||||
* Alcyon stuff to run on ....
|
||||
*/
|
||||
/*#define MC68000 1*/ /* 68000 version */
|
||||
#define VAX 1 /* VAX Version */
|
||||
/*#define PDP11 1 /* PDP-11 Version*/
|
||||
/*#define CPM 1*/ /* CP/M Operating System*/
|
||||
/*#define UNIX 1 /* UNIX Operating System*/
|
||||
#define VMS 1 /* VMS Operating System*/
|
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Use this file to determine what kind of machine you want the
|
||||
* Alcyon stuff to run on ....
|
||||
*/
|
||||
/*#define MC68000 1 /* 68000 version */
|
||||
#define VAX 1*/ /* VAX Version */
|
||||
/*#define PDP11 1*/ /* PDP-11 Version*/
|
||||
#define CPM 1 /* CP/M Operating System*/
|
||||
/*#define UNIX 1*/ /* UNIX Operating System*/
|
||||
/*#define VMS 1*/ /* VMS Operating System*/
|
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Use this file to determine what kind of machine you want the
|
||||
* Alcyon stuff to run on ....
|
||||
*/
|
||||
/*#define MC68000 1*/ /* 68000 version */
|
||||
#define VAX 1 /* VAX Version */
|
||||
/*#define PDP11 1*/ /* PDP-11 Version*/
|
||||
/*#define CPM 1*/ /* CP/M Operating System*/
|
||||
/*#define UNIX 1*/ /* UNIX Operating System*/
|
||||
#define VMS 1 /* VMS Operating System*/
|
@@ -0,0 +1,36 @@
|
||||
$1pip d:=as68symb.dat[g0
|
||||
$1stat *.h=rw
|
||||
$1pip d:=*.h[g6
|
||||
$1pip d:=s.o[g6
|
||||
$1pip d:=clib[g6
|
||||
|
||||
|
||||
$1cp68 link68.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
era $1x.i
|
||||
era $1x.st
|
||||
$1c168 $1x.ic link68.s -ld
|
||||
$1as68 -f $1 -l -u link68.s
|
||||
era link68.s
|
||||
|
||||
$1cp68 lnkmess.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
era $1x.i
|
||||
era $1x.st
|
||||
$1c168 $1x.ic lnkmess.s -ld
|
||||
$1as68 -f $1 -l -u lnkmess.s
|
||||
era lnkmess.s
|
||||
|
||||
$1cp68 preproc.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
era $1x.i
|
||||
era $1x.st
|
||||
$1c168 $1x.ic preproc.s -ld
|
||||
$1as68 -f $1 -l -u preproc.s
|
||||
era preproc.s
|
||||
|
||||
$1as68 -f $1 -l -u loadr.s
|
||||
$1as68 -f $1 -l -u ovhdlr.s
|
||||
|
||||
|
||||
$1lo68 -unofloat -r -o link68.rel -f e: s.o link68.o preproc.o lnkmess.o clib
|
@@ -0,0 +1,36 @@
|
||||
$1pip d:=as68symb.dat[g0
|
||||
$1stat *.h=rw
|
||||
$1pip d:=*.h[g6
|
||||
$1pip d:=s.o[g6
|
||||
$1pip d:=clib[g6
|
||||
|
||||
|
||||
$1cp68 link68.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
era $1x.i
|
||||
era $1x.st
|
||||
$1c168 $1x.ic link68.s -ld
|
||||
$1as68 -f $1 -l -u link68.s
|
||||
era link68.s
|
||||
|
||||
$1cp68 lnkmess.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
era $1x.i
|
||||
era $1x.st
|
||||
$1c168 $1x.ic lnkmess.s -ld
|
||||
$1as68 -f $1 -l -u lnkmess.s
|
||||
era link68.s
|
||||
|
||||
$1cp68 preproc.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
era $1x.i
|
||||
era $1x.st
|
||||
$1c168 $1x.ic preproc.s -ld
|
||||
$1as68 -f $1 -l -u preproc.s
|
||||
era link68.s
|
||||
|
||||
$1as68 -f $1 -l -u loadr.s
|
||||
$1as68 -f $1 -l -u ovhdlr.s
|
||||
|
||||
|
||||
$1lo68 -r -o link68.rel -f e: s.o link68.o preproc.o lnkmess.o clib
|
117
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v101/newlink/ovhdlr.s
Normal file
117
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v101/newlink/ovhdlr.s
Normal file
@@ -0,0 +1,117 @@
|
||||
* BDOS Function Definitions
|
||||
*
|
||||
reboot = 0
|
||||
printstr = 9
|
||||
open = 15
|
||||
setdma = 26
|
||||
pgmldf = 59
|
||||
gettpa = 63
|
||||
*
|
||||
.globl _ovhdlr
|
||||
.xdef _loadr
|
||||
.text
|
||||
*
|
||||
_ovhdlr:move sr,savecc * save condition codes
|
||||
movem.l d1-d7/a0-a6,saver * save all registers
|
||||
movea.l (a7)+,a6 * pop pointer to inline parameter
|
||||
move.l #4,d6 * adjust return address
|
||||
add.l a6,d6 * to skip over table pointer
|
||||
move.l d6,-(a7) * push return address
|
||||
*
|
||||
* GET FILE NAME AND LOAD PT
|
||||
*
|
||||
movea.l (a6),a6 * get ovl table address
|
||||
move.l a6,d5 * check address with last loaded
|
||||
cmp.l oldadd,d5 * if it's the same,
|
||||
beq done * file is already loaded.
|
||||
move.l a6,oldadd * save address for next time
|
||||
lea.l fname,a5 * get address of name in fcb
|
||||
move.l #11,d5 * set up loop counter (l2 cycles)
|
||||
gfnm: move.b (a6)+,(a5)+
|
||||
dbf d5,gfnm
|
||||
move.l (a6),lowadr * store load point address
|
||||
*
|
||||
* OPEN OVERLAY FILE
|
||||
*
|
||||
move.l #fcb,d1
|
||||
movea.l d1,a1
|
||||
move.w #open,d0 *put BDOS function number in register d0
|
||||
trap #2 *try to open the file to be loaded
|
||||
cmpi #255,d0 *test d0 for BDOS error return code
|
||||
beq openerr *if d0 = 255 then goto openerr
|
||||
move.b #0,cr *zero record number in fcb
|
||||
*
|
||||
* FILL THE LPB
|
||||
*
|
||||
lea ovbspg,a3 * get address of input buffer
|
||||
move.l a3,baspag * put it in LPB
|
||||
move.l a1,LPB *put address of open FCB into LPB
|
||||
move.l #LPB,a0 *put address of LPB into register a0
|
||||
jsr _loadr *load the module
|
||||
tst d0 *was the load successful?
|
||||
bne lderr *if not then print error message
|
||||
*
|
||||
* RESTORE AND RETURN
|
||||
*
|
||||
done: movem.l saver,d1-d7/a0-a6 * restore all registers
|
||||
move savecc,ccr * restore condition codes
|
||||
rts
|
||||
*
|
||||
* PRINT ERROR MESSAGE
|
||||
*
|
||||
openerr:
|
||||
move.l #openmsg,d1 *get address of error message
|
||||
* *to be printed
|
||||
bra print
|
||||
lderr: move.l #loaderr,d1 *get address of error message to
|
||||
* *be printed
|
||||
print: move.w #printstr,d0 *get BDOS function number
|
||||
trap #2 *print the message
|
||||
move.b #36,ex *mark end of filename
|
||||
move.l #fname,d1 *get address of filename
|
||||
move.w #printstr,d0 *set up for BDOS call
|
||||
trap #2 *print the filename
|
||||
cmdrtn: move.w #reboot,d0 *get BDOS function number
|
||||
trap #2 *warmboot and return to the CCP
|
||||
|
||||
*
|
||||
* DATA
|
||||
*
|
||||
.data
|
||||
*
|
||||
* ERROR MESSAGE STRINGS
|
||||
*
|
||||
.even
|
||||
loaderr: .dc.b 13,10,'Error Loading Overlay File $'
|
||||
openmsg: .dc.b 13,10,'Unable to Open Overlay File $'
|
||||
*
|
||||
* BSS
|
||||
*
|
||||
.bss
|
||||
.even
|
||||
oldadd: .ds.l 1 * table for last loaded overlay
|
||||
savecc: .ds.w 1
|
||||
saver: .ds.l 14
|
||||
ovbspg: .ds.w 64 * input buffer (like basepage) for loadr
|
||||
*
|
||||
* FILE CONTROL BLOCK
|
||||
*
|
||||
.even
|
||||
fcb: .ds.b 1 * file control block
|
||||
fname: .ds.b 11
|
||||
ex: .ds.b 1
|
||||
sysjnk: .ds.b 19
|
||||
cr: .ds.b 1
|
||||
*
|
||||
* LOAD PARAMETER BLOCK
|
||||
*
|
||||
.even
|
||||
LPB: .ds.l 1 *FCB address of program file
|
||||
lowadr: .ds.l 1 *Low boundary of area in which
|
||||
* *to load program
|
||||
hiadr: .ds.l 1 *High boundary of area in which to
|
||||
* *to load program
|
||||
baspag: .ds.l 1 *Base page address of loaded program
|
||||
usrstk: .ds.l 1 *Loaded program's initial stack pointer
|
||||
flags: .ds.w 1 *Load program function control flags
|
||||
.end
|
1029
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v101/newlink/preproc.c
Normal file
1029
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v101/newlink/preproc.c
Normal file
File diff suppressed because it is too large
Load Diff
170
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v101/newlink/spec.doc
Normal file
170
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v101/newlink/spec.doc
Normal file
@@ -0,0 +1,170 @@
|
||||
.mt 5
|
||||
.mb 6
|
||||
.pl 66
|
||||
.ll 64
|
||||
.po 10
|
||||
.hm 2
|
||||
.fm 2
|
||||
.ce
|
||||
Description of LINK-68
|
||||
.sp
|
||||
.pp 0
|
||||
LINK-68 is the new enhanced linker for CP/M-68K. The major new feature is
|
||||
the ability to link overlayed programs.
|
||||
.sp 2
|
||||
1. Overlay Scheme
|
||||
.pp
|
||||
LINK-68 supports a simple tree-structured overlay scheme. Only one overlay
|
||||
from a given level is memory-resident at a time. An overlay can
|
||||
reference a symbol in a direct descendant or in any ancestor. An
|
||||
overlay cannot reference a symbol in a sibling overlay or in an overlay
|
||||
more than one level down in the tree.
|
||||
.pp
|
||||
The lowest allowed level is five levels below the root. The maximum
|
||||
number of overlays is 255.
|
||||
.pp
|
||||
All global static data is in the root, no matter where it is originally
|
||||
defined.
|
||||
.sp 2
|
||||
2. Command Line
|
||||
.pp
|
||||
The command line for LINK-68 has almost the same format as for LINK-86, as
|
||||
described in sections 7 and 8 of the Programmer's Utilities Guide
|
||||
for CP/M-86. The main differences are in the available options. The
|
||||
format for specifying options and overlay structures is the same. Parens
|
||||
enclose overlay specifications, and square brackets enclose options.
|
||||
.pp
|
||||
Anything after a backslash on a command line is ignored.
|
||||
.pp
|
||||
If you just type 'LINK68' without any command line, the linker lists the
|
||||
options. The following is a list of the options for LINK-68.
|
||||
.pp
|
||||
ABSOLUTE
|
||||
.pp
|
||||
.in 5
|
||||
Tells the linker to generate an absolute file
|
||||
with no relocation bits. The default is a relocatable program.
|
||||
.pp
|
||||
.ti -5
|
||||
ALLMODS
|
||||
.pp
|
||||
All modules from a library are loaded, whether or not they are referenced.
|
||||
The default is to only load referenced library modules.
|
||||
.pp
|
||||
.ti -5
|
||||
BSSBASE
|
||||
.pp
|
||||
Sets the base for the uninitialized data segment in discontiguous
|
||||
programs. The default value is
|
||||
the first even word after the DATA segment. This option is not
|
||||
allowed when linking overlayed programs.
|
||||
.pp
|
||||
.ti -5
|
||||
COMMAND
|
||||
.pp
|
||||
Specifies that the following named file contains
|
||||
the rest of the command line.
|
||||
The linker ignores the rest of the main command line and does not return
|
||||
to it. Nested command files are not allowed.
|
||||
.pp
|
||||
.ti -5
|
||||
DATABASE
|
||||
.pp
|
||||
Specifies the start of the DATA segment in discontiguous programs. The
|
||||
default is the first even word after the TEXT segment. This option
|
||||
is not allowed when linking overlayed programs.
|
||||
.pp
|
||||
.ti-5
|
||||
IGNORE
|
||||
.pp
|
||||
Ignore 16-bit address overflow. This is like the -i option in LO68.
|
||||
.pp
|
||||
.ti -5
|
||||
INCLUDE
|
||||
.pp
|
||||
Instructs the linker to load an unreferenced module from a
|
||||
library. The format for this option is:
|
||||
.sp
|
||||
.ti 10
|
||||
filename [INCLUDE [module name]]
|
||||
.pp
|
||||
.ti -5
|
||||
LOCALS
|
||||
.pp
|
||||
Tells the linker to put local symbols in the symbol table. The default is
|
||||
no local symbols. This option only applies from the point in the command
|
||||
line that it appears. The NOLOCALS switch turns this option off. Use them
|
||||
in combination to put local symbols from specific files in the symbol table.
|
||||
.pp
|
||||
Local symbols starting with 'L' are always ignored.
|
||||
.pp
|
||||
.ti -5
|
||||
NOLOCALS
|
||||
.pp
|
||||
See LOCAL.
|
||||
.pp
|
||||
.ti-5
|
||||
SYMBOLS
|
||||
.pp
|
||||
Put the symbol table in the output file. The default is no symbol table.
|
||||
.pp
|
||||
.ti -5
|
||||
TEMPFILES
|
||||
.pp
|
||||
Specifies the drive to use for temporary files. The default is the
|
||||
currently logged-in drive. This option must preceed any input files on
|
||||
the command line.
|
||||
.pp
|
||||
.ti -5
|
||||
TEXTBASE
|
||||
.pp
|
||||
Specifies the base for the TEXT segment. The default is 0. This option
|
||||
is allowed with overlayed programs, but the DATABASE and BSSBASE options
|
||||
are not allowed when linking overlayed programs.
|
||||
.in 0
|
||||
.sp
|
||||
.pp
|
||||
The following are examples of command lines for LINK-68. Notice that an
|
||||
option name can be abreviated to its shortest unambiguous form. Addresses
|
||||
are always in hex.
|
||||
.in 5
|
||||
.sp
|
||||
.nf
|
||||
LINK68 [SYM, TEM[D:] FOOBAZ = FOOMAIN, FOOLIB
|
||||
.SP
|
||||
LINK68 [COM[INP.JNK \\ CLOSING BRACKETS ARE NOT NEEDED
|
||||
.sp
|
||||
LINK68 [ABS, TEX[500]] P.68K = ST.O,P.O[LO],LIB.A[NOL],(V1.O),(V2.O)
|
||||
.fi
|
||||
.in 0
|
||||
.sp 2
|
||||
3. Format of an Overlay File
|
||||
.pp
|
||||
An overlay file has the same format as a regular a.out-format file. The
|
||||
header "magic" word is always 601AH. The file can be either absolute or
|
||||
relocatable. The overlay's symbols are in the root file, if the SYMBOLS
|
||||
options is used.
|
||||
.pp
|
||||
An overlay file can have any type, but the default type is O68.
|
||||
.pp
|
||||
To specify that a block of BSS space is to be in the root instead of in the
|
||||
overlay's BSS segment, generate an external symbol for the space and give
|
||||
the symbol a value equal to the number of bytes required. The space will
|
||||
be allocated on an even boundary in the root's BSS segment. If more than
|
||||
one module specify static storage with the same name, the largest size is
|
||||
used for allocation.
|
||||
.pp
|
||||
The BSS size for the root file is set to contain the area into which the
|
||||
overlays are loaded. The symbol _end is resolved to the top of the
|
||||
overlay area.
|
||||
.sp 2
|
||||
4. Overlay Manager
|
||||
.pp
|
||||
The overlay manager should be transparent to your program, except for the
|
||||
time required to read in the overlay. Write the modules as if you were
|
||||
going to load everything in one file. Make sure to include the files
|
||||
containing the overlay handler and loader in the root.
|
||||
|
||||
|
||||
|
||||
|
@@ -0,0 +1,33 @@
|
||||
* driver for simple overlay test
|
||||
.globl tmain
|
||||
.xdef foobaz
|
||||
.xdef foobz2
|
||||
*
|
||||
tmain: move.l #before,d1
|
||||
move.w #9,d0
|
||||
trap #2
|
||||
jsr foobaz
|
||||
move.l #after,d1
|
||||
move.w #9,d0
|
||||
trap #2
|
||||
*
|
||||
move.l #bef2,d1
|
||||
move.w #9,d0
|
||||
trap #2
|
||||
jsr foobz2
|
||||
move.l #aft2,d1
|
||||
move.w #9,d0
|
||||
trap #2
|
||||
jsr foobaz
|
||||
jsr foobz2
|
||||
jsr foobaz
|
||||
jsr foobz2
|
||||
rts
|
||||
*
|
||||
.data
|
||||
.even
|
||||
before: .dc.b 13,10,'CALLING FOOBAZ$'
|
||||
after: .dc.b 13,10,'BACK FROM FOOBAZ$'
|
||||
bef2: .dc.b 13,10,'CALLING FOOBAZ2$'
|
||||
aft2: .dc.b 13,10,'BACK FROM FOOBAZ2$'
|
||||
.end
|
@@ -0,0 +1,14 @@
|
||||
* overlay module for simple test
|
||||
.globl foobaz
|
||||
.globl junk
|
||||
*
|
||||
foobaz: move.l #mess,d1
|
||||
move.w #9,d0
|
||||
trap #2
|
||||
rts
|
||||
.data
|
||||
.even
|
||||
mess: .dc.b 13,10,'THIS IS FOOBAZ!$'
|
||||
.bss
|
||||
junk: .ds.b 1
|
||||
.end
|
@@ -0,0 +1,14 @@
|
||||
* overlay module for simple test
|
||||
.globl foobz2
|
||||
.globl junk2
|
||||
*
|
||||
foobz2: move.l #mess,d1
|
||||
move.w #9,d0
|
||||
trap #2
|
||||
rts
|
||||
.data
|
||||
.even
|
||||
mess: .dc.b 13,10,'THIS IS FOOBAZ2!$'
|
||||
.bss
|
||||
junk2: .ds.b 1
|
||||
.end
|
Reference in New Issue
Block a user