Digital Research
This commit is contained in:
2020-11-06 18:50:37 +01:00
parent 621ed8ccaf
commit 31738079c4
8481 changed files with 1888323 additions and 0 deletions

View File

@@ -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;

View 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

View File

@@ -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*/

View File

@@ -0,0 +1,166 @@
/****************************************************************************/
/* */
/* 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 SEARCHF 17 /* Search for first */
#define SEARCHN 18 /* Search next */
#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 CHAIN 47 /* Chain to program */
#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 ***********************************/

View File

@@ -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)

View File

@@ -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 ******/

View File

@@ -0,0 +1,25 @@
/*
* This file defines procedure names used by the assembler, compiler,
* etc. to be the names used in this library.
*
* (In case you haven't guessed, the "k" in "klib" stands for:
*
* K L U D G E !)
*/
#define creat xcreat
#define open xopen
#define fopen xfopen
#define getc xgetc
#define getw xgetw
#define fcreat xfcreat
#define putw xputw
#define putc xputc
#define putchar(x) fputc(x,stdout)
#define strcmp xstrcmp
#define index xindex
#define strcpy xstrcpy
/*
* Defining the names in this manner allows using the V7 UNIX library
* to run the asinine V6 calls in the Alcyon software.
*
*/

View File

@@ -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*/

View File

@@ -0,0 +1,22 @@
/* HEADER FILE FOR PASCAL FILE I/O
* copyright (c) 1980 by Whitesmiths, Ltd.
*/
typedef struct {
TEXT *p_buf;
BYTES p_size;
TEXT p_mode;
UTINY p_fd;
} PFILE;
/* modes
*/
#define P_EOF 0
#define P_EOLN 1
#define P_INVAL 2
#define P_VALID 3
#define P_WRITE 4
#define P_WROTE 5
#define NFILES 16
#define P_TFD 0200

View File

@@ -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 ********************************/

View File

@@ -0,0 +1,87 @@
/* format of a symbol entry in the main table*/
#include "machine.h"
#define SEEKREL 1 /*relative seek flag*/
#define OSTSIZE 14 /*symbol table entry length on object file*/
/* without table link*/
# define STESIZE 18 /*byte length of symbol table entry*/
struct symtab {
char name[8]; /*symbol name*/
short flags; /*bit flags*/
long vl1; /*symbol value*/
char *tlnk; /*table link*/
};
struct symtab *symptr;
/* 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
#ifdef VAX
struct {
char lobyte;
char hibyte;
};
#endif
#ifdef PDP11
struct {
char lobyte;
char hibyte;
};
#endif
#ifdef MC68000
struct {
char hibyte;
char lobyte;
};
#endif
/* relocation bit definitions:*/
#define RBMASK 07 /*tells type of relocation*/
#define INSABS 7 /*first word of instr -- absolute*/
#define DABS 0 /*data word absolute*/
#define TRELOC 2 /* TEXT relocatable*/
#define DRELOC 1 /* DATA relocatable*/
#define BRELOC 3 /* BSS relocatable*/
#define EXTVAR 4 /* ref to external variable*/
#define LUPPER 5 /* upper word of long*/
struct buf{
int fildes;
int nunused;
char *xfree;
char buff[512];
};
struct buf ibuf={0};
char *ifilname=0;

View File

@@ -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[13];

View File

@@ -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

View File

@@ -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 */
/************************************/

View File

@@ -0,0 +1,74 @@
/* THE STANDARD HEADER
* copyright (c) 1978 by Whitesmiths, Ltd.
*/
/* the pseudo storage classes
*/
#define FAST register
#define GLOBAL extern
#define IMPORT extern
#define INTERN static
#define LOCAL static
/* the pseudo types
*/
#ifdef UTEXT
typedef unsigned char TEXT;
#else
typedef char TEXT;
#endif
typedef TEXT TBOOL;
typedef char TINY;
typedef double DOUBLE;
typedef int ARGINT, BOOL, VOID;
typedef long LONG;
typedef short COUNT, FILE, METACH;
typedef unsigned BYTES;
typedef unsigned char UTINY;
typedef unsigned long ULONG;
typedef unsigned short BITS, UCOUNT;
/* system parameters
*/
#define STDIN 0
#define STDOUT 1
#define STDERR 2
#define YES 1
#define NO 0
#define NULL 0
#define FOREVER for (;;)
#define BUFSIZE 512
#define BWRITE -1
#define READ 0
#define WRITE 1
#define UPDATE 2
#define EOF -1
#define BYTMASK 0377
/* macros
*/
#define abs(x) ((x) < 0 ? -(x) : (x))
#define gtc(pf) (0 < (pf)->_nleft ? (--(pf)->_nleft, \
*(pf)->_pnext++ & BYTMASK) : getc(pf))
#define isalpha(c) (islower(c) || isupper(c))
#define isdigit(c) ('0' <= (c) && (c) <= '9')
#define islower(c) ('a' <= (c) && (c) <= 'z')
#define isupper(c) ('A' <= (c) && (c) <= 'Z')
#define iswhite(c) ((c) <= ' ' || 0177 <= (c))
#define max(x, y) (((x) < (y)) ? (y) : (x))
#define min(x, y) (((x) < (y)) ? (x) : (y))
#define ptc(pf, c) (((pf)->_nleft < 512) ? (pf)->_buf[(pf)->_nleft++] = (c) :\
putc(pf, c))
#define tolower(c) (isupper(c) ? ((c) + ('a' - 'A')) : (c))
#define toupper(c) (islower(c) ? ((c) - ('a' - 'A')) : (c))
/* the file IO structure
*/
typedef struct fio
{
FILE _fd;
COUNT _nleft;
COUNT _fmode;
TEXT *_pnext;
TEXT _buf[BUFSIZE];
} FIO;

View File

@@ -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 *********************************/

View File

@@ -0,0 +1 @@
#define UTEXT 1

View File

@@ -0,0 +1,29 @@
/* VMS INTERFACE DEFINES
* copyright (c) 1980 by Whitesmiths, Ltd.
*/
/* basic parameters
*/
#define FAIL -1
#define NFILES 16
#define NOBLOCK 010000000000
/* codes for flags and access
*/
#define WREAD 0001
#define WWRITE 0002
#define WOPEN 0004
#define WTTY 0010
#define WCR 0020
#define WFIX 0040
#define WDIRT 0100
#define WREMOVE 0200
/* the Whitesmiths VMS control block
*/
typedef struct {
BITS flags;
COUNT bleft;
TEXT *bnext, *pbuf, *rab;
LONG lseek, lact, lend;
} RCB;