mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-10-24 08:54:17 +00:00
Upload
Digital Research
This commit is contained in:
14
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/cputc.c
Normal file
14
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/cputc.c
Normal file
@@ -0,0 +1,14 @@
|
||||
# include "iodec.h"
|
||||
|
||||
/**
|
||||
** put a single character
|
||||
**/
|
||||
|
||||
int f_log 0;
|
||||
|
||||
cputc(c, fn)
|
||||
char c;
|
||||
int fn;
|
||||
{
|
||||
write(fn,&c,1);
|
||||
}
|
||||
26
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/creat.c
Normal file
26
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/creat.c
Normal file
@@ -0,0 +1,26 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* C F I L E C R E A T E R O U T I N E
|
||||
* -----------------------------------------
|
||||
*
|
||||
* The "creat" routine opens a new "C" file and returns a file id.
|
||||
*
|
||||
* Calling Sequence:
|
||||
*
|
||||
* fid = creat(fname,prot,type);
|
||||
*
|
||||
* Where:
|
||||
*
|
||||
* fname is the address of a null terminated file name.
|
||||
* prot is the UNIX file protection
|
||||
* type is 0 for ASCII, 1 for BINARY
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <portab.h>
|
||||
WORD xcreat(fname,prot,type) /****************************/
|
||||
BYTE *fname; /* -> File name */
|
||||
WORD prot; /* Open mode */
|
||||
WORD type; /* ASCII/BINARY flag */
|
||||
{ /****************************/
|
||||
return(_creat(fname,prot,type)); /* Call clib routine */
|
||||
} /****************************/
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* El-Kludg-o Dup routine. Takes advantage of the fact that
|
||||
* stdout is not closed by Bill Allen's stuff.
|
||||
*/
|
||||
dup(n)
|
||||
register int n;
|
||||
{
|
||||
return(n);
|
||||
}
|
||||
52
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/getc.c
Normal file
52
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/getc.c
Normal file
@@ -0,0 +1,52 @@
|
||||
#define BLEN 512
|
||||
#include <klib.h>
|
||||
struct iob {
|
||||
int fd; /*file descriptor*/
|
||||
int cc; /*char count*/
|
||||
char *cp; /*ptr to next char*/
|
||||
char cbuf[BLEN]; /*char buffer*/
|
||||
};
|
||||
|
||||
fopen(fname,ibuf,x)
|
||||
char *fname;
|
||||
register struct iob *ibuf;
|
||||
int x;
|
||||
{
|
||||
|
||||
ibuf->cc = 0; /*no chars*/
|
||||
x = (x == 0) ? 0 : 1;
|
||||
return(ibuf->fd=open(fname,0,x));
|
||||
}
|
||||
|
||||
getc(ibuf)
|
||||
register struct iob *ibuf;
|
||||
{
|
||||
|
||||
if(ibuf->cc<=0) {
|
||||
ibuf->cp = &(ibuf->cbuf[0]);
|
||||
ibuf->cc = read(ibuf->fd,ibuf->cp,BLEN);
|
||||
}
|
||||
if(ibuf->cc <= 0) {
|
||||
return(-1);
|
||||
}
|
||||
ibuf->cc--;
|
||||
return((int)(*(ibuf->cp)++)&0xff);
|
||||
}
|
||||
|
||||
getw(ibuf)
|
||||
register struct iob *ibuf;
|
||||
{
|
||||
|
||||
register int j;
|
||||
register int i;
|
||||
|
||||
if((j=getc(ibuf)) == -1)
|
||||
return(-1);
|
||||
i = (j&0377) << 8;
|
||||
if((j=getc(ibuf)) == -1)
|
||||
return(-1);
|
||||
i =| (j&0377);
|
||||
if(i&0100000)
|
||||
i =| 0xffff0000; /* make it negative */
|
||||
return(i);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#define BLEN 512
|
||||
#include <klib.h>
|
||||
struct iob {
|
||||
int fd; /*file descriptor*/
|
||||
int cc; /*char count*/
|
||||
char *cp; /*ptr to next char*/
|
||||
char cbuf[BLEN]; /*char buffer*/
|
||||
} fin;
|
||||
|
||||
getchar()
|
||||
{
|
||||
char c;
|
||||
register int i;
|
||||
|
||||
if(fin.fd==0) {
|
||||
if(read(0,&c,1)<=0 || c==4)
|
||||
return(0);
|
||||
i = c;
|
||||
return(i&0xff);
|
||||
}
|
||||
if(fin.cc<=0) {
|
||||
fin.cp = &(fin.cbuf[0]);
|
||||
fin.cc = read(fin.fd,fin.cp,BLEN);
|
||||
}
|
||||
if(fin.cc <= 0) {
|
||||
return(0);
|
||||
}
|
||||
fin.cc--;
|
||||
i = *(fin.cp)++;
|
||||
return(i&0xff);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#define BLEN 512
|
||||
#include <klib.h>
|
||||
struct iob {
|
||||
int fd; /*file descriptor*/
|
||||
int cc; /*char count*/
|
||||
char *cp; /*ptr to next char*/
|
||||
char cbuf[BLEN]; /*char buffer*/
|
||||
};
|
||||
|
||||
fopen(fname,ibuf,x)
|
||||
char *fname;
|
||||
register struct iob *ibuf;
|
||||
int x;
|
||||
{
|
||||
|
||||
ibuf->cc = 0; /*no chars*/
|
||||
x = (x == 0) ? 0 : 1;
|
||||
return(ibuf->fd=open(fname,0,x));
|
||||
}
|
||||
|
||||
getc(ibuf)
|
||||
register struct iob *ibuf;
|
||||
{
|
||||
|
||||
if(ibuf->cc<=0) {
|
||||
ibuf->cp = &(ibuf->cbuf[0]);
|
||||
ibuf->cc = read(ibuf->fd,ibuf->cp,BLEN);
|
||||
}
|
||||
if(ibuf->cc <= 0) {
|
||||
return(-1);
|
||||
}
|
||||
ibuf->cc--;
|
||||
return((int)(*(ibuf->cp)++)&0xff);
|
||||
}
|
||||
|
||||
getw(ibuf)
|
||||
register struct iob *ibuf;
|
||||
{
|
||||
|
||||
register int j;
|
||||
register int i;
|
||||
|
||||
if((j=getc(ibuf)) == -1)
|
||||
return(-1);
|
||||
i = (j&0377);
|
||||
if((j=getc(ibuf)) == -1)
|
||||
return(-1);
|
||||
i =| (j&0377) << 8;
|
||||
if(i&0100000)
|
||||
i =| 0xffff0000; /* make it negative */
|
||||
return(i);
|
||||
}
|
||||
24
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/iodec.h
Normal file
24
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/iodec.h
Normal file
@@ -0,0 +1,24 @@
|
||||
# define MAXFILES 15
|
||||
|
||||
struct fileps
|
||||
{
|
||||
char *buff; /* beginning of buffer */
|
||||
char *bptr; /* current position */
|
||||
int nchars; /* number of characters internal */
|
||||
int bsize; /* size of buffer */
|
||||
char eoferr; /* end of file flag */
|
||||
char wrflag; /* mode flag */
|
||||
char *pbuff; /* bottom of peek buffer */
|
||||
};
|
||||
|
||||
struct fileps __filehdr[MAXFILES];
|
||||
|
||||
struct param
|
||||
{
|
||||
int bufsize; /* initial buffer size */
|
||||
int peeksize; /* initial peek size */
|
||||
};
|
||||
|
||||
extern struct param __param;
|
||||
|
||||
int __statbuf[MAXFILES];
|
||||
25
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/klib.h
Normal file
25
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/klib.h
Normal 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.
|
||||
*
|
||||
*/
|
||||
@@ -0,0 +1,20 @@
|
||||
$ set noon
|
||||
$ klib
|
||||
$ !
|
||||
$ ! Klib creation for vms
|
||||
$ !
|
||||
$ del *.o;*
|
||||
$ cc68 cputc
|
||||
$ cc68 creat
|
||||
$ cc68 dup
|
||||
$ cc68 getc
|
||||
$ cc68 getchar
|
||||
$ cc68 open
|
||||
$ cc68 putc
|
||||
$ cc68 putchar
|
||||
$ cc68 seek
|
||||
$ cc68 strcmp
|
||||
$ del lib6.a;*
|
||||
$ ar68 r lib6.a cputc.o putchar.o putc.o getchar.o
|
||||
$ ar68 r lib6.a getc.o open.o creat.o seek.o
|
||||
$ ar68 r lib6.a strcmp.o dup.o
|
||||
100
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/make.sub
Normal file
100
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/make.sub
Normal file
@@ -0,0 +1,100 @@
|
||||
$1cp68 cputc.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
$1c168 $1x.ic cputc.s -l
|
||||
$1as68 -s 0$1 -f $1 -l -u cputc.s
|
||||
era $1x.i
|
||||
era $1x.ic
|
||||
era $1x.st
|
||||
era cputc.s
|
||||
|
||||
$1cp68 CREAT.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
$1c168 $1x.ic CREAT.s -l
|
||||
$1as68 -s 0$1 -f $1 -l -u CREAT.s
|
||||
era $1x.i
|
||||
era $1x.ic
|
||||
era $1x.st
|
||||
era CREAT.s
|
||||
|
||||
$1cp68 dup.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
$1c168 $1x.ic dup.s -l
|
||||
$1as68 -s 0$1 -f $1 -l -u dup.s
|
||||
era $1x.i
|
||||
era $1x.ic
|
||||
era $1x.st
|
||||
era dup.s
|
||||
|
||||
$1cp68 getc.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
$1c168 $1x.ic getc.s -l
|
||||
$1as68 -s 0$1 -f $1 -l -u getc.s
|
||||
era $1x.i
|
||||
era $1x.ic
|
||||
era $1x.st
|
||||
era getc.s
|
||||
|
||||
$1cp68 getchar.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
$1c168 $1x.ic getchar.s -l
|
||||
$1as68 -s 0$1 -f $1 -l -u getchar.s
|
||||
era $1x.i
|
||||
era $1x.ic
|
||||
era $1x.st
|
||||
era getchar.s
|
||||
|
||||
$1cp68 OPEN.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
$1c168 $1x.ic OPEN.s -l
|
||||
$1as68 -s 0$1 -f $1 -l -u OPEN.s
|
||||
era $1x.i
|
||||
era $1x.ic
|
||||
era $1x.st
|
||||
era OPEN.s
|
||||
|
||||
$1cp68 putc.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
$1c168 $1x.ic putc.s -l
|
||||
$1as68 -s 0$1 -f $1 -l -u putc.s
|
||||
era $1x.i
|
||||
era $1x.ic
|
||||
era $1x.st
|
||||
era putc.s
|
||||
|
||||
$1cp68 putchar.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
$1c168 $1x.ic putchar.s -l
|
||||
$1as68 -s 0$1 -f $1 -l -u putchar.s
|
||||
era $1x.i
|
||||
era $1x.ic
|
||||
era $1x.st
|
||||
era putchar.s
|
||||
|
||||
$1cp68 seek.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
$1c168 $1x.ic seek.s -l
|
||||
$1as68 -s 0$1 -f $1 -l -u seek.s
|
||||
era $1x.i
|
||||
era $1x.ic
|
||||
era $1x.st
|
||||
era seek.s
|
||||
|
||||
$1cp68 STRCMP.c $1x.i
|
||||
$1c068 $1x.i $1x.ic $1x.st
|
||||
$1c168 $1x.ic STRCMP.s -l
|
||||
$1as68 -s 0$1 -f $1 -l -u STRCMP.s
|
||||
era $1x.i
|
||||
era $1x.ic
|
||||
era $1x.st
|
||||
era STRCMP.s
|
||||
|
||||
|
||||
era lib6.a
|
||||
$1ar68 rf $1 lib6.a cputc.o putchar.o putc.o getchar.o
|
||||
$1ar68 rf $1 lib6.a getc.o open.o creat.o seek.o
|
||||
$1ar68 rf $1 lib6.a strcmp.o dup.o
|
||||
|
||||
|
||||
era *.o
|
||||
|
||||
user 6!make $1
|
||||
31
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/open.c
Normal file
31
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/open.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* C F I L E O P E N R O U T I N E
|
||||
* -------------------------------------
|
||||
*
|
||||
* The "open" routine opens a "C" file and returns a file id.
|
||||
*
|
||||
* Calling Sequence:
|
||||
*
|
||||
* fid = open(fname,mode,type);
|
||||
*
|
||||
* Where:
|
||||
*
|
||||
* fname is the address of a null terminated file name.
|
||||
* mode is the open mode:
|
||||
*
|
||||
* 0 => READ access only
|
||||
* 1 => WRITE access only
|
||||
* 2 => Both READ and WRITE
|
||||
* type is 0 for ASCII files, 1 for BINARY
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include <portab.h> /* */
|
||||
WORD xopen(fname,mode,xtype) /****************************/
|
||||
BYTE *fname; /* -> File name */
|
||||
WORD mode; /* Open mode */
|
||||
WORD xtype; /* File type */
|
||||
{ /****************************/
|
||||
return(_open(fname,mode,xtype)); /* Call clib routine */
|
||||
} /****************************/
|
||||
@@ -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 ********************************/
|
||||
63
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/putc.c
Normal file
63
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/putc.c
Normal file
@@ -0,0 +1,63 @@
|
||||
#define BLEN 512
|
||||
#include <klib.h>
|
||||
struct iob {
|
||||
int fd; /*file descriptor*/
|
||||
int cc; /*char count*/
|
||||
char *cp; /*ptr to next char*/
|
||||
char cbuf[BLEN]; /*char buffer*/
|
||||
};
|
||||
|
||||
fcreat(fname,ibuf,x)
|
||||
char *fname;
|
||||
int x;
|
||||
register struct iob *ibuf;
|
||||
{
|
||||
|
||||
ibuf->cc = BLEN; /*no chars*/
|
||||
ibuf->cp = &(ibuf->cbuf[0]);
|
||||
x = (x == 0) ? 0 : 1;
|
||||
return(ibuf->fd=creat(fname,2,x));
|
||||
}
|
||||
|
||||
putc(c,ibuf)
|
||||
char c;
|
||||
register struct iob *ibuf;
|
||||
{
|
||||
|
||||
if(ibuf->cc<=0) {
|
||||
ibuf->cp = &(ibuf->cbuf[0]);
|
||||
if(write(ibuf->fd,ibuf->cp,BLEN) != BLEN)
|
||||
return(-1);
|
||||
ibuf->cc = BLEN;
|
||||
}
|
||||
*(ibuf->cp)++ = c;
|
||||
ibuf->cc--;
|
||||
return(c);
|
||||
}
|
||||
|
||||
putw(w,ibuf)
|
||||
int w;
|
||||
register struct iob *ibuf;
|
||||
{
|
||||
|
||||
register j;
|
||||
int i;
|
||||
|
||||
putc((w>>8)&0xff,ibuf);
|
||||
putc(w&0xff,ibuf);
|
||||
return(w);
|
||||
}
|
||||
|
||||
myfflush(ibuf)
|
||||
register struct iob *ibuf;
|
||||
{
|
||||
|
||||
register i;
|
||||
|
||||
i = BLEN - ibuf->cc;
|
||||
ibuf->cc = BLEN;
|
||||
ibuf->cp = &(ibuf->cbuf[0]);
|
||||
if(write(ibuf->fd,ibuf->cp,i) != i)
|
||||
return(-1);
|
||||
return(0);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#define BLEN 512
|
||||
#include <klib.h>
|
||||
struct iob {
|
||||
int fd; /*file descriptor*/
|
||||
int cc; /*char count*/
|
||||
char *cp; /*ptr to next char*/
|
||||
char cbuf[BLEN]; /*char buffer*/
|
||||
} fout = {0,BLEN,&fout.cbuf[0]};
|
||||
|
||||
xputchar(cc)
|
||||
char cc;
|
||||
{
|
||||
|
||||
if(fout.fd <= 1) {
|
||||
if(write(1,&cc,1) != 1)
|
||||
return(-1);
|
||||
return(cc);
|
||||
}
|
||||
/* buffered output*/
|
||||
if(fout.cc<=0) {
|
||||
fout.cp = &(fout.cbuf[0]);
|
||||
if(write(fout.fd,fout.cp,BLEN) != BLEN)
|
||||
return(-1);
|
||||
fout.cc = BLEN;
|
||||
}
|
||||
*(fout.cp)++ = cc;
|
||||
fout.cc--;
|
||||
return(cc);
|
||||
}
|
||||
|
||||
myflush()
|
||||
{
|
||||
|
||||
register i;
|
||||
|
||||
i = BLEN - fout.cc;
|
||||
fout.cc = BLEN;
|
||||
fout.cp = &(fout.cbuf[0]);
|
||||
if(write(fout.fd,fout.cp,i) != i)
|
||||
return(-1);
|
||||
return(0);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
#define BLEN 512
|
||||
#include <klib.h>
|
||||
struct iob {
|
||||
int fd; /*file descriptor*/
|
||||
int cc; /*char count*/
|
||||
char *cp; /*ptr to next char*/
|
||||
char cbuf[BLEN]; /*char buffer*/
|
||||
};
|
||||
|
||||
fcreat(fname,ibuf,x)
|
||||
char *fname;
|
||||
int x;
|
||||
register struct iob *ibuf;
|
||||
{
|
||||
|
||||
ibuf->cc = BLEN; /*no chars*/
|
||||
ibuf->cp = &(ibuf->cbuf[0]);
|
||||
x = (x == 0) ? 0 : 1;
|
||||
return(ibuf->fd=creat(fname,2,x));
|
||||
}
|
||||
|
||||
putc(c,ibuf)
|
||||
char c;
|
||||
register struct iob *ibuf;
|
||||
{
|
||||
|
||||
if(ibuf->cc<=0) {
|
||||
ibuf->cp = &(ibuf->cbuf[0]);
|
||||
if(write(ibuf->fd,ibuf->cp,BLEN) != BLEN)
|
||||
return(-1);
|
||||
ibuf->cc = BLEN;
|
||||
}
|
||||
*(ibuf->cp)++ = c;
|
||||
ibuf->cc--;
|
||||
return(c);
|
||||
}
|
||||
|
||||
putw(w,ibuf)
|
||||
int w;
|
||||
register struct iob *ibuf;
|
||||
{
|
||||
|
||||
register j;
|
||||
int i;
|
||||
|
||||
putc((char)w,ibuf);
|
||||
putc((char)(w>>8),ibuf);
|
||||
return(w);
|
||||
}
|
||||
|
||||
myfflush(ibuf)
|
||||
register struct iob *ibuf;
|
||||
{
|
||||
|
||||
register i;
|
||||
|
||||
i = BLEN - ibuf->cc;
|
||||
ibuf->cc = BLEN;
|
||||
ibuf->cp = &(ibuf->cbuf[0]);
|
||||
if(write(ibuf->fd,ibuf->cp,i) != i)
|
||||
return(-1);
|
||||
return(0);
|
||||
}
|
||||
18
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/seek.c
Normal file
18
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/seek.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Seek.c -- Whitesmith's equivalent of V6 seek
|
||||
*/
|
||||
long lseek();
|
||||
|
||||
seek(fildes,offset,ptrname)
|
||||
int fildes; /* UNIX / WS file descriptor */
|
||||
int offset; /* File offset, bytes */
|
||||
int ptrname; /* Sense variable */
|
||||
{
|
||||
offset &= 0xffff; /* Clear sign extension problems*/
|
||||
if(ptrname > 2) /* Not byte sense seek */
|
||||
{ /* */
|
||||
offset = offset << 9; /* Multiply by 512 */
|
||||
ptrname -= 3; /* reset to range 0 .. 2 */
|
||||
} /********************************/
|
||||
return(lseek(fildes,(long)offset,ptrname));
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
E:SEND KLIB.H
|
||||
E:SEND MAKE.SUB
|
||||
E:SEND SEEK.C
|
||||
E:SEND OPEN.C
|
||||
E:SEND LIB6.A
|
||||
E:SEND CREAT.C
|
||||
E:SEND GETC.C
|
||||
E:SEND GETCHAR.C
|
||||
E:SEND PUTC.C
|
||||
E:SEND STRCMP.C
|
||||
E:SEND PUTCHAR.C
|
||||
E:SEND CPUTC.C
|
||||
E:SEND DUP.C
|
||||
E:SEND IODEC.H
|
||||
E:SEND PORTAB.H
|
||||
E:SEND SEND4.SUB
|
||||
@@ -0,0 +1,37 @@
|
||||
/*********************************************************************
|
||||
* STRCMP - compares strings
|
||||
*
|
||||
* Special version which is case - insensitive.
|
||||
*
|
||||
* WORD strcmp(s1,s2)
|
||||
* BYTE *s1, *s2;
|
||||
*
|
||||
* 'strcmp' compares null terminated strings s1 and s2.
|
||||
* Returns:
|
||||
* strcmp < 0 if s1<s2
|
||||
* strcmp = 0 if s1=s2
|
||||
* strcmp > 0 if s1>s2
|
||||
*********************************************************************/
|
||||
|
||||
#include <portab.h>
|
||||
|
||||
WORD xstrcmp(s1,s2)
|
||||
REG BYTE *s1, *s2;
|
||||
{
|
||||
REG BYTE a,b;
|
||||
while (*s1 && *s2)
|
||||
{
|
||||
a = _toupper(*s1++);
|
||||
b = _toupper(*s2++);
|
||||
if (a > b) return (1);
|
||||
if (a < b) return (-1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
MLOCAL BYTE _toupper(c)
|
||||
REG BYTE c;
|
||||
{
|
||||
if(c >= 'a' && c <= 'z')
|
||||
c -= 'a' - 'A';
|
||||
return(c);
|
||||
}
|
||||
16
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/up4.sub
Normal file
16
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102/klib/up4.sub
Normal file
@@ -0,0 +1,16 @@
|
||||
e:vax KLIB.H s
|
||||
e:vax MAKE.SUB s
|
||||
e:vax SEEK.C s
|
||||
e:vax OPEN.C s
|
||||
e:vax CREAT.C s
|
||||
e:vax GETC.C s
|
||||
e:vax GETCHAR.C s
|
||||
e:vax PUTC.C s
|
||||
e:vax STRCMP.C s
|
||||
e:vax PUTCHAR.C s
|
||||
e:vax CPUTC.C s
|
||||
e:vax DUP.C s
|
||||
e:vax IODEC.H s
|
||||
e:vax PORTAB.H s
|
||||
e:vax SEND4.SUB s
|
||||
e:vax up4.sub s
|
||||
@@ -0,0 +1,18 @@
|
||||
$ set noon
|
||||
$ klib
|
||||
$ !
|
||||
$ ! Klib creation for vms
|
||||
$ !
|
||||
$ del *.obj;*
|
||||
$ cx cputc
|
||||
$ cx creat
|
||||
$ cx dup
|
||||
$ cx getcvms
|
||||
$ cx getchar
|
||||
$ cx open
|
||||
$ cx putcvms
|
||||
$ cx putchar
|
||||
$ cx seek
|
||||
$ cx strcmp
|
||||
$ del klib.olb;*
|
||||
$ lib/creat klib *.obj
|
||||
@@ -0,0 +1,22 @@
|
||||
$ set noon
|
||||
$ vsend CPUTC.C
|
||||
$ vsend CREAT.C
|
||||
$ vsend DUP.C
|
||||
$ vsend GETC.C
|
||||
$ vsend GETCHAR.C
|
||||
$ vsend GETCVMS.C
|
||||
$ vsend IODEC.H
|
||||
$ vsend KLIB.H
|
||||
$ vsend MAKE.COM
|
||||
$ vsend MAKE.SUB
|
||||
$ vsend OPEN.C
|
||||
$ vsend PORTAB.H
|
||||
$ vsend PUTC.C
|
||||
$ vsend PUTCHAR.C
|
||||
$ vsend PUTCVMS.C
|
||||
$ vsend SEEK.C
|
||||
$ vsend SEND4.SUB
|
||||
$ vsend STRCMP.C
|
||||
$ vsend UP4.SUB
|
||||
$ vsend VMAKE.COM
|
||||
$ vsend done
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
Directory DRB0:[STEVE.CPM68K.V102.KLIB]
|
||||
|
||||
CPUTC.C;1
|
||||
CREAT.C;1
|
||||
DUP.C;1
|
||||
GETC.C;1
|
||||
GETCHAR.C;1
|
||||
GETCVMS.C;3
|
||||
IODEC.H;1
|
||||
KLIB.H;1
|
||||
MAKE.COM;3
|
||||
MAKE.SUB;3
|
||||
OPEN.C;1
|
||||
PORTAB.H;1
|
||||
PUTC.C;1
|
||||
PUTCHAR.C;1
|
||||
PUTCVMS.C;3
|
||||
SEEK.C;1
|
||||
SEND4.SUB;1
|
||||
STRCMP.C;1
|
||||
UP4.SUB;1
|
||||
VMAKE.COM;4
|
||||
VSEND.COM;1
|
||||
|
||||
Total of 21 files.
|
||||
Reference in New Issue
Block a user