cpm commands
This commit is contained in:
parent
b12553b0c9
commit
fe5b620919
|
|
@ -0,0 +1,30 @@
|
||||||
|
/* cpmfio.h 1.5 83/05/13 */
|
||||||
|
|
||||||
|
#define C_NFILE 5 /* max number of concurrently open cp/m files */
|
||||||
|
|
||||||
|
typedef struct c_iobuf {
|
||||||
|
int c_cnt; /* bytes left in buffer */
|
||||||
|
int c_blk; /* block number within the current extent */
|
||||||
|
/* (starting at 0) */
|
||||||
|
int c_seccnt; /* number of physical sectors left in */
|
||||||
|
/* the current extent */
|
||||||
|
int c_ext; /* current extent's directory index */
|
||||||
|
int c_extno; /* extgnt number within current file */
|
||||||
|
char *c_buf; /* next character position */
|
||||||
|
char *c_base; /* location of buffer */
|
||||||
|
short c_flag; /* access mode (READ or WRITE) */
|
||||||
|
struct directory *c_dirp; /* pointer to the current */
|
||||||
|
/* extent's directory entry */
|
||||||
|
} C_FILE;
|
||||||
|
extern C_FILE c_iob[C_NFILE];
|
||||||
|
|
||||||
|
#define c_getc(p) (--(p)->c_cnt>=0 ? *(p)->c_buf++&0377 : c_fillbuf(p))
|
||||||
|
#define c_putc(x,p) (--(p)->c_cnt>=0 ? ((int)(*(p)->c_buf++=(unsigned)(x))) : c_flsbuf((unsigned)(x), p))
|
||||||
|
|
||||||
|
C_FILE *c_open(), *c_creat();
|
||||||
|
|
||||||
|
#define READ 0x01
|
||||||
|
#define WRITE 0x02
|
||||||
|
#define RW 0x03
|
||||||
|
#define MODFLG 0x08
|
||||||
|
#define BINARY 0x10
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
/* ffc.c 1.4 83/05/13 */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If used on a vax (i.e., VAX is defined), this routine simply executes
|
||||||
|
* the VAX find-first-set instruction.
|
||||||
|
* Usage:
|
||||||
|
* int startbit, field_lth, field, result;
|
||||||
|
* result = ffc(startbit,field_lth,field);
|
||||||
|
*
|
||||||
|
* startbit is the bit number of the field to start the search,
|
||||||
|
* the rightmost bit is number one.
|
||||||
|
* field_lth is the length of the field in bits.
|
||||||
|
* field is thg actual field
|
||||||
|
* result is the resulting bit number,
|
||||||
|
* e.g. the number of the first clear bit in the field.
|
||||||
|
* hs 10/29/82
|
||||||
|
*/
|
||||||
|
|
||||||
|
ffc(start, len, field)
|
||||||
|
|
||||||
|
#ifndef VAX
|
||||||
|
register int field;
|
||||||
|
int start, len;
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
|
||||||
|
for (i=start; i<len; i++) {
|
||||||
|
if ((field&1) == 0)
|
||||||
|
break;
|
||||||
|
field >>= 1;
|
||||||
|
}
|
||||||
|
return (i);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
int start, len, field;
|
||||||
|
{
|
||||||
|
asm("ffc 4(ap),8(ap),12(ap),r0");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue