[Coco] os9 intercept call from C

Gene Heskett gheskett at shentel.net
Sun Apr 19 00:25:15 EDT 2020


On Saturday 18 April 2020 22:35:15 Walter Zambotti wrote:

> On 2020-04-19 01:03, Gene Heskett wrote:
> > On Saturday 18 April 2020 12:44:08 Walter Zambotti wrote:
> >> Opps nine characters long!!!
> >>
> >> Which is exactly when the Ansi front end will start converting long
> >> variable names to hashes.
> >
> > What ansi front end are you refering to?
>
> The Ansi front end that comes with the Climax C compiler.
> I'm using the -A switch on cc to trigger ansi mode.
>
Never heard of it. All of my C work used the microware c compiler along 
with c.opt2, ansifront, and the c.prep19 I finished up after Mikes prof 
gave him a passing grade for an unfinished program. Then I bought a copy 
of SAS-C 6.51 for the Amiga, ported all my stuff to that, After that I 
found a compiler for Bill Hawes Arrex which had ALL the tools to write 
good software for it, and have looked back only rarely since. One could 
interrupt the microware C process after c.pass2 and hand optimize the 
code for noticeable speed gains, the finish the build. This also allowed 
me to insert a major speedup in the form of a table lookup crc, and 
rzsz3.36 incorporated that.  That however was not enough to get it up to 
9600 baud, and a major buffer rearrangement would have been needed to 
accommodate that but the coco was out of memory so that never got done.

Today I am into cnc machinery and supplying folks with a custom near 
realtime kernel and LinuxCNC builds for raspbian buster running on a 
rpi4b which is running a 75 yo Sheldon 11x54 lathe, making it do tricks 
it was never capable of doing originally. Bed wear over those 75 years 
has been compensated for and it can now do rigid tapping with any tap, 
metric or imperial that you can lay your hands on. Or if you want 66 tpi 
on a 3/4" bolt I can arrange that too including the nuts for it. I have 
another smaller lathe that can also do all that, and a 2, 4 axis milling 
machines, one a gantry style with a 24k rpm spindle.  So I'm well equipt 
to make most anything I need. I have stuff on hand that can make gears, 
but before I can use it, I have to make a hoist to put it on the big 
mills table as it weighs nearly 80 kg. So I bought a hoist, Chinese of 
course, but I have to weld up custom mounts as what it came with doesn't 
fit Merican iron.  For that I need 75F weather and almost no wind so it 
doesn't blow away my MIG welders gas as its $125 to refill an 18" tall 
bottle. Argon, + 25% co2, which puts carbon back into the weld making it 
much stronger.

Some folks might call me a JOAT.  Lotsa stuff I can say I've BTDT in my 
going on 86 years here.

> >> On 2020-04-19 00:41, Walter Zambotti wrote:
> >>> That's what I have trying to say guys.
> >>>
> >>> The intercept function is not in the standard library as expected.
> >>>
> >>> At least for me if I comment out my intercept function then it
> >>> fails to link with unresolved reference to intercept.
> >>>
> >>> Figured out what is going wrong with the missing intercept library
> >>> function.
> >>>
> >>> An rdump shows it is in the library.
> >>>
> >>> The problem starts when compiling with Ansi front end.  It
> >>> converts the reference to _hexvalue which I can see on the _ntbl
> >>> file.
> >>>
> >>> Which it should not do.  Especially since 'intercept' is only 8
> >>> characters long.
> >>>
> >>> I suppose that's another bug in the Ansi front end.
> >>>
> >>> I reverted the code back to K&R and it compiles and links with no
> >>> problem.
> >>>
> >>> Thanks guys
> >>>
> >>> Walter
> >>>
> >>> On 2020-04-18 23:38, Alex Evans wrote:
> >>>> Largely ignoring the fact that the above code uses ANSI syntax
> >>>> and the only MW C Compiler I am aware of for the CoCo uses K&R.
> >>>> If you use the provided intercept function in the library, the
> >>>> function to be called is a normal C function which takes an
> >>>> integer as a parameter (no RTI). If you are going to finable
> >>>> about directly using F$Icpt to set you trap, it needs to return
> >>>> using RTI. In addition, you need to set the pointer to the
> >>>> routine's storage area in U, but in the case of the function you
> >>>> have provided, it does not appear to need any storage space, so
> >>>> the fact you didn't set U shouldn't be a problem.
> >>>>
> >>>> I would think (untested) the answer would be:
> >>>> int catchall();
> >>>>
> >>>> int intflag=0;
> >>>>
> >>>> main(argc, argv)
> >>>> int argc;
> >>>> char *argv[];
> >>>> {
> >>>>   intercept(catchall);
> >>>>   while (!intrlag) {
> >>>>     pause();
> >>>>     write(1, "*", 1);
> >>>>   }
> >>>> }
> >>>>
> >>>> catchall(sig)
> >>>> int sig;
> >>>> {
> >>>>   intfrag=sig==0x03;
> >>>> }
> >>>>
> >>>> If your really, really want to directly use the system call, you
> >>>> need to also pull the signal number from somewhere. The routine
> >>>> expexted by F$cpt is a machine code routine, and sig will
> >>>> probably not be passed on the stack in the manner that MW C
> >>>> expects, so you need to figure out where it would be.
> >
> > Cheers, Gene Heskett


Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>


More information about the Coco mailing list