mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-10-24 17:04:19 +00:00
Upload
Digital Research
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* B A S E P A G E . H */
|
||||
/* ------------------- */
|
||||
/* */
|
||||
/* This file contains a definition of the CP/M basepage structure, */
|
||||
/* b_page. */
|
||||
/* */
|
||||
/* NOTE: In the portable CP/M environment, it is NOT guaranteed */
|
||||
/* that the location of the base page is known at link-edit time */
|
||||
/* (as it is, for example, in CP/M-80 and CP/M-86.) Instead, a */
|
||||
/* pointer to the current basepage is delivered by the BDOS */
|
||||
/* to each new program which is run. This pointer, _base, is */
|
||||
/* initialized by the C startup function (startup.s) and is */
|
||||
/* available to C programs as an external. */
|
||||
/* */
|
||||
/* "cpm.h" MUST be '#include'd before this file */
|
||||
/* */
|
||||
/****************************************************************************/
|
||||
|
||||
struct b_page
|
||||
{
|
||||
BYTE *ltpa; /* Low TPA address */
|
||||
BYTE *htpa; /* High TPA address */
|
||||
BYTE *lcode; /* Start address of code seg*/
|
||||
LONG codelen; /* Code segment length */
|
||||
BYTE *ldata; /* Start address of data seg*/
|
||||
LONG datalen; /* Data segment length */
|
||||
BYTE *lbss; /* Start address of bss seg */
|
||||
LONG bsslen; /* Bss segment length */
|
||||
LONG freelen; /* Free segment length */
|
||||
BYTE resvd1[20]; /* Reserved area */
|
||||
struct fcb fcb2; /* Second basepage FCB */
|
||||
struct fcb fcb1; /* First basepage FCB */
|
||||
BYTE buff[128]; /* Default DMA buffer, */
|
||||
/* command line tail */
|
||||
};
|
||||
|
||||
extern struct b_page *_base;
|
||||
367
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/bdos.h
Normal file
367
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/bdos.h
Normal file
@@ -0,0 +1,367 @@
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* B D O S . H */
|
||||
/* ----------- */
|
||||
/* */
|
||||
/* Copyright (c) 1982, Zilog Incorporated */
|
||||
/* */
|
||||
/* Macros defining the direct BDOS calls used by the standard CP/M */
|
||||
/* utilities (ED, PIP, STAT, SET, SHOW.) Some necessary data */
|
||||
/* data structures are also defined. */
|
||||
/* */
|
||||
/* All macros return a long value, even when the BDOS function they */
|
||||
/* call does produce a return parameter. */
|
||||
/* */
|
||||
/* This header file can be used applications which do not require */
|
||||
/* to use the C standard I/O library functions. For applications */
|
||||
/* which require the library, but which wish to make use of the */
|
||||
/* additional information in this file, cpm.h should be included in */
|
||||
/* the source ahead of this file. The compiler flags multiple */
|
||||
/* definition errors if this ordering is not observed. */
|
||||
/* */
|
||||
/* portab.h must always be included ahead of this file. */
|
||||
/* */
|
||||
/****************************************************************************/
|
||||
|
||||
extern long __BDOS(); /* BDOS entry point */
|
||||
|
||||
#define XADDR long /* 32-bit address data type */
|
||||
|
||||
/****************************************************************************/
|
||||
/* The following BDOS calls are defined in cpm.h. Define them only if they */
|
||||
/* are not defined already. */
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef EXIT /* Find out where we stand */
|
||||
/* Define if necessary */
|
||||
#define EXIT 0 /* Exit to BDOS */
|
||||
#define CONOUT 2 /* Direct console output */
|
||||
#define LSTOUT 5 /* Direct list device output*/
|
||||
#define CONIO 6 /* Direct console I/O */
|
||||
#define CONBUF 10 /* Read console buffer */
|
||||
#define OPEN 15 /* OPEN a disk file */
|
||||
#define CLOSE 16 /* Close a disk file */
|
||||
#define DELETE 19 /* Delete a disk file */
|
||||
#define CREATE 22 /* Create a disk file */
|
||||
#define SETDMA 26 /* Set DMA address */
|
||||
#define B_READ 33 /* Read Random record */
|
||||
#define B_WRITE 34 /* Write Random record */
|
||||
#define FILSIZ 35 /* Compute File Size */
|
||||
#define SETMSC 44 /* Set Multi-Sector Count */
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
/* The following BDOS calls are not defined in cpm.h */
|
||||
/****************************************************************************/
|
||||
|
||||
#define CONIN 1 /* Single char I/P with echo*/
|
||||
#define READER 3 /* Paper tape input */
|
||||
#define PUNCH 4 /* Paper tape output */
|
||||
#define GET_IOB 7 /* Get I/O byte */
|
||||
#define SET_IOB 8 /* Set I/O byte */
|
||||
#define PRINT 9 /* Print $-terminated line */
|
||||
#define CONSTAT 11 /* Check if I/P char waiting*/
|
||||
#define VERSION 12 /* Return version number */
|
||||
#define RS_DISK 13 /* Reset disk system */
|
||||
#define SEL_DISK 14 /* Select disk */
|
||||
#define SRCH_1ST 17 /* Search 1st filename match*/
|
||||
#define SRCH_NEXT 18 /* Search next match */
|
||||
#define S_READ 20 /* Sequential read from file*/
|
||||
#define S_WRITE 21 /* Sequential write to file */
|
||||
#define RENAME 23 /* Rename a file */
|
||||
#define RET_LOGIN 24 /* Return login vector */
|
||||
#define RET_CDISK 25 /* Return current disk */
|
||||
#define GET_ALLOC 27 /* Get allocation vector */
|
||||
#define WR_PROTD 28 /* Write protect disk */
|
||||
#define GET_RO 29 /* Get read-only vector */
|
||||
#define SET_ATT 30 /* Set file attributes */
|
||||
#define GET_DPB 31 /* Get disk parameters */
|
||||
#define GSET_UCODE 32 /* Get/set user code */
|
||||
#define SET_RAND 36 /* Set random record */
|
||||
#define RS_DRIVE 37 /* Reset disk specified drv */
|
||||
/* 38, 39 not used */
|
||||
#define B_WRZF 40 /* Write random, zero fill */
|
||||
/* 41 - 43 not used */
|
||||
#define RET_ERRORS 45 /* Set error return mode */
|
||||
#define GET_DFS 46 /* Get free disk space */
|
||||
#define CHAIN 47 /* Chain to program via CCP */
|
||||
#define FLUSH 48 /* Flush buffers to disk */
|
||||
#define GSET_SCB 49 /* Get/set system control bk*/
|
||||
#define BIOS_CALL 50 /* Direct call to BIOS */
|
||||
/* 51 - 58 not used */
|
||||
#define PROG_LOAD 59 /* Program load */
|
||||
/* 60 unused */
|
||||
#define SET_EXV 61 /* Set exception vector */
|
||||
#define SET_SUP 62 /* Set supervisor state */
|
||||
#define SET_LABEL 100 /* Set directory label */
|
||||
#define GET_LABEL 101 /* Get directory label */
|
||||
#define GET_XFCB 102 /* Get extended FCB */
|
||||
#define SET_XFCB 103 /* Set extended FCB */
|
||||
#define COND_LST 161 /* Conditionally attach LST:*/
|
||||
|
||||
/****************************************************************************/
|
||||
/* The macros themselves... */
|
||||
/****************************************************************************/
|
||||
|
||||
#define _conin() (__BDOS(CONIN, (long) 0))
|
||||
|
||||
#define _conout(a) (__BDOS(CONOUT, (long) (a)))
|
||||
|
||||
#define _reader() (__BDOS(READER, (long) 0))
|
||||
|
||||
#define _punch(a) (__BDOS(PUNCH, (long) (a)))
|
||||
|
||||
#define _lstout(a) (__BDOS(LSTOUT, (long) (a)))
|
||||
|
||||
#define _conio(a) (__BDOS(CONIO, (long) (a)))
|
||||
|
||||
#define _get_iob() (__BDOS(GET_IOB, (long) 0))
|
||||
|
||||
#define _set_iob(a) (__BDOS(SET_IOB, (long) (a)))
|
||||
|
||||
#define _print(a) (__BDOS(PRINT, (long) (a)))
|
||||
|
||||
#define _conbuf(a) (__BDOS(CONBUF, (long) (a)))
|
||||
|
||||
#define _constat() (__BDOS(CONSTAT, (long) 0))
|
||||
|
||||
#define _version() (__BDOS(VERSION, (long) 0))
|
||||
|
||||
#define _rs_disk(a) (__BDOS(RS_DISK, (long) (a)))
|
||||
|
||||
#define _sel_disk(a) (__BDOS(SEL_DISK, (long) (a)))
|
||||
|
||||
#define _open(a) (__BDOS(OPEN, (long) (a)))
|
||||
|
||||
#define _close(a) (__BDOS(CLOSE, (long) (a)))
|
||||
|
||||
#define _srch_1st(a) (__BDOS(SRCH_1ST, (long) (a)))
|
||||
|
||||
#define _srch_next() (__BDOS(SRCH_NEXT, (long) 0))
|
||||
|
||||
#define _delete(a) (__BDOS(DELETE, (long) (a)))
|
||||
|
||||
#define _s_read(a) (__BDOS(S_READ, (long) (a)))
|
||||
|
||||
#define _s_write(a) (__BDOS(S_WRITE, (long) (a)))
|
||||
|
||||
#define _create(a) (__BDOS(CREATE, (long) (a)))
|
||||
|
||||
#define _rename(a) (__BDOS(RENAME, (long) (a)))
|
||||
|
||||
#define _ret_login() (__BDOS(RET_LOGIN, (long) 0))
|
||||
|
||||
#define _ret_cdisk() (__BDOS(RET_CDISK, (long) 0))
|
||||
|
||||
#define _setdma(a) (__BDOS(SETDMA, (long) (a)))
|
||||
|
||||
#define _get_alloc() (__BDOS(GET_ALLOC, (long) 0))
|
||||
|
||||
#define _wr_protd() (__BDOS(WR_PROTD, (long) 0))
|
||||
|
||||
#define _get_ro() (__BDOS(GET_RO, (long) 0))
|
||||
|
||||
#define _set_att(a) (__BDOS(SET_ATT, (long) (a)))
|
||||
|
||||
/* _get_dpb has parameter in*/
|
||||
/* some implementations */
|
||||
/* of CP/M but not others */
|
||||
/* This macro suitable only */
|
||||
/* for former */
|
||||
#define _get_dpb(a) (__BDOS(GET_DPB, (long) (a)))
|
||||
/* This one handles latter */
|
||||
#define _get_dpa() (__BDOS(GET_DPB, (long) 0))
|
||||
|
||||
#define _gset_ucode(a) (__BDOS(GSET_UCODE, (long) (a)))
|
||||
|
||||
#define _b_read(a) (__BDOS(B_READ, (long) (a)))
|
||||
|
||||
#define _b_write(a) (__BDOS(B_WRITE, (long) (a)))
|
||||
|
||||
#define _filsiz(a) (__BDOS(FILSIZ, (long) (a)))
|
||||
|
||||
#define _set_rand(a) (__BDOS(SET_RAND, (long) (a)))
|
||||
|
||||
#define _rs_drive(a) (__BDOS(RS_DRIVE, (long) (a)))
|
||||
|
||||
#define _b_wrzf(a) (__BDOS(B_WRZF, (long) (a)))
|
||||
|
||||
#define _setmsc(a) (__BDOS(SETMSC, (long) (a)))
|
||||
|
||||
#define _ret_errors(a) (__BDOS(RET_ERRORS, (long) (a)))
|
||||
|
||||
#define _get_dfs(a) (__BDOS(GET_DFS, (long) (a)))
|
||||
|
||||
#define _chain() (__BDOS(CHAIN, (long) 0))
|
||||
|
||||
#define _flush() (__BDOS(FLUSH, (long) 0))
|
||||
|
||||
#define _gset_scb(a) (__BDOS(GSET_SCB, (long) (a)))
|
||||
|
||||
#define _bios_call(a) (__BDOS(BIOS_CALL, (long) (a)))
|
||||
|
||||
#define _prog_load(a) (__BDOS(PROG_LOAD, (long) (a)))
|
||||
|
||||
#define _set_exv(a) (__BDOS(SET_EXV, (long) (a)))
|
||||
|
||||
#define _set_sup(a) (__BDOS(SET_SUP, (long) 0))
|
||||
|
||||
#define _get_label(a) (__BDOS(GET_LABEL, (long) (a)))
|
||||
|
||||
#define _set_label(a) (__BDOS(SET_LABEL, (long) (a)))
|
||||
|
||||
#define _get_xfcb(a) (__BDOS(GET_XFCB, (long) (a)))
|
||||
|
||||
#define _set_xfcb(a) (__BDOS(SET_XFCB, (long) (a)))
|
||||
|
||||
#define _cond_lst() (__BDOS(COND_LST, (long) 0))
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* BIOS calls, for use in conjunction with BDOS call 50 & struct bios_parms */
|
||||
/****************************************************************************/
|
||||
|
||||
#define _INIT 0 /* Cold start */
|
||||
#define _WARM 1 /* Warm start */
|
||||
#define _CONST 2 /* Console status */
|
||||
#define _CONIN 3 /* Read console character */
|
||||
#define _CONOUT 4 /* Write console character */
|
||||
#define _LIST 5 /* Write listing character */
|
||||
#define _PUNCH 6 /* Write punch character */
|
||||
#define _READER 7 /* Read tape character */
|
||||
#define _HOME 8 /* Move to track 0 */
|
||||
#define _SELDSK 9 /* Select disk drive */
|
||||
#define _SETTRK 10 /* Set track number */
|
||||
#define _SETSEC 11 /* Set sector number */
|
||||
#define _SETDMA 12 /* Set DMA address */
|
||||
#define _READ 13 /* Read selected sector */
|
||||
#define _WRITE 14 /* Write selected sector */
|
||||
#define _LISTST 15 /* Return list status */
|
||||
#define _GETMRT 16 /* Get memory region table */
|
||||
/* address */
|
||||
#define _GETIOB 17 /* Get IOBYTE value */
|
||||
#define _SETIOB 18 /* Set IOBYTE value */
|
||||
#define _FLUSH 19 /* Flush buffers */
|
||||
#define _SETEXC 20 /* Set exception vector */
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* FCB structure is defined in cpm.h. Define it here only if it is not */
|
||||
/* defined already. Declare some useful values at the same time. */
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef SECSIZ /* Not already declared? */
|
||||
|
||||
struct fcbtab /* File control block */
|
||||
{ /* */
|
||||
BYTE drive; /* Disk drive field */
|
||||
BYTE fname[8]; /* File name */
|
||||
BYTE ftype[3]; /* File type */
|
||||
BYTE extent; /* Current extent number */
|
||||
BYTE s1,s2; /* "system reserved" */
|
||||
BYTE reccnt; /* Record counter */
|
||||
BYTE resvd[16]; /* More "system reserved" */
|
||||
LONG record; /* Note -- we overlap the */
|
||||
/* current record field to */
|
||||
/* make this useful. */
|
||||
};
|
||||
|
||||
#define fcb fcbtab /* A useful synonym */
|
||||
#define SECSIZ 128 /* size of CP/M sector */
|
||||
#define _MAXSXFR 1 /* max # sectors xferrable */
|
||||
#define _MAXSHFT 12 /* shift right BDOS rtn val */
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
/* Data structures not defined in cpm.h */
|
||||
/****************************************************************************/
|
||||
|
||||
struct dpbs /* Disk parameter block */
|
||||
{
|
||||
UWORD spt; /* Sectors per track */
|
||||
BYTE bls; /* Block shift factor */
|
||||
BYTE bms; /* Block mask */
|
||||
BYTE exm; /* Extent mark */
|
||||
/* BYTE filler; *** Pad to align words ***/
|
||||
UWORD mxa; /* Maximum allocation (blks)*/
|
||||
UWORD dmx; /* Max directory entries */
|
||||
UWORD dbl; /* Directory alloc. map */
|
||||
UWORD cks; /* Directory checksum */
|
||||
UWORD ofs; /* Track offset from track 0*/
|
||||
};
|
||||
|
||||
struct bios_parm /* BIOS parameters for BDOS */
|
||||
{ /* call 50 */
|
||||
UWORD req; /* BIOS request code */
|
||||
LONG p1; /* First parameter */
|
||||
LONG p2; /* Second parameter */
|
||||
};
|
||||
|
||||
struct scbs /* System control block */
|
||||
{
|
||||
BYTE resvd_1[6]; /* Reserved for system use */
|
||||
BYTE u_flags[4]; /* Utility flags */
|
||||
BYTE d_flags[4]; /* Display flags */
|
||||
BYTE clp_flags[2]; /* Command Line Proc flags */
|
||||
UWORD p_error; /* Program error return code*/
|
||||
BYTE resvd_2[8]; /* Reserved for system use */
|
||||
BYTE con_w; /* Console width */
|
||||
BYTE con_c; /* Console column */
|
||||
BYTE con_l; /* Console page length */
|
||||
BYTE resvd_3[5]; /* Reserved for system use */
|
||||
UWORD conin_r; /* CONIN redirection flag */
|
||||
UWORD conout_r; /* CONOUT redirection flag */
|
||||
UWORD auxin_r; /* AUXIN redirection flag */
|
||||
UWORD auxout_r; /* AUXOUT redirection flag */
|
||||
UWORD lstout_r; /* LSTOUT redirection flag */
|
||||
BYTE resvd_4[2]; /* Reserved for system use */
|
||||
BOOLEAN ctl_h_a; /* Backspace active */
|
||||
BOOLEAN rubout_a; /* Rubout active */
|
||||
BYTE resvd_5[2]; /* Reserved for system use */
|
||||
UWORD c_xlate; /* Console translate func. */
|
||||
UWORD con_m; /* Console mode (raw/cooked)*/
|
||||
UWORD buff_a; /* 128 byte buffer available*/
|
||||
BYTE o_delim; /* Output delimiter */
|
||||
BOOLEAN lo_flag; /* List output flag */
|
||||
BYTE resvd_6[2]; /* Reserved for system use */
|
||||
UWORD d_m_a; /* Current DMA address */
|
||||
BYTE disk_no; /* Current disk */
|
||||
BYTE bdos_info[2]; /* BDOS variable info */
|
||||
BYTE resvd_7[3]; /* Reserved for system use */
|
||||
BYTE user_no; /* Current user number */
|
||||
BYTE resvd_8[6]; /* Reserved for system use */
|
||||
BYTE bdos_mode; /* BDOS error mode */
|
||||
BYTE c_chain[4]; /* Current search chain */
|
||||
BYTE tmp_drv; /* Drive for temporary files*/
|
||||
BYTE resvd_9[7]; /* Reserved for system use */
|
||||
BYTE date_s[5]; /* Date stamp */
|
||||
BYTE error_jmp[3]; /* Error jump */
|
||||
UWORD cmb_a; /* Common memory base addr */
|
||||
UWORD bdos_ent; /* BDOS entry point */
|
||||
};
|
||||
|
||||
struct scbpb /* SCB parameter block */
|
||||
{
|
||||
BYTE off; /* Index to data in SCB */
|
||||
BYTE op; /* Operation: 0xff Set byte */
|
||||
/* 0xfe Set word */
|
||||
/* else Get word */
|
||||
UWORD val; /* Byte/word value to be set*/
|
||||
};
|
||||
|
||||
#define SET_BYTE 0xff
|
||||
#define SET_WORD 0xfe
|
||||
#define GET 0
|
||||
|
||||
/****************************************************************************/
|
||||
/* HILO must be defined for the Z8000. Undefine it first, in case cpm.h */
|
||||
/* has already defined it. The tagless structures defining byte ordering */
|
||||
/* which are declared in cpm.h are not redeclared here (the use of members */
|
||||
/* of tagless structures to define offsets is an obsolete feature of the C */
|
||||
/* language.) */
|
||||
/****************************************************************************/
|
||||
|
||||
#undef HILO
|
||||
#define HILO
|
||||
@@ -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*/
|
||||
163
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/cpm.h
Normal file
163
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/cpm.h
Normal file
@@ -0,0 +1,163 @@
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* C P M . H */
|
||||
/* --------- */
|
||||
/* Copyright 1982 by Digital Research Inc. All rights reserved. */
|
||||
/* */
|
||||
/* Edits: */
|
||||
/* */
|
||||
/* 25-June-83 sw Add user number to file "fd" structure. */
|
||||
/* */
|
||||
/* This file contains CP/M specific definitions for the CP/M */
|
||||
/* C Run Time Library. */
|
||||
/* This file is intended only for inclusion with those functions */
|
||||
/* dealing directly with the BDOS, as well as any function which */
|
||||
/* has hardware dependent code (byte storage order, for instance). */
|
||||
/* */
|
||||
/* <portab.h> must be included BEFORE this file. */
|
||||
/* */
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
* CP/M FCB definition
|
||||
*/
|
||||
|
||||
struct fcbtab /****************************/
|
||||
{ /* */
|
||||
BYTE drive; /* Disk drive field */
|
||||
BYTE fname[8]; /* File name */
|
||||
BYTE ftype[3]; /* File type */
|
||||
BYTE extent; /* Current extent number */
|
||||
BYTE s1,s2; /* "system reserved" */
|
||||
BYTE reccnt; /* Record counter */
|
||||
BYTE resvd[16]; /* More "system reserved" */
|
||||
LONG record; /* Note -- we overlap the */
|
||||
/* current record field to */
|
||||
/* make this useful. */
|
||||
}; /****************************/
|
||||
#define SECSIZ 128 /* size of CP/M sector */
|
||||
#define _MAXSXFR 1 /* max # sectors xferrable */
|
||||
#define _MAXSHFT 12 /* shift right BDOS rtn val */
|
||||
/* to obtain nsecs on err */
|
||||
/****************************/
|
||||
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* Channel Control Block (CCB) */
|
||||
/* */
|
||||
/* One CCB is allocated (statically) for each of the 16 possible open */
|
||||
/* files under C (including STDIN, STDOUT, STDERR). Permanent data */
|
||||
/* regarding the channel is kept here. */
|
||||
/* */
|
||||
/* */
|
||||
/****************************************************************************/
|
||||
|
||||
struct ccb /************************************/
|
||||
{ /* */
|
||||
WORD flags; /*sw Flags byte */
|
||||
BYTE user; /*sw User # */
|
||||
BYTE chan; /* Channel number being used */
|
||||
LONG offset; /* File offset word (bytes) */
|
||||
LONG sector; /* Sector currently in buffer */
|
||||
LONG hiwater; /* High water mark */
|
||||
struct fcbtab fcb; /* File FCB (may have TTY info)*/
|
||||
BYTE buffer[SECSIZ]; /* Read/write buffer */
|
||||
}; /************************************/
|
||||
|
||||
#define MAXCCBS 16 /* Maximum # CC Blocks */
|
||||
extern struct ccb _fds[MAXCCBS]; /* Declare storage */
|
||||
#define FD struct ccb /* FD Type definition */
|
||||
/************************************/
|
||||
/* Flags word bit definitions */
|
||||
/************************************/
|
||||
#define OPENED 0x01 /* Channel is OPEN */
|
||||
#define ISTTY 0x02 /* Channel open to TTT */
|
||||
#define ISLPT 0x04 /* Channel open to LPT */
|
||||
#define ISREAD 0x08 /* Channel open readonly */
|
||||
#define ISASCII 0x10 /* ASCII file attached */
|
||||
#define ATEOF 0x20 /* End of file encountered */
|
||||
#define DIRTY 0x40 /* Buffer needs writing */
|
||||
#define ISSPTTY 0x80 /* Special tty info */
|
||||
#define ISAUX 0x100 /*sw Auxiliary device */
|
||||
/************************************/
|
||||
#define READ 0 /* Read mode parameter for open */
|
||||
#define WRITE 1 /* Write mode */
|
||||
|
||||
/* CCB manipulation macros *************************************/
|
||||
#define _getccb(i) (&_fds[i]) /* Get CCB addr */
|
||||
|
||||
/* Error handling *************************************/
|
||||
EXTERN WORD errno; /* error place for assigning */
|
||||
EXTERN WORD __cpmrv; /* the last BDOS return value */
|
||||
EXTERN WORD _errcpm; /* place to save __cpmrv */
|
||||
#define RETERR(val,err) {errno=(err);_errcpm=__cpmrv;return(val);}
|
||||
/************************************/
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* B D O S F u n c t i o n D e f i n i t i o n s */
|
||||
/* ------------------------------------------------- */
|
||||
/* */
|
||||
/* Following are BDOS function definitions used by the C runtime */
|
||||
/* library. */
|
||||
/* */
|
||||
/****************************************************************************/
|
||||
|
||||
/****************************/
|
||||
#define EXIT 0 /* Exit to BDOS */
|
||||
#define CONOUT 2 /* Direct console output */
|
||||
#define LSTOUT 5 /* Direct list device output*/
|
||||
#define CONIO 6 /* Direct console I/O */
|
||||
#define CONBUF 10 /* Read console buffer */
|
||||
#define OPEN 15 /* OPEN a disk file */
|
||||
#define CLOSE 16 /* Close a disk file */
|
||||
#define DELETE 19 /* Delete a disk file */
|
||||
#define CREATE 22 /* Create a disk file */
|
||||
#define SETDMA 26 /* Set DMA address */
|
||||
#define USER 32 /*sw Get / set user number */
|
||||
#define B_READ 33 /* Read Random record */
|
||||
#define B_WRITE 34 /* Write Random record */
|
||||
#define FILSIZ 35 /* Compute File Size */
|
||||
#define SETMSC 44 /* Set Multi-Sector Count */
|
||||
#define SETVEC 61 /* Set exception vector */
|
||||
/****************************/
|
||||
|
||||
/****************************************************************************/
|
||||
/* Other CP/M definitions */
|
||||
/****************************************************************************/
|
||||
#define TERM "CON:" /* Console file name */
|
||||
#define LIST "LST:" /* List device file name */
|
||||
#define EOFCHAR 0x1a /* End of file character-^Z */
|
||||
/****************************/
|
||||
|
||||
/****************************************************************************/
|
||||
/* Hardware dependencies */
|
||||
/****************************************************************************/
|
||||
#define HILO /* used when bytes stored */
|
||||
/* Hi,Lo */
|
||||
/****************************/
|
||||
#ifdef HILO /* Hi/Lo storage used in */
|
||||
struct { /* 68K */
|
||||
BYTE lbhihi; /* Use this for accessing */
|
||||
BYTE lbhilo; /* ordered bytes in 32 bit*/
|
||||
BYTE lblohi; /* LONG qtys. */
|
||||
BYTE lblolo; /* */
|
||||
}; /* */
|
||||
struct { /* Use this for accessing */
|
||||
WORD lwhi; /* ordered words in 32 bit*/
|
||||
WORD lwlo; /* LONG qtys. */
|
||||
}; /* */
|
||||
#else /****************************/
|
||||
struct { /* Lo/Hi storage use on */
|
||||
BYTE lblolo; /* PDP-11, VAX, 8086,... */
|
||||
BYTE lblohi; /* */
|
||||
BYTE lbhilo; /* */
|
||||
BYTE lbhihi; /* */
|
||||
}; /* */
|
||||
struct { /* */
|
||||
WORD lwlo; /* */
|
||||
WORD lwhi; /* */
|
||||
}; /* */
|
||||
#endif /****************************/
|
||||
/*************************** end of cpm.h ***********************************/
|
||||
@@ -0,0 +1,39 @@
|
||||
/**************************************************************************
|
||||
* CTYPE.H - macros to classify ASCII-coded integers by table lookup.
|
||||
*
|
||||
*
|
||||
* Note: Integer args are undefined for all int values > 127,
|
||||
* except for macro 'isascii()'.
|
||||
* Assumes:
|
||||
* User will link with standard library functions.
|
||||
* Compiler can handle declarator initializers and
|
||||
* '#defines' with parameters.
|
||||
***************************************************************************/
|
||||
|
||||
/* Define bit patterns for character classes */
|
||||
#define __c 01
|
||||
#define __p 02
|
||||
#define __d 04
|
||||
#define __u 010
|
||||
#define __l 020
|
||||
#define __s 040
|
||||
#define __cs 041
|
||||
#define __ps 042
|
||||
|
||||
#ifndef CTYPE
|
||||
extern char __atab[];
|
||||
#endif
|
||||
|
||||
#define isascii(ch) ((ch) < 0200)
|
||||
#define isalpha(ch) (__atab[ch] & (__u | __l))
|
||||
#define isupper(ch) (__atab[ch] & __u)
|
||||
#define islower(ch) (__atab[ch] & __l)
|
||||
#define isdigit(ch) (__atab[ch] & __d)
|
||||
#define isalnum(ch) (__atab[ch] & (__u | __l | __d))
|
||||
#define isspace(ch) (__atab[ch] & __s)
|
||||
#define ispunct(ch) (__atab[ch] & __p)
|
||||
#define isprint(ch) (__atab[ch] & (__u | __l | __d | __p))
|
||||
#define iscntrl(ch) (__atab[ch] & __c)
|
||||
#define tolower(ch) (isupper(ch) ? (ch)-'A'+'a' : (ch) )
|
||||
#define toupper(ch) (islower(ch) ? (ch)-'a'+'A' : (ch) )
|
||||
#define toascii(ch) ((ch) & 0177)
|
||||
@@ -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,45 @@
|
||||
/*
|
||||
* errno.h - error codes
|
||||
*/
|
||||
|
||||
#define EPERM 1
|
||||
#define ENOENT 2
|
||||
#define ESRCH 3
|
||||
#define EINTR 4
|
||||
#define EIO 5
|
||||
#define ENXIO 6
|
||||
#define E2BIG 7
|
||||
#define ENOEXEC 8
|
||||
#define EBADF 9
|
||||
#define ECHILD 10
|
||||
#define EAGAIN 11
|
||||
#define ENOMEM 12
|
||||
#define EACCES 13
|
||||
#define EFAULT 14
|
||||
#define ENOTBLK 15
|
||||
#define EBUSY 16
|
||||
#define EEXIST 17
|
||||
#define EXDEV 18
|
||||
#define ENODEV 19
|
||||
#define ENOTDIR 20
|
||||
#define EISDIR 21
|
||||
#define EINVAL 22
|
||||
#define ENFILE 23
|
||||
#define EMFILE 24
|
||||
#define ENOTTY 25
|
||||
#define ETXTBSY 26
|
||||
#define EFBIG 27
|
||||
#define ENOSPC 28
|
||||
#define ESPIPE 29
|
||||
#define EROFS 30
|
||||
#define EMLINK 31
|
||||
#define EPIPE 32
|
||||
|
||||
/* math software */
|
||||
#define EDOM 33
|
||||
#define ERANGE 34
|
||||
|
||||
/* hereafter is available to CP/M specials */
|
||||
#define ENODSPC 35
|
||||
|
||||
/****** end of errno.h ******/
|
||||
2262
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/link68.c
Normal file
2262
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/link68.c
Normal file
File diff suppressed because it is too large
Load Diff
205
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/link68.h
Normal file
205
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/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;
|
||||
198
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/lnkmess.c
Normal file
198
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/lnkmess.c
Normal file
@@ -0,0 +1,198 @@
|
||||
#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");
|
||||
}
|
||||
|
||||
|
||||
333
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/loadr.s
Normal file
333
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/loadr.s
Normal file
@@ -0,0 +1,333 @@
|
||||
*********************************
|
||||
* *
|
||||
* 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,11 @@
|
||||
|
||||
/*
|
||||
* 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,11 @@
|
||||
|
||||
/*
|
||||
* 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,29 @@
|
||||
$1cp68 -i 0$1 link68.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
era $1x.i
|
||||
era $1x.st
|
||||
$1c168 $1x.ic link68.s -ld
|
||||
$1as68 -s 0$1 -f $1 -l -u link68.s
|
||||
era link68.s
|
||||
|
||||
$1cp68 -i 0$1 lnkmess.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
era $1x.i
|
||||
era $1x.st
|
||||
$1c168 $1x.ic lnkmess.s -ld
|
||||
$1as68 -s 0$1 -f $1 -l -u lnkmess.s
|
||||
era lnkmess.s
|
||||
|
||||
$1cp68 -i 0$1 preproc.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
era $1x.i
|
||||
era $1x.st
|
||||
$1c168 $1x.ic preproc.s -ld
|
||||
$1as68 -s 0$1 -f $1 -l -u preproc.s
|
||||
era preproc.s
|
||||
|
||||
$1as68 -s 0$1 -f $1 -l -u loadr.s
|
||||
$1as68 -s 0$1 -f $1 -l -u ovhdlr.s
|
||||
|
||||
|
||||
$1lo68 -unofloat -r -o link68.rel -f $1 0$1s.o link68.o preproc.o lnkmess.o 0$1clib
|
||||
118
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/ovhdlr.s
Normal file
118
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/ovhdlr.s
Normal file
@@ -0,0 +1,118 @@
|
||||
*
|
||||
* 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
|
||||
@@ -0,0 +1,54 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* C P / M C R U N T I M E L I B H E A D E R F I L E
|
||||
* -------------------------------------------------------------
|
||||
* Copyright 1982 by Digital Research Inc. All rights reserved.
|
||||
*
|
||||
* This is an include file for assisting the user to write portable
|
||||
* programs for C.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define ALCYON 1 /* using Alcyon compiler */
|
||||
/*
|
||||
* Standard type definitions
|
||||
*/
|
||||
/***************************/
|
||||
#define BYTE char /* Signed byte */
|
||||
#define BOOLEAN char /* 2 valued (true/false) */
|
||||
#define WORD short /* Signed word (16 bits) */
|
||||
#define UWORD unsigned int /* unsigned word */
|
||||
#define LONG long /* signed long (32 bits) */
|
||||
#define ULONG unsigned long /* Unsigned long */
|
||||
#define REG register /* register variable */
|
||||
#define LOCAL auto /* Local var on 68000 */
|
||||
#define EXTERN extern /* External variable */
|
||||
#define MLOCAL static /* Local to module */
|
||||
#define GLOBAL /**/ /* Global variable */
|
||||
#define VOID /**/ /* Void function return */
|
||||
#define DEFAULT int /* Default size */
|
||||
#define FLOAT float /* Floating point */
|
||||
#define DOUBLE double /* Double precision */
|
||||
/***************************/
|
||||
#ifdef ALCYON
|
||||
#define UBYTE char
|
||||
#else
|
||||
#define UBYTE unsigned char /* Unsigned byte */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* Miscellaneous Definitions: */
|
||||
/****************************************************************************/
|
||||
#define FAILURE (-1) /* Function failure return val */
|
||||
#define SUCCESS (0) /* Function success return val */
|
||||
#define YES 1 /* "TRUE" */
|
||||
#define NO 0 /* "FALSE" */
|
||||
#define FOREVER for(;;) /* Infinite loop declaration */
|
||||
#define NULL 0 /* Null pointer value */
|
||||
#define ZERO 0 /* Zero value */
|
||||
#define EOF (-1) /* EOF Value */
|
||||
#define TRUE (1) /* Function TRUE value */
|
||||
#define FALSE (0) /* Function FALSE value */
|
||||
|
||||
/*************************** end of portab.h ********************************/
|
||||
1029
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/preproc.c
Normal file
1029
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/link68/preproc.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
E:SEND CPM.H
|
||||
E:SEND DOWN.SUB
|
||||
E:SEND LINK68.C
|
||||
E:SEND LNKMESS.C
|
||||
E:SEND PREPROC.C
|
||||
E:SEND LOADR.S
|
||||
E:SEND OVHDLR.S
|
||||
E:SEND TMAIN.S
|
||||
E:SEND TOVH.S
|
||||
E:SEND TOVH2.S
|
||||
E:SEND MACHINE.68K
|
||||
E:SEND MACHINE.H
|
||||
E:SEND MACHINE.VAX
|
||||
E:SEND MAKE.SUB
|
||||
E:SEND BDOS.H
|
||||
E:SEND CTYPE.H
|
||||
E:SEND ERRNO.H
|
||||
E:SEND PORTAB.H
|
||||
E:SEND BASEPAGE.H
|
||||
E:SEND SETJMP.H
|
||||
E:SEND SGTTY.H
|
||||
E:SEND SIGNAL.H
|
||||
E:SEND STDIO.H
|
||||
E:SEND CLIB.
|
||||
E:SEND COUT.H
|
||||
E:SEND LINK68.H
|
||||
E:SEND SEND3.SUB
|
||||
@@ -0,0 +1,35 @@
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* L o n g j u m p H e a d e r F i l e */
|
||||
/* --------------------------------------- */
|
||||
/* */
|
||||
/* Copyright 1982 by Digital Research. All rights reserved. */
|
||||
/* */
|
||||
/* Long jumps on the 68K are implemented as follows: */
|
||||
/* */
|
||||
/* 1). Routine "setjmp" is called to setup a special */
|
||||
/* buffer for return. The return address, stack */
|
||||
/* pointer and frame pointer are saved. This allows */
|
||||
/* the calling program to do the proper number of */
|
||||
/* "pops". */
|
||||
/* */
|
||||
/* 2). At some later time, the procedure "longjmp" is */
|
||||
/* called. The programmer sees a return from the */
|
||||
/* previous "setjmp" as the result. */
|
||||
/* */
|
||||
/* Calling sequence: */
|
||||
/* */
|
||||
/* #include <setjmp.h> (definitions) */
|
||||
/* jmp_buf env; (define a buffer for saved stuff) */
|
||||
/* */
|
||||
/* setjmp(env); */
|
||||
/* a: */
|
||||
/* */
|
||||
/* longjmp(env,val); */
|
||||
/* */
|
||||
/* Setjmp returns a WORD of 0 on first call, and "val" on the */
|
||||
/* subsequent "longjmp" call. The longjmp call causes execution to */
|
||||
/* resume at "a:" above. */
|
||||
/* */
|
||||
/****************************************************************************/
|
||||
typedef LONG jmp_buf[3];
|
||||
@@ -0,0 +1,14 @@
|
||||
/* sgtty.h - tty control information */
|
||||
/* Note reduced contents for CP/M implementation... */
|
||||
struct sgttyb{
|
||||
char sg_ispeed; /* ignored */
|
||||
char sg_ospeed; /* ignored */
|
||||
char sg_erase; /* ignored */
|
||||
char sg_kill; /* ignored */
|
||||
int sg_flags;
|
||||
};
|
||||
#define RAW 0000040
|
||||
#define CRMOD 0000020
|
||||
#define ECHO 0000010
|
||||
#define LCASE 0000004
|
||||
#define CBREAK 0000002
|
||||
@@ -0,0 +1,32 @@
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* S i g n a l H e a d e r F i l e */
|
||||
/* ----------------------------------- */
|
||||
/* */
|
||||
/* Copyright 1982 by Digital Research, Inc. All rights reserved. */
|
||||
/* */
|
||||
/* Define the "signal" arguments, so anyone using the function will */
|
||||
/* not get compile-time errors. Some functions are not implemented. */
|
||||
/* */
|
||||
/****************************************************************************/
|
||||
#define NSIG 16 /* 16 simulated signals */
|
||||
#define SIGHUP 1 /* Hangup */
|
||||
#define SIGINT 2 /* Interrupt (^C) */
|
||||
#define SIGQUIT 3 /* Quit signal */
|
||||
#define SIGILL 4 /* Illegal Instruction trap */
|
||||
#define SIGTRAP 5 /* Trace Trap */
|
||||
#define SIGIOT 6 /* IOT instruction (on PDP-11) */
|
||||
#define SIGEMT 7 /* EMT instruction (TRAP on 68k) */
|
||||
#define SIGFPE 8 /* Floating point exception */
|
||||
#define SIGKILL 9 /* Kill (cannot be intercepted) */
|
||||
#define SIGBUS 10 /* BUSERR (non-ex memory reference) */
|
||||
#define SIGSEGV 11 /* Segmentation (MMU) violation */
|
||||
#define SIGSYS 12 /* Bad argument to system call */
|
||||
#define SIGPIPE 13 /* Write on a broken pipe */
|
||||
#define SIGALRM 14 /* Alarm clock (what a name!) */
|
||||
#define SIGTERM 15 /* Software termination signal */
|
||||
/************************************/
|
||||
#define BADSIG (-1L) /* Error return */
|
||||
#define SIG_DFL (0L) /* Default action on signal call */
|
||||
#define SIG_IGN (1L) /* Ignore */
|
||||
/************************************/
|
||||
@@ -0,0 +1,68 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* C P / M C H E A D E R F I L E
|
||||
* -----------------------------------
|
||||
* Copyright 1982 by Digital Research Inc. All rights reserved.
|
||||
*
|
||||
* This is the standard include file for the CP/M C Run Time Library.
|
||||
*
|
||||
*****************************************************************************/
|
||||
/* */
|
||||
#include <portab.h> /* Portability Definitions */
|
||||
/* */
|
||||
/****************************************************************************
|
||||
* Stream I/O File Definitions
|
||||
*****************************************************************************/
|
||||
#define BUFSIZ 512 /* Standard (ascii) buf size */
|
||||
#define MAXFILES 16 /* Max # open files ( < 32 ) */
|
||||
struct _iobuf { /* */
|
||||
WORD _fd; /* file descriptor for low level io */
|
||||
WORD _flag; /* stream info flags */
|
||||
BYTE *_base; /* base of buffer */
|
||||
BYTE *_ptr; /* current r/w pointer */
|
||||
WORD _cnt; /* # chars to be read/have been wrt */
|
||||
}; /* */
|
||||
#ifndef FILE /* conditionally include: */
|
||||
extern struct _iobuf _iob[MAXFILES]; /* an array of this info */
|
||||
#define FILE struct _iobuf /* stream definition */
|
||||
#endif /************************************/
|
||||
/* flag byte definition */
|
||||
#define _IOREAD 0x01 /* readable file */
|
||||
#define _IOWRT 0x02 /* writeable file */
|
||||
#define _IOABUF 0x04 /* alloc'd buffer */
|
||||
#define _IONBUF 0x08 /* no buffer */
|
||||
#define _IOERR 0x10 /* error has occurred */
|
||||
#define _IOEOF 0x20 /* EOF has occurred */
|
||||
#define _IOLBUF 0x40 /* handle as line buffer */
|
||||
#define _IOSTRI 0x80 /* this stream is really a string */
|
||||
#define _IOASCI 0x100 /* this was opened as an ascii file */
|
||||
/************************************/
|
||||
#define stdin (&_iob[0]) /* standard input stream */
|
||||
#define stdout (&_iob[1]) /* " output " */
|
||||
#define stderr (&_iob[2]) /* " error " */
|
||||
/************************************/
|
||||
#define clearerr(p) ((p)->_flag & ~_IOERR) /* clear error flag */
|
||||
#define feof(p) ((p)->_flag & _IOEOF) /* EOF encountered on stream */
|
||||
#define ferror(p) ((p)->_flag & _IOERR) /* error encountered on stream */
|
||||
#define fileno(p) ((p)->_fd) /* get stream's file descriptor */
|
||||
#define getchar() getc(stdin) /* get char from stdin */
|
||||
#define putchar(c) putc(c,stdout) /* put char to stdout */
|
||||
#define putc fputc
|
||||
#define getc fgetc
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* M A C R O S */
|
||||
/* ----------- */
|
||||
/* */
|
||||
/* Define some stuff as macros .... */
|
||||
/* */
|
||||
/****************************************************************************/
|
||||
|
||||
#define abs(x) ((x) < 0 ? -(x) : (x)) /* Absolute value function */
|
||||
|
||||
#define max(x,y) (((x) > (y)) ? (x) : (y)) /* Max function */
|
||||
#define min(x,y) (((x) < (y)) ? (x) : (y)) /* Min function */
|
||||
|
||||
/*************************** end of stdio.h *********************************/
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
* 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,15 @@
|
||||
|
||||
* 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
|
||||
@@ -0,0 +1,27 @@
|
||||
vax CPM.H s
|
||||
vax DOWN.SUB s
|
||||
vax LINK68.C s
|
||||
vax LNKMESS.C s
|
||||
vax PREPROC.C s
|
||||
vax LOADR.S s
|
||||
vax OVHDLR.S s
|
||||
vax TMAIN.S s
|
||||
vax TOVH.S s
|
||||
vax TOVH2.S s
|
||||
vax MACHINE.68K s
|
||||
vax MACHINE.H s
|
||||
vax MACHINE.VAX s
|
||||
vax MAKE.SUB s
|
||||
vax BDOS.H s
|
||||
vax CTYPE.H s
|
||||
vax ERRNO.H s
|
||||
vax PORTAB.H s
|
||||
vax BASEPAGE.H s
|
||||
vax SETJMP.H s
|
||||
vax SGTTY.H s
|
||||
vax SIGNAL.H s
|
||||
vax STDIO.H s
|
||||
vax COUT.H s
|
||||
vax LINK68.H s
|
||||
vax SEND3.SUB s
|
||||
vax up3.sub s
|
||||
@@ -0,0 +1,29 @@
|
||||
$ set noon
|
||||
$ vsend BASEPAGE.H
|
||||
$ vsend BDOS.H
|
||||
$ vsend COUT.H
|
||||
$ vsend CPM.H
|
||||
$ vsend CTYPE.H
|
||||
$ vsend DOWN.SUB
|
||||
$ vsend ERRNO.H
|
||||
$ vsend LINK68.C
|
||||
$ vsend LINK68.H
|
||||
$ vsend LNKMESS.C
|
||||
$ vsend LOADR.S
|
||||
$ vsend MACHINE.68K
|
||||
$ vsend MACHINE.H
|
||||
$ vsend MACHINE.VAX
|
||||
$ vsend MAKE.SUB
|
||||
$ vsend OVHDLR.S
|
||||
$ vsend PORTAB.H
|
||||
$ vsend PREPROC.C
|
||||
$ vsend SEND3.SUB
|
||||
$ vsend SETJMP.H
|
||||
$ vsend SGTTY.H
|
||||
$ vsend SIGNAL.H
|
||||
$ vsend STDIO.H
|
||||
$ vsend TMAIN.S
|
||||
$ vsend TOVH.S
|
||||
$ vsend TOVH2.S
|
||||
$ vsend UP3.SUB
|
||||
$ vsend done
|
||||
Reference in New Issue
Block a user