1
0
mirror of https://github.com/PDP-10/its.git synced 2026-04-26 04:07:36 +00:00

KCC - C compiler.

Binary-only compiler and library, plus documentation and include files
for compiling new programs.
This commit is contained in:
Lars Brinkhoff
2017-02-15 13:54:43 +01:00
parent c2242636b6
commit 53f2a2eba9
47 changed files with 15667 additions and 3 deletions

59
src/c/c.defs Executable file
View File

@@ -0,0 +1,59 @@
/*
C Standard Definitions
*/
# define ITS ITS
/* data types */
struct _filespec {int dev, fn1, fn2, dir;};
# define filespec struct _filespec
# define channel int
struct _cal {int year, month, day, hour, minute, second;};
# define cal struct _cal
struct _tag {int *pc, *fp, *ap, *sp;};
# define tag struct _tag
/* common values */
# define TRUE 1
# define FALSE 0
# define OPENLOSS -1 /* returned by COPEN if lose */
# define EOF_VALUE 0 /* returned by CGETC if EOF */
/* C interrupts */
# define INT_DEFAULT 0
# define INT_IGNORE 1
# define realt_interrupt 0
# define mpv_interrupt 1
# define ioc_interrupt 2
# define ilopr_interrupt 3
# define mar_interrupt 4
# define utrap_interrupt 5
# define pure_interrupt 6
# define wiro_interrupt 7
# define sys_down_interrupt 8
# define clock_interrupt 9
# define timer_interrupt 10
# define pdlov_interrupt 11
# define ttyi_interrupt 12
# define cli_interrupt 13
# define overflow 14
# define float_overflow 15
# define channel0_interrupt 16
# define inferior0_interrupt 32
# define ctrls_interrupt 41
# define ctrlg_interrupt 42

7
src/c/clib.stinkr Executable file
View File

@@ -0,0 +1,7 @@
; xfile for loading basic C library
; this file must be loaded first
; segment 0 must start at 100
s 100,n,p,n
i sinit
l c;[crel] >

15
src/c/ctype.h Executable file
View File

@@ -0,0 +1,15 @@
#define _U 01
#define _L 02
#define _A 03
#define _N 04
#define _S 010
extern char _ctype[];
#define isalpha(c) (_ctype[c]&_A)
#define isupper(c) (_ctype[c]&_U)
#define islower(c) (_ctype[c]&_L)
#define isdigit(c) (_ctype[c]&_N)
#define isspace(c) (_ctype[c]&_S)
#define toupper(c) ((c)-'a'+'A')
#define tolower(c) ((c)-'A'+'a')

61
src/c/nc.insert Executable file
View File

@@ -0,0 +1,61 @@
; C;NC INSERT
; THIS FILE IS NEEDED TO ASSEMBLE MIDAS PROGRAMS PRODUCED BY
; THE C COMPILER AS WELL AS HAND-CODED MIDAS PROGRAMS DESIGNED
; TO BE LOADED WITH C PROGRAMS
RELOCATABLE
.INSRT SYSENG;MULSEG INSERT
.MSEG 200000',600000',700000'
IF1,[
.MLLIT==1
A=1
B=2
C=3
D=4
P=15.
.CCALL=1_27.
GO=JRST
EQUALS ENTRY .GLOBAL
EQUALS EXTERN .GLOBAL
DEFINE .IDATA
.SEG 0
TERMIN
DEFINE .UDATA
.SEG 1
TERMIN
DEFINE .CODE
.SEG 2
TERMIN
DEFINE .PDATA
.SEG 3
TERMIN
; STACK HACKING FOR VARIABLE REFERENCES
%P==0
DEFINE PPUSH [A]
PUSH P,A
%P==%P+1
TERMIN
DEFINE PPOP [A]
POP P,A
%P==%P-1
TERMIN
DEFINE CCALL N,F
.CCALL N,F
%P==%P-N
TERMIN
];END IF1
IF2,[IFDEF FS1,[
.KILL %A,%P,A,B,C,D,P,GO,.CCALL
]]

21
src/c/stdio.h Executable file
View File

@@ -0,0 +1,21 @@
/* STDIO.H for DEC20 implementation */
/* actual code is in <C.LIB>C20STD.C */
# define BUFSIZ 512 /* this number is irrelevant */
# define FILE int /* the actual structure is irrelevant */
# define NULL 0 /* null file pointer for error return */
# define EOF (-1) /* returned on end of file */
# define peekchar pkchar /* rename to avoid name conflict */
# define fopen flopen /* " */
# define getc fgetc /* " */
# define getchar fgeth /* " */
# define fprintf ffprintf /* " */
# define calloc fcalloc /* " */
# define feof ceof /* direct translation */
# define putc cputc /* " */
# define fputc cputc /* " */
extern FILE *stdin, *stdout, *stderr;