_os9 system call interface from C programs #include <os9.h> _os9 char code struct registers *reg Description _os9 enables a programmer to access virtually any OS-9 system call directly from a C program without having to resort to assembly language routines. Code is one of the codes that are defines in os9.h. os9.h contains codes for the F$ and I$ function/service requests, and it also contains getstt, setstt, and error codes. The input registers(reg) for the system calls are accessed by the following structure that is defined in os9.h: struct registers { char rg_cc,rg_a,rg_b,rg_dp; unsigned rg_x,rg_y,rg_u; }; An example program that uses _os9 is presented on the following page. Diagnostics -1 is returned is the OS-9 call failed. 0 is returned on success. Program Example #include <os9.h> #include <modes.h> /* this program does an I$GETSTT call to get file size */ main(argc,argv) int argc; char **argv; { struct registers reg; int path; /* tell linker we need longs */ pflinit(); /* low level open(file name is first command line param */ path=open(*++argv,S_IREAD); /* set up regs for call to OS-9 */ reg.rg_a=path; reg.rg_b=SS_SIZE; if(_os9(I_GETSTT,&reg) == 0) printf("filesize = %lx\n", /* success */ (long) (reg.rg_x << 16)+reg.rg_u); else printf("OS9 error #%d\n",reg.rg_b & 0xff); /*failed*/ dumpregs(&reg); /* take a look at the registers */ } dumpregs(r) register struct registers *r; { printf("cc=%02x\n",r->rg_cc & 0xff); printf(" a=%02x\n",r->rg_a & 0xff); printf(" b=%02x\n",r->rg_b & 0xff); printf("dp=%02x\n",r->rg_dp & 0xff); printf(" x=%02x\n",r->rg_x); printf(" y=%02x\n",r->rg_u); printf(" u=%02x\n",r->rg_y); }