annotate docs/ccguide/os9.refentry @ 3102:13299b970532

l1/sys/makefiles: Remove unused alldragon target Also move helpmsg target to make it more similar to the l2 one.
author Tormod Volden <debian.tormod@gmail.com>
date Sun, 28 Feb 2016 21:37:50 +0100
parents 42b2c775f05f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
1 <refentry id="os9">
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
2 <refnamediv>
468
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
3 <refname>_os9</refname>
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
4 <refpurpose>system call interface from C programs</refpurpose>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
5 </refnamediv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
6
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
7 <refsynopsisdiv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
8 <funcsynopsis>
468
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
9 <funcsynopsisinfo>
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
10 #include &lt;os9.h&gt;
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
11 </funcsynopsisinfo>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
12 <funcprototype>
468
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
13 <funcdef><function>_os9</function></funcdef>
572
e43a77fddcbd All function prototypes are added.
roug
parents: 534
diff changeset
14 <paramdef>char <parameter>code</parameter></paramdef>
e43a77fddcbd All function prototypes are added.
roug
parents: 534
diff changeset
15 <paramdef>struct registers *<parameter>reg</parameter></paramdef>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
16 </funcprototype>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
17 </funcsynopsis>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
18
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
19 </refsynopsisdiv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
20
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
21 <refsect1><title>Description</title>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
22 <para>
602
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
23 _os9 enables a programmer to access virtually any OS-9 system
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
24 call directly from a C program without having to resort to
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
25 assembly language routines.
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
26 </para>
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
27 <para>
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
28 <varname>Code</varname> is one of the codes that are defines in os9.h. os9.h
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
29 contains codes for the F$ and I$ function/service requests, and
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
30 it also contains getstt, setstt, and error codes.
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
31 </para>
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
32 <para>
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
33 The input registers(reg) for the system calls are accessed by
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
34 the following structure that is defined in os9.h:
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
35 <programlisting>
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
36 struct registers {
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
37 char rg_cc,rg_a,rg_b,rg_dp;
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
38 unsigned rg_x,rg_y,rg_u;
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
39 };
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
40 </programlisting>
42b2c775f05f All refentries finished.
roug
parents: 572
diff changeset
41 An example program that uses _os9 is presented on the following page.
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
42 </para>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
43 </refsect1>
534
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
44
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
45 <refsect1><title>Diagnostics</title>
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
46 <para>
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
47 -1 is returned is the OS-9 call failed. 0 is returned on success.
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
48 </para>
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
49 </refsect1>
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
50
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
51 <refsect1><title>Program Example</title>
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
52 <programlisting>
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
53 #include &lt;os9.h&gt;
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
54 #include &lt;modes.h&gt;
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
55
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
56 /* this program does an I$GETSTT call to get file size */
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
57 main(argc,argv)
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
58 int argc;
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
59 char **argv;
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
60 {
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
61 struct registers reg;
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
62 int path;
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
63
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
64 /* tell linker we need longs */
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
65 pflinit();
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
66
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
67 /* low level open(file name is first command line param */
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
68 path=open(*++argv,S_IREAD);
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
69
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
70 /* set up regs for call to OS-9 */
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
71 reg.rg_a=path;
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
72 reg.rg_b=SS_SIZE;
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
73
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
74 if(_os9(I_GETSTT,&amp;reg) == 0)
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
75 printf("filesize = %lx\n", /* success */
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
76 (long) (reg.rg_x &lt;&lt; 16)+reg.rg_u);
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
77 else printf("OS9 error #%d\n",reg.rg_b &amp; 0xff); /*failed*/
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
78
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
79 dumpregs(&amp;reg); /* take a look at the registers */
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
80 }
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
81
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
82 dumpregs(r)
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
83 register struct registers *r;
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
84 {
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
85 printf("cc=%02x\n",r->rg_cc &amp; 0xff);
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
86 printf(" a=%02x\n",r->rg_a &amp; 0xff);
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
87 printf(" b=%02x\n",r->rg_b &amp; 0xff);
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
88 printf("dp=%02x\n",r->rg_dp &amp; 0xff);
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
89 printf(" x=%02x\n",r->rg_x);
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
90 printf(" y=%02x\n",r->rg_u);
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
91 printf(" u=%02x\n",r->rg_y);
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
92 }
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
93 </programlisting>
032365886652 Mainly section structures added.
roug
parents: 468
diff changeset
94 </refsect1>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
95 </refentry>