mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-10-27 02:14:19 +00:00
Upload
Digital Research
This commit is contained in:
39
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ABORT.S
Normal file
39
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ABORT.S
Normal file
@@ -0,0 +1,39 @@
|
||||
********************************************************************
|
||||
*
|
||||
* CP/M abort function for C Run Time Library
|
||||
*
|
||||
* "abort" generates an Illegal Instruction Trap to recall DDT
|
||||
* (if it is loaded).
|
||||
*
|
||||
*********************************************************************
|
||||
illegal = $4AFC
|
||||
.globl _abort
|
||||
.text
|
||||
_abort:
|
||||
move.w 4(sp),d0
|
||||
a: .dc.w illegal
|
||||
bra.b a * For Wise Guys
|
||||
************
|
||||
illegal = $4AFC
|
||||
.globl _abort
|
||||
.text
|
||||
_abort:
|
||||
move.w 4(sp),d0
|
||||
a: .dc.w illegal
|
||||
bra.b a * For Wse Guys
|
||||
************
|
||||
illegal = $4AFC
|
||||
.globl _abort
|
||||
.text
|
||||
_abort:
|
||||
move.w 4(sp),d0
|
||||
a: .dc.w illegal
|
||||
bra.b a * For Wse Guys
|
||||
************
|
||||
illegal = $4AFC
|
||||
.globl _abort
|
||||
.text
|
||||
_abort:
|
||||
move.w 4(sp),d0
|
||||
a: .dc.w illegal
|
||||
bra.b a * For W
|
||||
77
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ACCESS.C
Normal file
77
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ACCESS.C
Normal file
@@ -0,0 +1,77 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* a c c e s s F u n c t i o n
|
||||
* -----------------------------
|
||||
* Copyright 1982 by Digital Research Inc. All rights reserved.
|
||||
*
|
||||
* "access" returns 0 if access to a file is allowed, -1 o.w.
|
||||
* Under CP/M, this just tests for existence.
|
||||
*
|
||||
* Calling sequence:
|
||||
* ret = access(fname,mode)
|
||||
* Where:
|
||||
* ret = 0 if accessable, -1 o.w.
|
||||
* fname -> file's name, NULL terminated string
|
||||
* mode = test for read, write, exec, dir path access
|
||||
* (ignored by CP/M)
|
||||
*
|
||||
* Made O/S independent 20-Aug-83 sw
|
||||
* Added chmod & chown to this source module 16-Sep-83 whf
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include "portab.h"
|
||||
#include "osif.h"
|
||||
#include "osiferr.h"
|
||||
#include "errno.h"
|
||||
|
||||
WORD access(fname,mode) /* CLEAR FUNCTION ***********/
|
||||
BYTE *fname;
|
||||
WORD mode;
|
||||
{
|
||||
REG WORD rval;
|
||||
|
||||
if ((rval=open(fname,READ)) >= 0 ) /* File must be there ... */
|
||||
{
|
||||
close(rval); /* Free up fd */
|
||||
return(SUCCESS);
|
||||
}
|
||||
RETERR(FAILURE,ENOENT);
|
||||
}
|
||||
|
||||
|
||||
/***************************************/
|
||||
/* chmod - change mode: NOP under CP/M */
|
||||
/***************************************/
|
||||
WORD chmod(name,mode) /* CLEAR FUNCTION ***********/
|
||||
BYTE *name;
|
||||
WORD mode;
|
||||
{
|
||||
return(access(name,mode));
|
||||
}
|
||||
|
||||
|
||||
/**************************************************/
|
||||
/* chown - change owner: like access() under CP/M */
|
||||
/**************************************************/
|
||||
WORD chown(name,owner,group) /* CLEAR FUNCTION ***********/
|
||||
BYTE *name;
|
||||
WORD owner;
|
||||
WORD group;
|
||||
{
|
||||
return(access(name,0));
|
||||
}
|
||||
EAR FUNCTION ***********/
|
||||
BYTE *name;
|
||||
WORD owner;
|
||||
WORD group;
|
||||
{
|
||||
return(access(name,0));
|
||||
}
|
||||
EAR FUNCTION ***********/
|
||||
BYTE *name;
|
||||
WORD owner;
|
||||
WORD group;
|
||||
{
|
||||
return(access(name,0));
|
||||
}
|
||||
39
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ALDIV.S
Normal file
39
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ALDIV.S
Normal file
@@ -0,0 +1,39 @@
|
||||
.globl _ldiv
|
||||
.globl _aldiv
|
||||
.globl aldiv
|
||||
.text
|
||||
_aldiv:
|
||||
aldiv:
|
||||
~~aldiv:
|
||||
~l2=12
|
||||
~al1=8
|
||||
link R14,#-2
|
||||
move.l 12(R14),-(sp)
|
||||
move.l 8(R14),R8
|
||||
move.l (R8),-(sp)
|
||||
jsr _ldiv
|
||||
cmpm.l (sp)+,(sp)+
|
||||
move.l 8(R14),R9
|
||||
move.l R0,(R9)
|
||||
L1:
|
||||
unlk R14
|
||||
rts
|
||||
sp)
|
||||
move.l 8(R14),R8
|
||||
move.l (R8),-(sp)
|
||||
jsr _ldiv
|
||||
cmpm.l (sp)+,(sp)+
|
||||
move.l 8(R14),R9
|
||||
move.l R0,(R9)
|
||||
L1:
|
||||
unlk R14
|
||||
rts
|
||||
sp)
|
||||
move.l 8(R14),R8
|
||||
move.l (R8),-(sp)
|
||||
jsr _ldiv
|
||||
cmpm.l (sp)+,(sp)+
|
||||
move.l 8(R14),R9
|
||||
move.l R0,(R9)
|
||||
L1:
|
||||
unlk R14
|
||||
43
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ALMUL.S
Normal file
43
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ALMUL.S
Normal file
@@ -0,0 +1,43 @@
|
||||
.text
|
||||
.globl almul
|
||||
.globl lmul
|
||||
*
|
||||
* / this routine multiplies together two 32 bit signed long integers.
|
||||
* / the first arg is a pointer to the long, which is multiplied by the
|
||||
* / second arg, with the result being stored at the firstarg.
|
||||
* / lmul.s does the meat of the work
|
||||
*
|
||||
almul:
|
||||
move.l A5,-(sp)
|
||||
move.l 8(sp),A5
|
||||
move.l 12(sp),-(sp)
|
||||
move.l (A5),-(sp)
|
||||
jsr lmul
|
||||
add #8,sp
|
||||
move.l R0,(A5)
|
||||
move.l (sp)+,A5
|
||||
rts
|
||||
|
||||
move.l 8(sp),A5
|
||||
move.l 12(sp),-(sp)
|
||||
move.l (A5),-(sp)
|
||||
jsr lmul
|
||||
ad #8,sp
|
||||
move.l R0,(A5)
|
||||
move.l (sp)+,A5
|
||||
rts
|
||||
|
||||
move.l 8(sp),A5
|
||||
move.l 12(sp),-(sp)
|
||||
move.l (A5),-(sp)
|
||||
jsr lmul
|
||||
ad #8,sp
|
||||
move.l R0,(A5)
|
||||
move.l (sp)+,A5
|
||||
rts
|
||||
|
||||
move.l 8(sp),A5
|
||||
move.l 12(sp),-(sp)
|
||||
move.l (A5),-(sp)
|
||||
jsr lmul
|
||||
a
|
||||
46
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ALREM.S
Normal file
46
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ALREM.S
Normal file
@@ -0,0 +1,46 @@
|
||||
.globl _ldiv
|
||||
.globl _ldivr
|
||||
.comm _ldivr,4
|
||||
.globl _alrem
|
||||
.globl alrem
|
||||
.text
|
||||
_alrem:
|
||||
alrem:
|
||||
~~alrem:
|
||||
~l2=12
|
||||
~al1=8
|
||||
link R14,#-2
|
||||
move.l 12(R14),-(sp)
|
||||
move.l 8(R14),R8
|
||||
move.l (R8),-(sp)
|
||||
jsr _ldiv
|
||||
cmpm.l (sp)+,(sp)+
|
||||
move.l _ldivr,R0
|
||||
move.l 8(R14),R9
|
||||
move.l R0,(R9)
|
||||
unlk R14
|
||||
rts
|
||||
(R14),R8
|
||||
move.l (R8),-(sp)
|
||||
jsr _ldiv
|
||||
cmpm.l (sp)+,(sp)+
|
||||
move.l _ldivr,R0
|
||||
move.l 8(14),R9
|
||||
move.l R0,(R9)
|
||||
unlk R14
|
||||
rts
|
||||
(R14),R8
|
||||
move.l (R8),-(sp)
|
||||
jsr _ldiv
|
||||
cmpm.l (sp)+,(sp)+
|
||||
move.l _ldivr,R0
|
||||
move.l 8(14),R9
|
||||
move.l R0,(R9)
|
||||
unlk R14
|
||||
rts
|
||||
(R14),R8
|
||||
move.l (R8),-(sp)
|
||||
jsr _ldiv
|
||||
cmpm.l (sp)+,(sp)+
|
||||
move.l _ldivr,R0
|
||||
move.l 8(
|
||||
11
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ASSERT.H
Normal file
11
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ASSERT.H
Normal file
@@ -0,0 +1,11 @@
|
||||
/* ASSERT macro */
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define ASSERT(expr) {if(!(expr)) printf("assertion failed: expr\n");}
|
||||
#else
|
||||
#define ASSERT(expr)
|
||||
#endif
|
||||
RT(expr)
|
||||
#endif
|
||||
RT(expr)
|
||||
#endif
|
||||
40
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ATOI.C
Normal file
40
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ATOI.C
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
/* atoi - convert decimal number in ascii to integer */
|
||||
|
||||
#include "portab.h"
|
||||
#include "ctype.h"
|
||||
|
||||
WORD atoi(str) /* CLEAR FUNCTION ***********/
|
||||
REG BYTE *str;
|
||||
{
|
||||
REG WORD val;
|
||||
REG WORD isneg;
|
||||
|
||||
val = 0;
|
||||
isneg = FALSE;
|
||||
while( isspace(*str) )
|
||||
str++;
|
||||
if( *str == '+' )
|
||||
str++;
|
||||
else if( *str == '-' ) {
|
||||
str++;
|
||||
isneg++;
|
||||
}
|
||||
while( *str >= '0' && *str <= '9' )
|
||||
val = 10 * val + ( *str++ - '0' );
|
||||
if( isneg )
|
||||
val = -val;
|
||||
return( val );
|
||||
}
|
||||
<= '9' )
|
||||
val = 10 * val + ( *str++ - '0' );
|
||||
if( isneg )
|
||||
val = -val;
|
||||
return( val );
|
||||
}
|
||||
<= '9' )
|
||||
val = 10 * val + ( *str++ - '0' );
|
||||
if( isneg )
|
||||
val = -val;
|
||||
return( val );
|
||||
}
|
||||
41
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ATOL.C
Normal file
41
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/ATOL.C
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
|
||||
/* atol - convert decimal number in ascii to long integer */
|
||||
|
||||
#include "portab.h"
|
||||
#include "ctype.h"
|
||||
|
||||
LONG atol(str) /* CLEAR FUNCTION ***********/
|
||||
REG BYTE *str;
|
||||
{
|
||||
REG LONG val;
|
||||
REG WORD isneg;
|
||||
|
||||
val = 0L;
|
||||
isneg = FALSE;
|
||||
while( isspace(*str) )
|
||||
str++;
|
||||
if( *str == '+' )
|
||||
str++;
|
||||
else if( *str == '-' ) {
|
||||
str++;
|
||||
isneg++;
|
||||
}
|
||||
while( *str >= '0' && *str <= '9' )
|
||||
val = 10 * val + ( *str++ - '0' );
|
||||
if( isneg )
|
||||
val = -val;
|
||||
return( val );
|
||||
}
|
||||
&& *str <= '9' )
|
||||
val = 10 * val + ( *str++ - '0' );
|
||||
if( isneg )
|
||||
val = -val;
|
||||
return( val );
|
||||
}
|
||||
&& *str <= '9' )
|
||||
val = 10 * val + ( *str++ - '0' );
|
||||
if( isneg )
|
||||
val = -val;
|
||||
return( val );
|
||||
}
|
||||
33
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/BLIVOT.S
Normal file
33
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/BLIVOT.S
Normal file
@@ -0,0 +1,33 @@
|
||||
.globl _sw_
|
||||
_sw_:
|
||||
.text
|
||||
tst.l d5
|
||||
beq ok
|
||||
move.l #-1,(sp) * Destroy the evidence
|
||||
divs #$0,d5
|
||||
ok: rts
|
||||
|
||||
*********************************************************
|
||||
* *
|
||||
* Copyright Notice Module *
|
||||
* *
|
||||
*********************************************************
|
||||
|
||||
.data
|
||||
___cpyrt: .dc.b 'CP/M-68K(tm), Version 1.2, '
|
||||
.dc.b 'Copyright (c) 1983, Digital Research '
|
||||
serial: .dc.b 'XXXX-0000-654321'
|
||||
.dc.w 0
|
||||
.end
|
||||
m), Version 1.2, '
|
||||
.dc.b 'Copyright (c) 1983, Digital esearch '
|
||||
serial: .dc.b 'XXXX-0000-654321'
|
||||
.dc.w 0
|
||||
.end
|
||||
m), Version 1.2, '
|
||||
.dc.b 'Copyright (c) 1983, Digital esearch '
|
||||
serial: .dc.b 'XXXX-0000-654321'
|
||||
.dc.w 0
|
||||
.end
|
||||
m), Version 1.2, '
|
||||
.dc.b 'Copyright (c) 1983, Digital
|
||||
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/BLKFILL.C
Normal file
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/BLKFILL.C
Normal file
Binary file not shown.
117
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/BLKIO.C
Normal file
117
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/BLKIO.C
Normal file
@@ -0,0 +1,117 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _ b l k i o F u n c t i o n
|
||||
* -----------------------------
|
||||
* Copyright 1982,1983 by Digital Research Inc. All rights reserved.
|
||||
*
|
||||
* The _blkio function is used to read / write a set of contiguous
|
||||
* sectors in an open file.
|
||||
* Note: if CPM, it will use CP/M function 44 (Set Multi-Sector Count)
|
||||
* if os_multisectorio is TRUE (BDOS versions 3.0 and above).
|
||||
* Note 2: if PC-DOS, it will use block read and write functions.
|
||||
*
|
||||
* Edits:
|
||||
* 8-Dec-83 whf handle PC-DOS changes.
|
||||
*
|
||||
* Calling Sequence:
|
||||
* ret = _blkio(ccbp,sector,buffer,count,bdosfunc);
|
||||
*
|
||||
* Where:
|
||||
* ret = sectors actually read/written
|
||||
* ccbp -> the open file channel control block
|
||||
* sector = The desired starting sector number
|
||||
* buffer = The memory address to begin transfer
|
||||
* count = the number of sectors to read/write
|
||||
* bdosfunc= The BDOS function number (B_READ / B_WRITE)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "portab.h"
|
||||
#include "osif.h"
|
||||
#include "osiferr.h"
|
||||
#include "osattr.h"
|
||||
|
||||
#define MIN(x,y) ( ((x) < (y)) ? (x) : (y) )
|
||||
|
||||
LONG
|
||||
_blkio(ccbp,sector,buffer,count,bdosfunc)
|
||||
/****************************/
|
||||
FD *ccbp; /* open file pointer */
|
||||
LONG sector; /* Sector number */
|
||||
BYTE *buffer; /* User's buffer area */
|
||||
LONG count; /* # of sectors to do */
|
||||
int bdosfunc; /* BDOS function to use */
|
||||
{ /****************************/
|
||||
|
||||
#if PCDOS /*=============================================================*/
|
||||
REG WORD seccnt; /* number sectors xferred */
|
||||
WORD _pc_readblk(), _pc_writeblk(); /* functions to read/write */
|
||||
|
||||
if( bdosfunc == B_READ )
|
||||
return _pc_readblk(&(ccbp->fcb),sector,buffer,(WORD)count,SECSIZ);
|
||||
else return _pc_writeblk(&(ccbp->fcb),sector,buffer,(WORD)count,SECSIZ);
|
||||
}
|
||||
|
||||
#endif /*==============================================================*/
|
||||
|
||||
|
||||
#if CPM /*==============================================================*/
|
||||
WORD nsecs; /* # secs to xfer each time */
|
||||
LONG seccnt; /* # sectors processed */
|
||||
WORD xuser; /* old user number */
|
||||
WORD retcode; /* return code from BDOS */
|
||||
WORD Used_Multisec; /* flag for resetting msecio*/
|
||||
/****************************/
|
||||
seccnt = 0; /* Zero count initally */
|
||||
Used_Multisec = 0; /* Haven't used it yet */
|
||||
xuser = _chkuser(ccbp->user); /* Check for changed user # */
|
||||
nsecs = 1; /* default: xfer singly */
|
||||
/* */
|
||||
while (count > 0) /* Until all sectors xferred*/
|
||||
{ /* */
|
||||
__OSIF(SETDMA,buffer); /* Set new DMA address */
|
||||
|
||||
#if HILO /*==========================================================*/
|
||||
ccbp->fcb.record = sector; /* Set new record number */
|
||||
#else /*----------------------------------------------------------*/
|
||||
ccbp->fcb.record = sector << 8; /* Set new record number */
|
||||
#endif /*==========================================================*/
|
||||
|
||||
/* Multi Sector I/O xfer? */
|
||||
if( (count > 1 && os_multisectorio ) || nsecs > 1 )
|
||||
{ /* yes! */
|
||||
if( os_oldmultisec )
|
||||
nsecs = MIN(16,count); /* Older version of msecio */
|
||||
else nsecs = MIN(128,count);/* Later version of msecio */
|
||||
++Used_Multisec; /* Flag: need to reset */
|
||||
__OSIF(F_MULTISEC,nsecs); /* make the call */
|
||||
} /******* */
|
||||
/****************************/
|
||||
retcode = __OSIF(bdosfunc,&(ccbp->fcb));/* do the read/write*/
|
||||
/****************************/
|
||||
if(retcode != 0)
|
||||
{ /****************************/
|
||||
if(nsecs>1) /* were we trying multi-sec?*/
|
||||
{ /* yes! do error handling */
|
||||
if( os_oldmultisec ) /* Older msecio? */
|
||||
nsecs = __cpmrv >> 12; /* adjust nsecs read like so*/
|
||||
else nsecs = __cpmrv >> 8;/* later versions: use AH */
|
||||
} /*** */
|
||||
else nsecs = 0; /* ow. assume 0 secs read */
|
||||
seccnt += nsecs; /* Return nfg */
|
||||
break; /* Return from bottom */
|
||||
} /****************************/
|
||||
/* */
|
||||
sector += nsecs; /* Increment sector number */
|
||||
count -= nsecs; /* Down count */
|
||||
seccnt += nsecs; /* Bump sector count */
|
||||
buffer += nsecs*SECSIZ; /* Increment address */
|
||||
} /****************************/
|
||||
_uchkuser(ccbp->user,xuser); /* Reset user # if needed */
|
||||
if( Used_Multisec ) /* Need to reset msecio? */
|
||||
__OSIF(F_MULTISEC,1); /* then do so... */
|
||||
return(seccnt); /* All is OK */
|
||||
} /****************************/
|
||||
#endif /*==================================================================*/
|
||||
============*/
|
||||
============*/
|
||||
43
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/BLKMOVE.C
Normal file
43
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/BLKMOVE.C
Normal file
@@ -0,0 +1,43 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* b l k m o v e F u n c t i o n
|
||||
* -------------------------------
|
||||
* Copyright 1983, by Digital Research Inc.
|
||||
*
|
||||
* "blkmove()" moves a block of bytes from one address to another.
|
||||
*
|
||||
* Calling sequence:
|
||||
* blkmove(to,from,nn)
|
||||
* Where:
|
||||
* 'to' points to destination
|
||||
* 'from' points to source, and
|
||||
* 'nn' is the number of chars to move
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <portab.h>
|
||||
|
||||
VOID blkmove(to,from,nn) /* CLEAR FUNCTION ***********/
|
||||
BYTE *to, *from;
|
||||
WORD nn;
|
||||
{
|
||||
if( to < from )
|
||||
while(nn--)
|
||||
*to++ = *from++;
|
||||
else
|
||||
for( to += nn, from += nn; nn--; )
|
||||
*--to = *--from;
|
||||
}
|
||||
from )
|
||||
while(nn--)
|
||||
*to++ = *from++;
|
||||
else
|
||||
for( to += nn, from += nn; nn--; )
|
||||
*--to = *--from;
|
||||
}
|
||||
from )
|
||||
while(nn--)
|
||||
*to++ = *from++;
|
||||
else
|
||||
for( to += nn, from += nn; nn--; )
|
||||
*--to = *--from;
|
||||
}
|
||||
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/C.SUB
Normal file
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/C.SUB
Normal file
Binary file not shown.
62
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CALLOC.C
Normal file
62
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CALLOC.C
Normal file
@@ -0,0 +1,62 @@
|
||||
/********************************************************************
|
||||
*
|
||||
* calloc.c - memory allocator for sets of elements
|
||||
* zalloc - memory allocator like malloc only zeros storage.
|
||||
*
|
||||
* BYTE *calloc(nelem,sizelem)
|
||||
* UWORD nelem, sizelem;
|
||||
*
|
||||
* Returns a pointer to a region of (zero filled) memory large
|
||||
* enough to hold 'nelem' items each of size 'sizelem'.
|
||||
* Returns NULL if not enough memory, or allocation too large
|
||||
* (on 8086).
|
||||
*
|
||||
* BYTE *zalloc(nbytes)
|
||||
* UWORD nbytes;
|
||||
*
|
||||
* Returns a pointer to a region of zero filled memory nbytes long.
|
||||
* Returns NULL if not enough memory.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
#include "portab.h"
|
||||
#include "osif.h"
|
||||
|
||||
BYTE * zalloc(nbytes) /* CLEAR FUNCTION ***********/
|
||||
UWORD nbytes; /* number of bytes */
|
||||
{
|
||||
REG BYTE *rp; /* pointer to region */
|
||||
BYTE *malloc();
|
||||
|
||||
if( (rp = malloc(nbytes)) == NULLPTR) return(NULLPTR);
|
||||
blkfill( rp, NULL, nbytes );
|
||||
return(rp);
|
||||
}
|
||||
|
||||
BYTE * calloc(nelem,sizelem) /* CLEAR FUNCTION ***********/
|
||||
UWORD nelem, /* number of elements */
|
||||
sizelem; /* size of element */
|
||||
{
|
||||
REG LONG size;
|
||||
|
||||
size = sizelem*nelem;
|
||||
#if I8086
|
||||
if( size > 65535L )
|
||||
return NULLPTR;
|
||||
#endif
|
||||
return zalloc((UWORD)size);
|
||||
}
|
||||
e = sizelem*nelem;
|
||||
#if I8086
|
||||
if( size > 65535L )
|
||||
return NULLPTR;
|
||||
#endif
|
||||
return zalloc((UWORD)size);
|
||||
}
|
||||
e = sizelem*nelem;
|
||||
#if I8086
|
||||
if( size > 65535L )
|
||||
return NULLPTR;
|
||||
#endif
|
||||
return zalloc((UWORD)size);
|
||||
}
|
||||
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CE.SUB
Normal file
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CE.SUB
Normal file
Binary file not shown.
153
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CHANNELS.C
Normal file
153
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CHANNELS.C
Normal file
@@ -0,0 +1,153 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* C H A N N E L A L L O C A T I N G R O U T I N E S
|
||||
* -----------------------------------------------------
|
||||
* Copyright 1984 by Digital Research Inc. All rights reserved.
|
||||
*
|
||||
* Herein are all the routines which deal with Channel Control Block
|
||||
* (CCB) allocation and initialization. These routines (documented
|
||||
* individually below) are:
|
||||
*
|
||||
* i = _allocc();
|
||||
* _freec(i);
|
||||
* _chinit();
|
||||
* __chinit(fd)
|
||||
* ccbptr = _chkc(ch);
|
||||
*
|
||||
*****************************************************************************/
|
||||
#include "portab.h" /* Include std definitions */
|
||||
#include "osif.h" /* Also CP/M ones */
|
||||
#include "osiferr.h" /* To set error vars */
|
||||
#include "errno.h" /* Error return vals */
|
||||
|
||||
#ifdef MAXF5 /*--------------------------*/
|
||||
# define MAXCCBS 5 /* Maximum Num CCBs */
|
||||
maxfiles5() { ; } /* stubroutine for option.h */
|
||||
#else /*--------------------------*/
|
||||
|
||||
#ifdef MAXF10 /*--------------------------*/
|
||||
# define MAXCCBS 10 /* Maximum Num CCBs */
|
||||
#else /*--------------------------*/
|
||||
# define MAXCCBS 16 /* Maximum Num CCBs */
|
||||
#endif /*--------------------------*/
|
||||
|
||||
#endif /*--------------------------*/
|
||||
|
||||
LONG _chvec ={0}; /* Allocate storage */
|
||||
FD _fds[MAXCCBS]; /* Allocate CCB storage */
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* _ A L L O C C / _ F R E E C R O U T I N E S
|
||||
* -------------------------------------------------
|
||||
* Routines "_allocc" and "_freec" are used to allocate / deallocate a
|
||||
* channel number so that the user may do I/O directly without the OTS
|
||||
* getting in the way.
|
||||
* Note that this scheme preserves compatibility with OS's that really
|
||||
* truly use channels, and allows users to inform the C Run Time Library
|
||||
* routines that they are using the channel.
|
||||
* It's not important to use these routines under CP/M, since CP/M
|
||||
* allows you to have as many FCBs as you wish.
|
||||
*
|
||||
* Calling Sequence:
|
||||
* i = _allocc();
|
||||
* _freec(i);
|
||||
*****************************************************************************/
|
||||
|
||||
WORD _allocc() /****************************/
|
||||
{ /* */
|
||||
REG WORD i; /* Define 2 temporaries */
|
||||
REG LONG j; /* */
|
||||
/* */
|
||||
j = 1; /* Start with channel 0 */
|
||||
for(i=0;i<MAXCCBS;i++) /* Look at the bits */
|
||||
{ /* */
|
||||
if((j & _chvec) == 0) /* If 0, then channel free */
|
||||
{ /* */
|
||||
_chvec |= j; /* set allocated bit */
|
||||
return(i); /* and return the channel # */
|
||||
} /* */
|
||||
j <<= 1; /* Up to next bit */
|
||||
} /* End FOR loop */
|
||||
RETERR(FAILURE,EMFILE); /* All channels in use! */
|
||||
} /****************************/
|
||||
|
||||
WORD _freec(ch) /****************************/
|
||||
WORD ch; /* Channel number to free */
|
||||
{ /* */
|
||||
_chvec &= ~(1 << ch); /* Clear appropriate bit */
|
||||
return(SUCCESS); /* Return OK */
|
||||
} /****************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* C C B I N I T I A L I Z A T I O N
|
||||
* -----------------------------------
|
||||
* Routine "_chinit" is called from the run-time initialization to clear
|
||||
* out all the CCB storage.
|
||||
* Calling sequence:
|
||||
* _chinit();
|
||||
*
|
||||
* Routine "__chinit(fd)" is called from other low-level routines
|
||||
* for single channel initialization.
|
||||
* Calling sequence:
|
||||
* __chinit(fd)
|
||||
* where: fd = file descriptor #
|
||||
*****************************************************************************/
|
||||
|
||||
_chinit() /****************************/
|
||||
{ /* */
|
||||
REG WORD i; /* Index */
|
||||
for(i=0;i<MAXCCBS;i++) /* For all channels */
|
||||
__chinit(i); /* Init fds(i); */
|
||||
} /****************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* The __chinit routine initializes only 1 channel.
|
||||
*****************************************************************************/
|
||||
|
||||
__chinit(i)
|
||||
{ /****************************/
|
||||
REG FD *ch; /* -> CCB */
|
||||
REG BYTE *p; /* Byte pointer temporary */
|
||||
|
||||
ch = _getccb(i); /* convert fd to CCB */
|
||||
ch -> chan = i; /* Load channel byte */
|
||||
ch -> flags = 0; /* clear flag word */
|
||||
ch -> user = 0; /* assume user 0 */
|
||||
ch -> sector = -1; /* Set no sector in buff */
|
||||
ch -> offset = 0; /* Clear file offset word */
|
||||
ch -> hiwater = 0; /* Init hiwater mark */
|
||||
blkfill(&ch->fcb.drive,NULL,32); /* Init FCB to 0's */
|
||||
blkfill(&ch->fcb.fname[0],' ',11); /* Init file name fields */
|
||||
} /****************************/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* C H A N N E L N U M B E R V A L I D A T I O N
|
||||
* -------------------------------------------------
|
||||
* This routine is used to validate a channel number and return the
|
||||
* pointer to the ccb area. The channel must be in range and open.
|
||||
*
|
||||
* Calling Sequence:
|
||||
*
|
||||
* Where:
|
||||
* ch Is the channel number
|
||||
* ccbptr Is the returned ccb address, NULLFD if error
|
||||
*****************************************************************************/
|
||||
|
||||
FD *_chkc(ch) /****************************/
|
||||
REG UWORD ch; /* Facilitate error check */
|
||||
{ /* */
|
||||
REG FD *xcb; /* -> CCB */
|
||||
/****************************/
|
||||
if(ch >= MAXCCBS) /* Is channel in range? */
|
||||
RETERR(NULLFD,EBADF); /* No, quit now. */
|
||||
/* */
|
||||
xcb = _getccb(ch); /* xcb -> ccb for channel */
|
||||
if((xcb->flags & OPENED) == 0) /* Is channel OPEN? */
|
||||
RETERR(NULLFD,EBADF); /* Noooooooo!! */
|
||||
return(xcb); /* Else, return pointer */
|
||||
} /****************************/
|
||||
*****/
|
||||
*****/
|
||||
56
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CHKUSER.C
Normal file
56
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CHKUSER.C
Normal file
@@ -0,0 +1,56 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* _ c h k u s e r F u n c t i o n
|
||||
* ---------------------------------
|
||||
*
|
||||
* '_chkuser' and '_uchkuser' handle user numbers under CPM before
|
||||
* version 4. The user number is stored in the ccb structure;
|
||||
* if a zero, the default user # is assumed, else the _chkuser()
|
||||
* routine sets the user number to the desired user number (one less
|
||||
* than the stored user number, since user 0 is valid - similar to the
|
||||
* default drive spec for an FCB).
|
||||
* '_uchkuser()' sets the user number back to its previous value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "portab.h"
|
||||
#include "osif.h"
|
||||
/****************************/
|
||||
WORD _chkuser(newu) /* */
|
||||
WORD newu; /* Desired user number */
|
||||
{ /****************************/
|
||||
#if CPM /*===============================================================*/
|
||||
REG WORD prevu; /* Previous user number */
|
||||
/****************************/
|
||||
if( newu == 0 ) /* Default user # desired? */
|
||||
return 0; /* Yes, return */
|
||||
prevu = __OSIF(USER,0xFF)+1; /* Get prev and adjust */
|
||||
if( newu != prevu ) /* Are they different? */
|
||||
__OSIF(USER,newu-1); /* Yes, set to desired u# */
|
||||
return prevu; /* Return the previous */
|
||||
#else /*===============================================================*/
|
||||
return 0;
|
||||
#endif /*===============================================================*/
|
||||
} /****************************/
|
||||
|
||||
/****************************/
|
||||
_uchkuser(newu,prevu) /* */
|
||||
WORD newu; /* Desired user number */
|
||||
WORD prevu; /* Previous user number */
|
||||
{ /****************************/
|
||||
#if CPM /*===============================================================*/
|
||||
if( newu == 0 ) /* Default user #? */
|
||||
return; /* assume no change */
|
||||
if( newu != prevu ) /* Are they different? */
|
||||
__OSIF(USER,prevu-1); /* Yes, set to what it was*/
|
||||
#else /*===============================================================*/
|
||||
return 0;
|
||||
#endif /*===============================================================*/
|
||||
} /****************************/
|
||||
|
||||
==========================*/
|
||||
} /****************************/
|
||||
|
||||
==========================*/
|
||||
} /****************************/
|
||||
|
||||
27
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CLEANUP.C
Normal file
27
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CLEANUP.C
Normal file
@@ -0,0 +1,27 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* _ c l e a n u p F u n c t i o n
|
||||
* ---------------------------------
|
||||
* Copyright 1982 by Digital Research Inc. All rights reserved.
|
||||
*
|
||||
* "_cleanup" closes all buffered files
|
||||
*
|
||||
* Calling sequence:
|
||||
* _cleanup()
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#include "stdio.h"
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
REG WORD ii;
|
||||
|
||||
for( ii=0; ii<MAXFILES; ii++ )
|
||||
fclose(&_iob[ii]);
|
||||
/* _m_term(); /* CLEAR termination routine */
|
||||
}
|
||||
EAR termination routine */
|
||||
}
|
||||
EAR termination routine */
|
||||
}
|
||||
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CLINK.SUB
Normal file
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CLINK.SUB
Normal file
Binary file not shown.
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CLINKE.SUB
Normal file
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CLINKE.SUB
Normal file
Binary file not shown.
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CLINKF.SUB
Normal file
BIN
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CLINKF.SUB
Normal file
Binary file not shown.
69
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CLOSE.C
Normal file
69
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CLOSE.C
Normal file
@@ -0,0 +1,69 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* C l o s e F u n c t i o n
|
||||
* ---------------------------
|
||||
* Copyright 1982 by Digital Research Inc. All rights reserved.
|
||||
*
|
||||
* The close function is used to terminate access to a file / device.
|
||||
*
|
||||
* Calling Sequence:
|
||||
*
|
||||
* ret = close(fd);
|
||||
*
|
||||
* Where "fd" is an open file descriptor to be CLOSEd.
|
||||
*
|
||||
* Modifications:
|
||||
* 12/83: PC-DOS mods whf
|
||||
* 10/83: changed user # handling whf
|
||||
* 9/83: add steve's user # mods, change _chkc whf
|
||||
* 8/83: improve error handling whf
|
||||
****************************************************************************/
|
||||
#include "portab.h"
|
||||
#include "osif.h"
|
||||
#include "osiferr.h"
|
||||
#include "errno.h"
|
||||
/****************************/
|
||||
EXTERN BYTE __xeof; /* End of file for ASCII */
|
||||
WORD close(fd) /* CLEAR FUNCTION ***********/
|
||||
REG WORD fd; /* File descriptor to close */
|
||||
{ /****************************/
|
||||
EXTERN FD *_chkc(); /* fd -> fp conversion MGL */
|
||||
REG FD *fp; /* file pointer Temporary */
|
||||
REG WORD rv; /* return value */
|
||||
REG WORD xuser; /* User number temporary */
|
||||
/* */
|
||||
if((fp=_chkc(fd)) == NULLFD) /* File Open? */
|
||||
RETERR(FAILURE,EBADF); /* no, quit */
|
||||
rv = SUCCESS; /* assume it will work */
|
||||
if ((fp->flags & (ISTTY|ISLPT)) == 0) /* Character device? */
|
||||
{ /* if not, handle file: *****/
|
||||
#if CPM /*================================================================*/
|
||||
if((fp->flags & ISASCII) != 0 && (fp->flags & ISREAD) == 0) /* */
|
||||
{ /* ASCII file? not ReadOnly?*/
|
||||
if( fp->offset < fp->hiwater ) /* Have we been seeking? */
|
||||
lseek(fd,0L,2); /* Seek to EOF ifso */
|
||||
write(fd,&__xeof,1); /* Write a ^Z character */
|
||||
} /****************************/
|
||||
if((fp->flags & DIRTY) != 0) /* Buffer dirty? */
|
||||
if(_blkio(fp,fp->sector,fp->buffer,1L,B_WRITE) != 1)/* write it */
|
||||
rv = FAILURE; /* can't */
|
||||
xuser = _chkuser(fp->user); /* Check user # for change */
|
||||
if((__OSIF(CLOSE,&(fp->fcb))&0xFF) == 0xFF)/* Close the fcb */
|
||||
rv = FAILURE; /* */
|
||||
_uchkuser(fp->user,xuser); /* Change user # if needed */
|
||||
#endif /*================================================================*/
|
||||
#if PCDOS /*================================================================*/
|
||||
if((__OSIF(CLOSE,&(fp->fcb))&0xFF) == 0xFF)/* Close the fcb */
|
||||
rv = FAILURE; /* */
|
||||
#endif /*================================================================*/
|
||||
} /* end of file handling *****/
|
||||
__chinit(fd); /* Release the space */
|
||||
_freec(fd); /* Release the channel */
|
||||
if( rv == SUCCESS ) /* Was everything ok? */
|
||||
return(rv); /* Yes, return Success */
|
||||
else RETERR(FAILURE,EIO); /* else let them know */
|
||||
} /****************************/
|
||||
*/
|
||||
} /****************************/
|
||||
*/
|
||||
} /****************************/
|
||||
257
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CPM.H
Normal file
257
CPM OPERATING SYSTEMS/CPM 68K/1.2 SOURCE/6/CPM.H
Normal file
@@ -0,0 +1,257 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* O S I F . H
|
||||
* -----------
|
||||
* Copyright 1982,1983 by Digital Research Inc. All rights reserved.
|
||||
*
|
||||
* Edits:
|
||||
* 17-Jan-84 whf Moved to 68K
|
||||
* 5-Jan-84 whf Moved MAXCCBS to channel.c
|
||||
* 29-Dec-83 whf Add F_TRUNC for tclose()
|
||||
* 12-Dec-83 whf Change from "CPM.H" to "OSIF.H"
|
||||
* 9-Dec-83 whf Handle PCDOS differences
|
||||
* 3-Nov-83 whf Add multi-sector i/o
|
||||
* 19-Oct-83 whf Add QUEUE handling info
|
||||
* 6-Oct-83 whf Redefine reserved area in fcb for parsefn() return
|
||||
* 25-June-83 sw Add user number to file "fd" structure.
|
||||
*
|
||||
* This file contains O.S. specific definitions for the
|
||||
* DRI CLEAR/C Run Time Library.
|
||||
* This file is intended only for inclusion with those functions
|
||||
* dealing directly with the O.S. interface, as well as any function
|
||||
* which has hardware dependent code (byte storage order, for
|
||||
* instance).
|
||||
*
|
||||
****************************************************************************/
|
||||
/*
|
||||
* "machine.h": to determine what kind of machine you want to run on.
|
||||
*/
|
||||
|
||||
#define MC68000 1 /* Motorola 68000 */
|
||||
#define CPM68K 1 /* CP/M 68000 ver 2.2 */
|
||||
#define CPM 1 /* CP/M version 2.2 */
|
||||
#define ALCYON 1 /* Alcyon C Compiler */
|
||||
|
||||
|
||||
/*#ifdef UNdefined*/ /* Unused DEFINEs */
|
||||
|
||||
/*** Processor ***/
|
||||
#define I8086 0 /* Intel 8086/8088 */
|
||||
#define VAX 0 /* DEC VAX */
|
||||
#define PDP11 0 /* DEC PDP-11 */
|
||||
#define Z8000 0 /* Zilog Z8000 */
|
||||
|
||||
/*** Operating System ***/
|
||||
#define PCDOS 0 /* IBM PC DOS */
|
||||
#define CCPM 0 /* Concurrent (multi-tasking) */
|
||||
#define CPM3 0 /* CP/M version 3.x (Concurrent & Plus) */
|
||||
#define CPM4 0 /* CP/M version 4.x (Portable Concurrent) */
|
||||
#define UNIX 0 /* UNIX */
|
||||
#define VMS 0 /* DEC VMS */
|
||||
|
||||
/*** Compiler ***/
|
||||
#define DRC 0 /* Digital Research C Compiler */
|
||||
|
||||
/*#endif */ /**********************/
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* CP/M FCB definition
|
||||
****************************************************************************/
|
||||
#if CPM /****************************/
|
||||
struct fcbtab /****************************/
|
||||
{ /* */
|
||||
BYTE drive; /* Disk drive field [0] */
|
||||
BYTE fname[8]; /* File name [1-8] */
|
||||
BYTE ftype[3]; /* File type [9-11] */
|
||||
BYTE extent; /* Current extent number[12]*/
|
||||
BYTE s1,s2; /* "system reserved" [13-14]*/
|
||||
BYTE reccnt; /* Record counter [15] */
|
||||
BYTE fpasswd[8]; /* Parsefn passwd area[16-23]*/
|
||||
BYTE fuser; /* Parsefn user# area [24] */
|
||||
BYTE resvd[7]; /* More "system reserved" */
|
||||
LONG record; /* Note -- we overlap [32-36]*/
|
||||
/* current record field to */
|
||||
/* make this useful. */
|
||||
}; /****************************/
|
||||
#endif /****************************/
|
||||
|
||||
/****************************************************************************
|
||||
* PC-DOS FCB definition
|
||||
****************************************************************************/
|
||||
#if PCDOS /****************************/
|
||||
struct fcbtab { /****************************/
|
||||
BYTE drive; /* Disk drive field [0] */
|
||||
BYTE fname[8]; /* File name [1-8] */
|
||||
BYTE ftype[3]; /* File type [9-11] */
|
||||
WORD fcb_curblk; /* Curr 128 byte blk [12-13]*/
|
||||
WORD fcb_lrecsiz; /* Logical record size[14-15]*/
|
||||
LONG fcb_filsiz; /* Num bytes in file [16-19]*/
|
||||
WORD fcb_date; /* Last updated [20-21] */
|
||||
BYTE fcb_resvd[10]; /* System reserved [22-31] */
|
||||
BYTE fcb_currec; /* Rel Rec# within curblk[32]*/
|
||||
LONG record; /* Rel Rec# from bgn file */
|
||||
/* [33-36] depends on lrecsiz*/
|
||||
}; /****************************/
|
||||
#endif /****************************/
|
||||
/* */
|
||||
#define SECSIZ 128 /* size of CP/M sector */
|
||||
/* 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 */
|
||||
}; /************************************/
|
||||
|
||||
extern struct ccb _fds[]; /* */ /* Declare storage */
|
||||
#define FD struct ccb /* FD Type definition */
|
||||
#define NULLFD ((FD *)0) /* NULLPTRs for FD */
|
||||
/************************************/
|
||||
/* 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 ISQUE 0x0200 /*whf Queue 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 */
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* O S I F F u n c t i o n D e f i n i t i o n s */
|
||||
/* ------------------------------------------------- */
|
||||
/* */
|
||||
/* Following are OSIF function definitions used by the C runtime */
|
||||
/* library. */
|
||||
/* */
|
||||
/****************************************************************************/
|
||||
|
||||
/****************************/
|
||||
#if CPM68K /* */
|
||||
#define __OSIF(fn,arg) __BDOS((fn),(LONG)(arg)) /* CPM68K does it this way */
|
||||
#else /* */
|
||||
#define __OSIF(fn,arg) __BDOS((fn),(arg)) /* DRC does it this way */
|
||||
#endif /* */
|
||||
#if CPM /****************************/
|
||||
#define EXIT 0 /* Exit to BDOS */
|
||||
#define CONIN 1 /* direct echoing con input */
|
||||
#define CONOUT 2 /* Direct console output */
|
||||
#define LSTOUT 5 /* Direct list device output*/
|
||||
#define CONIO 6 /* Direct console I/O */
|
||||
#define C_WRITESTR 9 /* Console string output */
|
||||
#define CONBUF 10 /* Read console buffer */
|
||||
#define S_BDOSVER 12 /* Get System BDOS Ver Num */
|
||||
#define OPEN 15 /* OPEN a disk file */
|
||||
#define CLOSE 16 /* Close a disk file */
|
||||
#define SEARCHF 17 /* Search for first */
|
||||
#define SEARCHN 18 /* Search for next */
|
||||
#define DELETE 19 /* Delete a disk file */
|
||||
#define CREATE 22 /* Create a disk file */
|
||||
#define F_RENAME 23 /* Rename 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 F_MULTISEC 44 /* Set Multi-Sector Count */
|
||||
#define P_CHAIN 47 /* Program Chain */
|
||||
#define SETVEC 61 /* Set exception vector */
|
||||
#define N_NETSTAT 68 /* Get Network Status */
|
||||
#define F_TRUNC 99 /* Truncate File function */
|
||||
#define S_OSVER 163 /* Get OS Version Number */
|
||||
#endif /****************************/
|
||||
#if PCDOS /****************************/
|
||||
#define EXIT 0 /* Exit to BDOS */
|
||||
#define CONIN 1 /* direct echoing con input */
|
||||
#define CONOUT 2 /* Direct console output */
|
||||
#define LSTOUT 5 /* Direct list device output*/
|
||||
#define CONIO 6 /* Direct console I/O */
|
||||
#define C_WRITESTR 9 /* Console string output */
|
||||
#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 for next */
|
||||
#define DELETE 19 /* Delete a disk file */
|
||||
#define CREATE 22 /* Create a disk file */
|
||||
#define F_RENAME 23 /* Rename 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 */
|
||||
#endif /****************************/
|
||||
/****************************************************************************/
|
||||
/* 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 */
|
||||
/****************************************************************************/
|
||||
/****************************/
|
||||
#if MC68000 | Z8000 /* 68K or Z8000 */
|
||||
#define HILO 1 /* used when bytes stored */
|
||||
#else /* */
|
||||
#define HILO 0 /* */
|
||||
#endif /* */
|
||||
/* */
|
||||
#if HILO /* Hi/Lo storage used in */
|
||||
struct long_struct{ /* 68K */
|
||||
BYTE lbhihi; /* Use this for accessing */
|
||||
BYTE lbhilo; /* ordered bytes in 32 bit*/
|
||||
BYTE lblohi; /* LONG qtys. */
|
||||
BYTE lblolo; /* */
|
||||
}; /* */
|
||||
struct word_struct{ /* Use this for accessing */
|
||||
WORD lwhi; /* ordered words in 32 bit*/
|
||||
WORD lwlo; /* LONG qtys. */
|
||||
}; /* */
|
||||
#else /****************************/
|
||||
struct long_struct{ /* Lo/Hi storage use on */
|
||||
BYTE lblolo; /* PDP-11, VAX, 8086,... */
|
||||
BYTE lblohi; /* */
|
||||
BYTE lbhilo; /* */
|
||||
BYTE lbhihi; /* */
|
||||
}; /* */
|
||||
struct word_struct{ /* */
|
||||
WORD lwlo; /* */
|
||||
WORD lwhi; /* */
|
||||
}; /* */
|
||||
#endif /****************************/
|
||||
/*************************** end of osif.h **********************************/
|
||||
| ||||