Some maths functions for DECUS C

For some reason I decided to rewrite the "wave" program that I wrote in Basic-11, but using DECUS C.  I thought that it would be easy, but I didn't count on there not being a math.h.  This means that I had to work out how to calculate a sine and cosine for myself.  Well, actually I went off to google to see if somebody had already done the hard work for me.  Indeed they had, I found it here:

That code was already in K&R syntax, but it used modf(), I think that I went off and found some source code for that somewhere else...  Anyway, when I had it working, I decided that I might want to use these bits of maths code somewhere else - so I extracted it out into my own library and made "maths.h".  So I can now use sin/cos wherever I want.

Anyway, since I went to all that trouble, I thought that I had better post the results.  You need to compile maths.c into maths.obj, like this:


Then, you can #include "maths.h" and link to the maths.obj we created above, like this example:


I expect I'll add more to my maths library as I go, but this is a start.

DECUS C combined with RT-11 v5.3

I have now managed to make an RX33 boot disk image from RT-11 v5.3 and Decus C.  However, I did have to remove some extra files from the original boot disk to make more space.  These are the extra files that I removed:


I guessed that since I'm using the "XM" edition of RT-11, then I would not need those files.  Next, I copied over the DECUS C files, like this:

With CCDSK1.DSK in drive DK1:

CREATE sy:cdisk.dsk/allocate:1500
MOUNT ld0: sy:cdisk.dsk
ASSIGN ld0: c:
[LD0:/Initialize; Are you sure?] YES
COPY dk1:*.* c: put disk CCXDSK.DSK in drive DK1:

If you've restarted the emulator to change disks, use the next two lines:
MOUNT ld0: sy:cdisk.dsk
ASSIGN ld0: c:

COPY dk1:*.* c:

Append these lines to your "STARTX.COM" command file (which runs when RT-11 starts):

MOUNT ld0: sy:cdisk.dsk
ASSIGN ld0: c:

Then restart... Finally, to compile a C program, do this:

[CC>] hello.c/A
LINK sy:hello.obj,c:suport.obj,c:clib.obj

Don't forget that this is an old dialect of C, mainly as described by K&R.  So you'll have to stick to the original K&R syntax.  Right, next comes the fun stuff.