%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: TeX -*- %%%%%%%%%%%%%%%%%%%%%%%%%%
%% varcard.tex -- Reference Card for Atari ST GNU C System Structures
%%                This file is to be processed by plain TeX.
%%
%% Copyright (C) 1990,1991	Frank Ridderbusch
%%
%% This text is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation; either version 1, or any later version.
%% 
%% This program (text) is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%% GNU General Public License for more details.
%% 
%% Additional, I declare this reference card postcardware. If you find
%% this reference card usefull, please send a simple postcard to the
%% address mentioned below.
%%
%% Author          : Frank Ridderbusch
%% Created On      : Mon Apr 16 10:55:38 1990
%% Last Modified By: Frank Ridderbusch
%% Last Modified On: Sun May 19 13:10:12 1991
%% Update Count    : 90
%% Status          : Released.
%% COMMENTS
%%    For additional hints about the used multicolumn format see the
%%    comments in the file varmacro.tex.
%% HISTORY
%% 18-May-1991		Frank Ridderbusch	
%%    Last Modified: Sat May 18 13:09:22 1991 #86 (nil)
%%    Updated to match J.R.Bammi's recent send diffs to the headers
%%    and the library sources. Inclusion of some additional stuff
%%    (lseek, open modes, ioctl commands,signals, hdinfo).
%%    (Headers and library are at patchlevel 65)
%% 13-Dec-1990		Frank Ridderbusch Tel. 4685	
%%    Last Modified: Thu Dec 13 10:52:26 1990 #71 (Frank Ridderbusch Tel. 4685)
%%    Preliminary final version, until the last comments have arrived.
%%    Fine tuning will then be done.
%% 16-Apr-1990          Frank Ridderbusch Tel. 4685     
%%    Starting point.
%%
%%    Please send any comments about missing features or things to
%%    include to:
%%    Email:
%%	ridderbusch.kd@sni-usa.com (America (North & South))
%%      ridderbusch.kd@sni.de      (Rest of World)
%%
%%    Snail:
%%	Frank Ridderbusch	Tel.: (049)-5254 67066
%%	Sander Str. 17
%%	W-4790 Paderborn
%%	Germany
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tracingstats=1
% Reference Card for GNU C System structures on the Atari ST
%**start of header
\newcount\columnsperpage

% This file can be printed with 1, 2, or 3 columns per page (see below).
% Specify how many you want here.  Nothing else needs to be changed.

\columnsperpage=2

\def\versionnumber{2.0}
\def\year{1991}
\def\version{May \year\ v\versionnumber}

\def\shortcopyrightnotice{\vskip 1ex plus 2 fill
  \centerline{\small \copyright\ \year\ Frank Ridderbusch
  Permissions on back.  v\versionnumber}}

\def\copyrightnotice{
\vskip 1ex plus 2 fill\begingroup\small
\centerline{Copyright \copyright\ \year\ Frank Ridderbusch}
\centerline{This multicolumn format was originally designed}
\centerline{by Stephen Gildea and modified to fit the Atari ST}
\centerline{system variables by Frank Ridderbusch}

Permission is granted to make and distribute copies of
this card provided the copyright notice and this permission notice
are preserved on all copies.

\endgroup}

\input varmacro.tex

\overfullrule=0pt % avoid ugly black boxes

%**end of header

\title{Atari ST System Structures}

This reference card list frequently used structures and defines. Also
some external variables are included. Some Flags are only valid, when
MiNT, the multitasking TOS extension from Eric~R. Smith is running.
These are marked with ``(MiNT)''. Not all presented structure fields
or defines are nessesarily usefull on the ST, but are provided for
compatibility.\par
\medskip
\rewritetocfilefalse
\readtocfile
\medskip
This reference card is currently based on Jwahar~R. Bammi's library at
patchlevel 65 und patchlevel 65 of the include files.\par

Additionally, this reference card is postcardware. If you find it
usefull, send a postcard to this address: Frank Ridderbusch, Sander
Str.~17, W-4790~Paderborn, Germany.

\shortcopyrightnotice
\newcolumn

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Basepage}

\#include \<basepage.h>

\beginstructure{typedef struct \bf basep}
  \struc char \*p\_lowtpa;{ptr to self (bottom of TPA)}
  \struc char \*p\_hitpa;{ptr to top of TPA + 1}
  \struc char \*p\_tbase;{base of text segment}
  \struc long p\_tlen;{len of text segment}
  \struc char \*p\_dbase;{base of data segment}
  \struc long p\_dlen;{len of data segment}
  \struc char \*p\_bbase;{base Of BSS Segment}
  \struc long p\_blen;{len of BSS segment}
  \struc char \*p\_dta;{ptr to current DTA}
  \struc struct~{\bf basep} \*p\_parent;{ptr to parent's basepage}
  \struc char \*p\_reserved;{}
  \struc char \*p\_env;{ptr to environment string}
  \struc char devx[6];{real handles of std devices}
  \struc char res2;{reserved}
  \struc char defdrv;{default drive}
  \struc long p\_undef[18];{scratch area$\ldots$ don't touch}
  \struc char p\_cmdlin[128];{command line image}
\endstructure{\bf BASEPAGE}

extern {\bf BASEPAGE} \*\_base;
\medskip
\routines {\bf Pexec}()

\#include \<osbind.h>

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{PE\_LOADGO}{0}{load and go}
  \threecolrule{PE\_LOAD}{3}{just load}
  \threecolrule{PE\_GO}{4}{just go}
  \threecolrule{PE\_CBASEPAGE}{5}{just create bsaepage}
  \threecolrule{PE\_GO\_FREE}{6}{just go, then free mem}
  \threecolrule{}{100}{as 0, start async.~(MiNT)}
  \threecolrule{}{104}{as 4, start async.~(MiNT)}
  \threecolrule{}{200}{as 0, but overlay (MiNT)}
\enddefines
\medskip

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Date and Time}

\routines {\bf mktime}(), {\bf asctime}(), {\bf gmtime}(),
{\bf localtime}(), {\bf strftime}()

\#include \<time.h>

\strucindent=.35\hsize
\beginstructure{struct \bf tm}
  \struc int tm\_sec;{seconds (0$\ldots$59)}
  \struc int tm\_min;{minutes (0$\ldots$59)}
  \struc int tm\_hour;{hours (0$\ldots$23)}
  \struc int tm\_mday;{day of month (1$\ldots$31)}
  \struc int tm\_mon;{month (0$\ldots$11)}
  \struc int tm\_year;{year - 1900}
  \struc int tm\_wday;{day of week (0=Sun$\ldots$6=Sat)}
  \struc int tm\_yday;{day of year (0$\ldots$365)}
  \struc int tm\_isdst;{daylight savings }
\endstructure{}\defaultstrucindent

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Directory Information}

\routines {\bf readdir}()

\#include \<dirent.h>

\beginstructure{struct \bf dirent}
  \struc long d\_ino;{garbage under TOS}
  \struc off\_t d\_off;{in TOS, entry in list}
  \struc short d\_reclen;{in TOS, length of d\_name}
  \struc struct~{\bf dirent} \*d\_next;{ptr to next dirent in list}
  \struc unsigned~char d\_attribute;{file modes from {\bf Fsfirst}()}
  \struc unsigned~short d\_time;{TOS time for file}
  \struc unsigned~short d\_date;{TOS date for file}
  \struc long d\_size;{file size}
  \struc char d\_name[1];{file name}
\endstructure{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{File Information}

\routines {\bf stat}(), {\bf fstat}(), {\bf lstat}()

\#include \<types.h>\par
\#include \<stat.h>

\beginstructure{struct \bf stat}
  \struc u\_short st\_mode;{}
  \struc ino\_t st\_ino;{}
  \struc dev\_t st\_dev;{}
  \struc short st\_rdev;{}
  \struc short st\_nlink;{}
  \struc uid\_t st\_uid;{user id}
  \struc gid\_t st\_gid;{group id}
  \struc off\_t st\_size;{file size}
  \struc off\_t st\_blksize;{bytes per fs block}
  \struc off\_t st\_blocks;{no. of blocks}
  \struc time\_t st\_mtime;{modification time}
  \struc time\_t st\_atime;{access time}
  \struc time\_t st\_ctime;{creation time}
  \struc short st\_attr;{}
\endstructure{}

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{S\_IFMT}{0170000}{file type mask}
  \threecolrule{S\_IFBLK}{0060000}{block special device}
  \threecolrule{S\_IFCHR}{0020000}{character special device}
  \threecolrule{S\_IFDIR}{0040000}{directory}
  \threecolrule{S\_IFREG}{0100000}{regular file}
  \threecolrule{S\_IFIFO}{0120000}{named pipe (MiNT)}
  \threecolrule{S\_IFLNK}{0160000}{symbolic link}
  \threecolrule{S\_ISUID}{0004000}{s-bit owner}
  \threecolrule{S\_ISGID}{0002000}{s-bit group}
  \threecolrule{S\_ISVTX}{0001000}{sticky bit}
  \threecolrule{S\_IREAD}{0000400}{readable by owner}
  \threecolrule{S\_IWRITE}{0000200}{writable by owner}
  \threecolrule{S\_IEXEC}{0000100}{executable by owner}
\enddefines
\medskip

\routines {\bf utime}()

\#include \<types.h>

\beginstructure{struct \bf utimbuf}
  \struc time\_t axtime;{access time}
  \struc time\_t modtime;{modification time}
\endstructure{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Atari ST Executable Fileformat}

\#include \<st-out.h>

\beginstructure{struct \bf aexec}
  \struc short a\_magic;{magic number (0x601a)}
  \struc unsigned~long a\_text;{text segment size}
  \struc unsigned~long a\_data;{initialized data size}
  \struc unsigned~long a\_bss;{uninitialized data size}
  \struc unsigned~long a\_syms;{symbol table size}
  \struc unsigned~long a\_AZero1;{always zero}
  \struc unsigned~long a\_ldflgs;{program load flags}
  \struc unsigned~short a\_isreloc;{is reloc info present}
\endstructure{}
\medskip

\beginstructure{struct \bf asym}
  \struc char a\_name[8];{symbol name}
  \struc unsigned~short a\_type;{type flag}
  \struc unsigned~long a\_value;{symbol value}
\endstructure{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Lseek, Open and Fcntl Flags}

\routines {\bf lseek}()

\#include \<unistd.h>

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{SEEK\_SET}{0}{from beginning of file}
  \threecolrule{SEEK\_CUR}{1}{from current location}
  \threecolrule{SEEK\_END}{2}{from end of file}
\enddefines\medskip

\routines {\bf open}()

\#include \<fcntl.h>

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{O\_RDONLY}{0x00}{read only}
  \threecolrule{O\_WRONLY}{0x01}{write only}
  \threecolrule{O\_RDWR}{0x02}{read/write}
  \threecolrule{O\_NDELAY}{0x04}{non-blocking I/O}
  \threecolrule{O\_SYNC}{0x08}{sync after writes (MiNT)}
  \threecolrule{O\_APPEND}{0x10}{position at EOF}
  \threecolrule{O\_CREAT}{0x20}{create new file if needed}
  \threecolrule{O\_TRUNC}{0x40}{make file 0 length}
  \threecolrule{O\_EXCL}{0x80}{error, if file exists}
\enddefines\medskip

\routines {\bf access}()

\#include \<fcntl.h>

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{F\_OK}{0}{present}
  \threecolrule{X\_OK}{1}{executable}
  \threecolrule{W\_OK}{2}{writable}
  \threecolrule{R\_OK}{4}{readable}
\enddefines\medskip

\routines {\bf fcntl}()

\#include \<fcntl.h>

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{F\_DUPFD}{0}{Duplicate fildes (MiNT)}
  \threecolrule{F\_GETFD}{1}{Get fildes flags (MiNT)}
  \threecolrule{F\_SETFD}{2}{Set fildes flags (MiNT)}
  \threecolrule{F\_GETFL}{3}{Get file flags (MiNT)}
  \threecolrule{F\_SETFL}{4}{Set file flags (MiNT)}
  \threecolrule{F\_GETLK}{5}{Get file lock (MiNT)}
  \threecolrule{F\_SETLK}{6}{Set file lock (MiNT)}
\enddefines

Locking under MiNT currently only works for FIFOs.

\beginstructure{struct \bf flock}
  \struc short l\_type;{type of lock}
  \struc long l\_start;{start of locked reg.}
  \struc long l\_len;{0 for rest of file}
  \struc short l\_pid;{set by F\_GETLK}
\endstructure{}

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{F\_RDLCK}{O\_RDONLY}{Read lock (MiNT)}
  \threecolrule{F\_WRLCK}{O\_WRONLY}{Write lock (MiNT)}
  \threecolrule{F\_UNLCK}{3}{Unlock (MiNT)}
\enddefines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Ioctl Commands and Structures}

\routines {\bf ioctl}()

\#include \<ioctl.h>

\beginstructure{struct \bf tchars}
  \struc char t\_intrc;{interrupt character}
  \struc char t\_quitc;{quit character}
  \struc char t\_start;{start output character}
  \struc char t\_stopc;{stop output character}
  \struc char t\_eofc;{EOF character}
  \struc char t\_brkc;{break character}
\endstructure{}

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{TIOCGETP}{(('T'$<<$ 8) \| 0)}{get param. - gtty}
  \threecolrule{TIOCSETP}{(('T'$<<$ 8) \| 1)}{set param. - stty}
  \threecolrule{TIOCSETN}{TIOCSETP}{set param., no flush}
  \threecolrule{TIOCGETC}{(('T'$<<$ 8) \| 2)}{get spec. char.}
  \threecolrule{TIOCSETC}{(('T'$<<$ 8) \| 3)}{set spec. char.}
  \threecolrule{TIOCGLTC}{(('T'$<<$ 8) \| 4)}{get loc. spec. char.}
  \threecolrule{TIOCSLTC}{(('T'$<<$ 8) \| 5)}{set loc. spec. char.}
\enddefines

\beginstructure{struct \bf ltchars}
  \struc char t\_suspc;{stop process sig.}
  \struc char t\_dsuspc;{delayed stop process sig.}
  \struc char t\_rprntc;{reprint line}
  \struc char t\_flushc;{flush output}
  \struc char t\_werasc;{word erase}
  \struc char t\_lnextc;{literal next char.}
\endstructure{}

The following defines apply only, when MiNT is running.

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{FIONREAD}{(('F'$<<$ 8) \| 1) }{get \# byte to rd}
  \threecolrule{FIONWRITE}{(('F'$<<$ 8) \| 2) }{}
  \threecolrule{TIOCGPGRP}{(('T'$<<$ 8) \| 6) }{get pgrp of tty}
  \threecolrule{TIOCSPGRP}{(('T'$<<$ 8) \| 7) }{set pgrp of tty}
  \threecolrule{TIOCFLUSH}{(('T'$<<$ 8) \| 8) }{flush buffers}
  \threecolrule{TIOCSTOP}{(('T'$<<$ 8) \| 9) }{stop output}
  \threecolrule{TIOCSTART}{(('T'$<<$ 8) \| 10)}{start output}
  \threecolrule{PPROCADDR}{(('P'$<<$ 8) \| 1)}{}
  \threecolrule{PBASEADDR}{(('P'$<<$ 8) \| 2)}{}
\enddefines

\beginstructure{struct \bf sgttyb}
  \struc char sg\_ispeed;{input speed}
  \struc char sg\_ospeed;{output speed}
  \struc char sg\_erase;{erase character}
  \struc char sg\_kill;{kill character}
  \struc short sg\_flags;{flags}
\endstructure{}

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{CRMOD}{0x0001}{map $\backslash$r to $\backslash$r
$\backslash$n on output}
  \threecolrule{CBREAK}{0x0002}{half-cooked mode}
  \threecolrule{ECHO}{0x0004}{echo input}
  \threecolrule{XTABS}{0x0008}{expand tabs on output}
  \threecolrule{RAW}{0x0010}{no I/O processing}
  \threecolrule{LCASE}{0x0020}{will never do anything}
  \threecolrule{TANDEM}{0x0000}{not needed}
  \threecolrule{META}{0x0100}{Alternate as meta key}
  \threecolrule{EVENP}{0x4000}{even parity}
  \threecolrule{ODDP}{0x8000}{odd parity}
  \threecolrule{ANYP}{}{speed betw. 300--9600 Bd}
  \threecolrule{ALLDELAY}{0}{}
\enddefines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Signals}

\routines {\bf signal}(), {\bf raise}()

\#include \<signal.h>

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{SIGNULL}{0}{not really a signal}
  \threecolrule{SIGHUP}{1}{hangup signal}
  \threecolrule{SIGINT}{2}{sent by ^C}
  \threecolrule{SIGQUIT}{3}{quit signal}
  \threecolrule{SIGILL}{4}{illegal instruction}
  \threecolrule{SIGTRAP}{5}{trace trap}
  \threecolrule{SIGABRT}{6}{abort signal}
  \threecolrule{SIGIOT}{SIGABRT}{}
  \threecolrule{SIGPRIV}{7}{privilege violation}
  \threecolrule{SIGEMT}{SIGPRIV}{}
  \threecolrule{SIGFPE}{8}{divide by zero}
  \threecolrule{SIGKILL}{9}{cannot be ignored}
  \threecolrule{SIGBUS}{10}{bus error}
  \threecolrule{SIGSEGV}{11}{illegal mem. reference}
  \threecolrule{SIGSYS}{12}{bad arg.~to a syscall}
  \threecolrule{SIGPIPE}{13}{broken pipe}
  \threecolrule{SIGALRM}{14}{alarm clock}
  \threecolrule{SIGTERM}{15}{software term.~signal}
  \threecolrule{SIGURG}{16}{urg.~cond.~on I/O chan.}
  \threecolrule{SIGSTOP}{17}{stop sig.~not from term.}
  \threecolrule{SIGTSTP}{18}{stop sig.~from terminal}
  \threecolrule{SIGCONT}{19}{cont.~stopped process}
  \threecolrule{SIGCHLD}{20}{child stopped or exited}
  \threecolrule{SIGTTIN}{21}{read by bg proc.}
  \threecolrule{SIGTTOU}{22}{write by bg proc.}
  \threecolrule{SIGIO}{23}{I/O possible on a descr.}
  \threecolrule{SIGXCPU}{24}{CPU time exhausted}
  \threecolrule{SIGXFSZ}{25}{file size lim.~exceeded}
  \threecolrule{SIGVTALRM}{26}{virtual timer alarm}
  \threecolrule{SIGPROF}{27}{profiling timer expired}
  \threecolrule{SIGWINCH}{28}{window size changed}
  \threecolrule{SIGUSR}{29}{user signal 1}
  \threecolrule{SIGUSR}{30}{user signal 2}
\enddefines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Password Information}

\routines {\bf getpwent}(), {\bf getpwuid}(), {\bf getpwnam}()

\#include \<pwd.h>

\beginstructure{struct \bf passwd}
  \struc char \*pw\_name;{login name}
  \struc char \*pw\_passwd;{encrypted password}
  \struc int pw\_uid;{numeric user-id}
  \struc int pw\_gid;{numeric group-id}
  \struc char \*pw\_gecos;{GECOS field }
  \struc char \*pw\_dir;{home directory}
  \struc char \*pw\_shell;{default shell}
\endstructure{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Group Information}

\routines {\bf getgrid}(), {\bf getgrnam}()

\#include \<grp.h>

\beginstructure{struct \bf group}
  \struc char \*gr\_name;{group name}
  \struc char \*gr\_passwd;{}
  \struc int  gr\_gid;{numerical group-id}
  \struc char \*\*gr\_mem;{group members}
\endstructure{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{BIOS Parameter Block}

\routines {\bf Getbpb}()

\#include \<osbind.h>

\beginstructure{typedef struct}
  \struc short recsiz;{bytes per sector}
  \struc short clsiz;{sectors per cluster}
  \struc short clsizb;{bytes per cluster}
  \struc short rdlen;{root directory size}
  \struc short fsiz;{length of fat}
  \struc short fatrec;{start sec. of 2nd FAT}
  \struc short datrec;{1st data sector}
  \struc short numcl;{no. of clusters on medium}
  \struc short bflags;{some flags}
\endstructure{\bf \_BPB}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Serial I/O Buffer}

\routines {\bf Iorec}()

\#include \<osbind.h>

\beginstructure{typedef struct}
  \struc char  \*ibuf;{ptr to data buffer}
  \struc short ibufsiz;{len. of buffer}
  \struc short ibufhd;{next write pos.}
  \struc short ibuftl;{next read pos.}
  \struc short ibuflow;{low watermark}
  \struc short ibufhi;{high watermark}
\endstructure{\bf \_IOREC}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Keyboardtables}

\routines {\bf Keytbl}()

\beginstructure{typedef struct}
  \struc void \*unshift;{ptr normal keys}
  \struc void \*shift;{ptr to shifted keys}
  \struc void \*caps;{ptr to capslock keys}
\endstructure{\bf KEYTAB}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{KBDVECS Structure}

\routines {\bf Kbdvbase}()

\#include \<osbind.h>

\strucindent=0.48\hsize
\beginstructure{typedef struct}
  \struc void (\*midivec)(void);{MIDI input}
  \struc void (\*vkbderr)(void);{keyboard error}
  \struc void (\*vmiderr)(void);{MIDI error}
  \struc void (\*statvec)(void \*);{read IKBD status}
  \struc void (\*mousevec)(void \*);{mouse polling}
  \struc void (\*clockvec)(void \*);{clock polling}
  \struc void (\*joyvec)(void \*);{joystick polling}
  \struc void (\*midisys)(void);{MIDI systemvector}
  \struc void (\*ikbdsys)(void);{IKBD systemvector}
  \struc char kbstate;{}
\endstructure{\bf \_KBDVECS}\defaultstrucindent

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Disk Tranfer Area}

\routines {\bf Fgetdta}(), {\bf Fsetdta}()

\#include \<osbind.h>

\beginstructure{struct \bf \_dta}
  \struc char dta\_buf[21];{}
  \struc char dta\_attribute;{file attribute}
  \struc unsigned~short dta\_time;{}
  \struc unsigned~short dta\_date;{}
  \struc long dta\_size;{file size}
  \struc char dta\_name[14];{file name}
\endstructure{}

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{FA\_RDONLY}{0x01}{file is readonly}
  \threecolrule{FA\_HIDDEN}{0x02}{file is hidden}
  \threecolrule{FA\_SYSTEM}{0x04}{system file}
  \threecolrule{FA\_LABEL}{0x08}{entry is volume label}
  \threecolrule{FA\_DIR}{0x10}{entry is a directory}
  \threecolrule{FA\_CHANGED}{0x20}{file has changed}
\enddefines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Diskinfo}

\routines {\bf Dfree}()

\beginstructure{typedef struct}
  \struc long b\_free;{no. of free clusters}
  \struc long b\_total;{no. of clusters}
  \struc long b\_secsize;{bytes per sector}
  \struc long b\_clsiz;{sect. per cluster}
\endstructure{\bf DISKINFO}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{File Timestamp}

\routines {\bf Fdatime}()

\#include \<osbind.h>

\beginstructure{typedef struct}
  \struc short time;{time as in {\bf Tgettime}}
  \struc short date;{date as in {\bf Tgetdate}}
\endstructure{\bf \_DOSTIME}

A good alternative might be:

\beginstructure{typedef struct}
  \struc timeinfo time;{time as in {\bf Tgettime}}
  \struc dateinfo date;{date as in {\bf Tgetdate}}
\endstructure{\bf \_DOSTIME}

\beginstructure{typedef struct}
  \struc unsigned hours : 5;{}
  \struc unsigned minutes : 6;{}
  \struc unsigned seconds : 5;{}
\endstructure{\bf timeinfo}

\beginstructure{typedef struct}
  \struc unsigned year : 7;{}
  \struc unsigned month : 4;{}
  \struc unsigned day : 5;{}
\endstructure{\bf dateinfo}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{HDINFO Structure}

\#include \<sysvars.h>

\beginstructure{typedef struct}
  \struc short puns;{}
  \struc char v\_p\_un[16];{}
  \struc long pstart[16];{}
  \struc short bpbs[1];{really 16 BPB's}
\endstructure{\bf HDINFO}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{XBRA}

\#include \<xbra.h>

\beginstructure{typedef struct \bf\_\_xbra}
  \struc long xbra\_magic;{}
  \struc long gnuc\_magic;{}
  \struc xptr next;{}
  \struc short jump;{}
  \struc void (*this)(void);{}
\endstructure{\bf xbra\_struct}
\medskip

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{\_XBRA\_MAGIC}{0x58425241L}{/\* "XBRA" \*/}
  \threecolrule{\_GNUC\_MAGIC}{0x474E5543L}{/\* "GNUC" \*/}
  \threecolrule{\_JMP\_OPCODE}{0x4EF9}{}
  \threecolrule{\_JSR\_OPCODE}{0x4EB9}{}
\enddefines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{OS Header}

The system variable {\tt \_sysbase} points to this structure.

\beginstructure{typedef struct}
  \struc unsigned~short os\_entry;{entry address (BRA $\ldots$)}
  \struc unsigned~short os\_version;{OS version}
  \struc void (\*reseth)(void);{startaddress of OS-code}
  \struc struct~{\bf \_osheader} \*os\_beg;{base of OS}
  \struc void \*os\_end;{start of ``free'' ram}
  \struc char \*os\_rsv1;{default shell}
  \struc char \*os\_magic;{ptr to GEM-MAGIC var.}
  \struc long os\_dat;{creation date 0xMMDDYYYY}
  \struc unsigned~short os\_conf;{bit 0 = 1 $\Rightarrow$ PAL, NTSC otherwise}
  \struc unsigned~short os\_dosdate;{creationdate in TOS form.}
  \struc char \*\*p\_root;{base of OS pool}
  \struc char \*\*pkbshift;{kbd shift state var}
  \struc char \*\*p\_run;{PID of current proc.}
  \struc char \*p\_rsv2;{reserved}
\endstructure{\bf OSHDR}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{LineA Structure}

\routines {\bf linea0}()

\#include \<linea.h>

\strucindent=.4\hsize
\beginstructure{typedef struct}
  \struc short \_VPLANES;{0 \# of planes}
  \struc short \_VWRAP;{2 bytes / scan line}
  \struc short \*\_CONTRL;{4 ptr to CONTRL array}
  \struc short \*\_INTIN;{8 ptr to INTIN  array}
  \struc short \*\_PTSIN;{12 ptr to PTSIN  array}
  \struc short \*\_INTOUT;{16 ptr to INTOUT array}
  \struc short \*\_PTSOUT;{20 ptr to PTSOUT array}
  \struc short \_COLBIT0;{24 plane 0 color value}
  \struc short \_COLBIT1;{26 plane 1 color value}
  \struc short \_COLBIT2;{28 plane 2 color value}
  \struc short \_COLBIT3;{30 plane 3 color value}
  \struc short \_LSTLIN;{32 draw last pix. of line (=0)}
  \struc short \_LNMASK;{34 linemask}
  \struc short \_WMODE;{36 writing mode}
  \struc short \_X1;{38 X1 coord.}
  \struc short \_Y1;{40 Y1 coord.}
  \struc short \_X2;{42 X2 coord.}
  \struc short \_Y2;{44 Y2 coord.}
  \struc short \*\_PATPTR;{46  ptr to fill pattern}
  \struc short \_PATMSK;{50 len. in words of pattern}
  \struc short \_MFILL;{52 multi plane fill flag}
  \struc short \_CLIP;{54 clipping flag (=1)}
  \struc short \_XMINCL;{56 min X of clipp. window}
  \struc short \_YMINCL;{58 min Y of clipp. window}
  \struc short \_XMAXCL;{60 max X of clipp. window}
  \struc short \_YMAXCL;{62 max Y of clipp. window}
  \struc short \_XDDA;{64 accu for scaling}
  \struc short \_DDAINC;{66 scaling factor}
  \struc short \_SCALDIR;{68 scaling dir. 0 == down}
  \struc short \_MONO;{70 mono spaced flag}
  \struc short \_SOURCEX;{72 X coord. of char. in form}
  \struc short \_SOURCEY;{74 Y coord. of char. in form}
  \struc short \_DESTX;{76 X coord. of char. on screen}
  \struc short \_DESTY;{78 Y coord. of char. on screen}
  \struc short \_DELX;{80 width of character}
  \struc short \_DELY;{82 height of character}
  \struc short \*\_FBASE;{84 ptr to font image}
  \struc short \_FWIDTH;{88 width of font image}
  \struc short \_STYLE;{90 style flags}
  \struc short \_LITEMASK;{92 mask for lightening text}
  \struc short \_SKEWMASK;{94 mask for skewing text}
  \struc short \_WEIGHT;{96 add. width of bold text}
  \struc short \_ROFF;{98 off. above basel. when skewing}
  \struc short \_LOFF;{100 off. below basel. when skewing}
  \struc short \_SCALE;{102 scaling Flag (=1)}
  \struc short \_CHUP;{104 character rotation vector.}
  \struc short \_TEXTFG;{106 text foreground color}
  \struc char  \*\_SCRTCHP;{108 1k scratchpad area}
  \struc short \_SCRPT2;{112 Off. of the scaling buffer}
  \struc short \_TEXTBG;{114 text background color}
  \struc short \_COPYTRAN;{116 copy raster form type flag}
  \struc short (\*\_SEEDABORT)(void);{118 Ptr to seed abort function}
\endstructure{\bf \_\_LINEA}\defaultstrucindent
\medskip

extern {\bf \_\_LINEA} \*\_\_aline;\quad /\* from {\bf linea0()} \*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Font Header}

\routines {\bf linea8}()

\#include \<linea.h>

\strucindent=.38\hsize
\beginstructure{typedef struct \bf \_font}
  \struc short font\_id;{0 font face identifier}
  \struc short size;{2 font size in points}
  \struc char name[32];{4 face name}
  \struc short first\_ade;{36 low. ADE value in face}
  \struc short last\_ade;{38 high. ADE value in face}
  \struc short top;{40 dist. topline $\leftrightarrow$ baseline}
  \struc short ascent;{42 dist. ascentline $\leftrightarrow$ baseline}
  \struc short half;{44 dist. halfline $\leftrightarrow$ baseline}
  \struc short descent;{46 dist. decentline $\leftrightarrow$ baseline}
  \struc short bottom;{48 dist. bottomline $\leftrightarrow$ baseline}
  \struc short max\_char\_width;{50 width of widest char.}
  \struc short max\_cell\_width;{52 width of widest char. cell}
  \struc short left\_offset;{54 left offset}
  \struc short right\_offset;{56 right offset}
  \struc short thicken;{58 add. width of bold char.}
  \struc short ul\_size;{60 width of underline}
  \struc short lighten;{62 mask for lighten char.}
  \struc short skew;{64 mask for skewing char.}
  \struc short flags;{66 flags}
  \struc char \*h\_table;{68 ptr to hor. off. table}
  \struc short \*off\_table;{72 ptr to char. off. table}
  \struc char \*dat\_table;{76 ptr to font data}
  \struc short form\_width;{80 form width}
  \struc short form\_height;{82 form height}
  \struc struct~{\bf \_font} \*next\_font;{84 ptr to next font}
\endstructure{\bf \_\_FONT}\defaultstrucindent
\medskip

extern {\bf \_\_FONT} \*\*\_\_fonts;\quad /\* from {\bf linea0()} \*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Bit Blt Parameter Block Type}

\routines {\bf linea7}()

\#include \<linea.h>

\beginstructure{typedef struct}
  \struc short bb\_b\_wd;{width of block}
  \struc short bb\_b\_ht;{height of block}
  \struc short bb\_plane\_ct;{number of planes}
  \struc short bb\_fg\_col;{fg color}
  \struc short bb\_bg\_col;{bg color}
  \struc {\bf OP\_TAB} bb\_op\_tab;{logic for fg x bg comb.}
  \struc {\bf SDDB} bb\_s;{src info block}
  \struc {\bf SDDB} bb\_d;{dst info block}
  \struc short \*bb\_p\_addr;{pattern buffer address}
  \struc short bb\_p\_nxln;{off. to next line in pat.}
  \struc short bb\_p\_nxpl;{off. to next plane in pat.}
  \struc short bb\_p\_mask;{pattern index mask}
  \struc char bb\_fill[24];{work space}
\endstructure{\bf BBPB}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{OP\_TAB of Bit Blt Parameter Block}

\routines {\bf linea7}()

\#include \<linea.h>

\strucindent=.35\hsize
\beginstructure{typedef struct}
  \struc char fg0bg0;{logic op for FG \&\& BG = 0}
  \struc char fg0bg1;{logic op for FG = 0 \&\& BG = 1}
  \struc char fg1bg0;{logic op for FG = 1 \&\& BG = 0}
  \struc char fg1bg1;{logic op for FG \&\& BG = 1}
\endstructure{\bf OP\_TAB}
\medskip

\begindefines
  \threecolrule{Define}{Value}{Type}
  \noalign{\hrule}
  \threecolrule{ALL\_WHITE}{0}{}
  \threecolrule{S\_AND\_D}{1}{}
  \threecolrule{S\_AND\_NOTD}{2}{}
  \threecolrule{S\_ONLY}{3}{}
  \threecolrule{NOTS\_AND\_D}{4}{}
  \threecolrule{D\_ONLY}{5}{}
  \threecolrule{S\_XOR\_D}{6}{}
  \threecolrule{S\_OR\_D}{7}{}
  \threecolrule{NOT\_SORD}{8}{}
  \threecolrule{NOT\_SXORD}{9}{}
  \threecolrule{D\_INVERT}{10}{}
  \threecolrule{NOT\_D}{10}{}
  \threecolrule{S\_OR\_NOTD}{11}{}
  \threecolrule{NOT\_S}{12}{}
  \threecolrule{NOTS\_OR\_D}{13}{}
  \threecolrule{NOT\_SANDD}{14}{}
  \threecolrule{ALL\_BLACK}{15}{}
\enddefines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{SRC and DST Description Block Type}

\routines {\bf linea7}()

\#include \<linea.h>

\beginstructure{typedef struct}
  \struc short bl\_xmin;{minimum x}
  \struc short bl\_ymin;{minimum y}
  \struc char \*bl\_form;{short aligned memory form}
  \struc short bl\_nxwd;{off. to next word in line}
  \struc short bl\_nxln;{off. to next line in plane}
  \struc short bl\_nxpl;{off. to next plane}
\endstructure{\bf SDDB}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Memory Form Definition Block Type}

\routines {\bf lineae}()

\#include \<linea.h>

\beginstructure{typedef struct}
  \struc char \*fd\_addr;{ptr to memory block}
  \struc short fd\_w;{form width}
  \struc short fd\_h;{form height}
  \struc short fd\_wdwidth;{form width in shorts}
  \struc short fd\_stand;{form fmt 0 = dev spec, 1 = std}
  \struc short fd\_nplanes;{number of memory planes}
  \struc short fd\_r1;{reserved}
  \struc short fd\_r2;{reserved}
  \struc short fd\_r3;{reserved}
\endstructure{\bf MFDB}\defaultstrucindent
\medskip

\routines {\bf vro\_\-cpy\-fm}(), {\bf vrt\_\-cpy\-fm}(), 
{\bf vr\_\-trn\-fm}() 

\#include \<gemfast.h>

\beginstructure{typedef struct \bf form\_definition}
  \struc long fd\_addr; {}
  \struc { } $\ldots$\ ;{rest as above}
\endstructure{\bf MFDB}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Mouse Form Definition Block Type}

\routines {\bf lineab}()

\#include \<linea.h>

\beginstructure{typedef struct}
  \struc short mf\_xhot;{off. to x hot spot}
  \struc short mf\_yhot;{off. to y hot spot}
  \struc short mf\_nplanes;{set to 1}
  \struc short mf\_bg;{cursor color}
  \struc short mf\_fg;{mask color}
  \struc short mf\_mask[16];{mask data}
  \struc short mf\_data[16];{cursor data}
\endstructure{\bf MFORM}
\medskip

\routines {\bf graf\_mouse}()

\#include \<gemfast.h>

\beginstructure{typedef struct \bf mouse\_form}
  \struc { } $\ldots$\ ;{same as above}
\endstructure{\bf MFORM}

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{ARROW}{0}{}
  \threecolrule{BEE}{2}{}
  \threecolrule{BUSY\_BEE}{BEE}{/\* alias \*/}
  \threecolrule{TEXT\_CRSR}{1}{}
  \threecolrule{HOURGLASS}{2}{}
  \threecolrule{POINT\_HAND}{3}{}
  \threecolrule{FLAT\_HAND}{4}{}
  \threecolrule{THIN\_CROSS}{5}{}
  \threecolrule{THICK\_CROSS}{6}{}
  \threecolrule{OUTLN\_CROSS}{7}{}
  \threecolrule{USER\_DEF}{255}{}
  \threecolrule{M\_OFF}{256}{mouse on}
  \threecolrule{M\_ON}{257}{mouse off}
\enddefines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Sprite Definition Block Type}

\routines {\bf linead}()

\#include \<linea.h>

\beginstructure{typedef struct}
  \struc short sp\_xhot;{off. to x hot spot}
  \struc short sp\_yhot;{off. to y hot spot}
  \struc short sp\_format;{format {\tt SP\_VDI} or {\tt SP\_XOR}}
  \struc short sp\_bg;{bg color}
  \struc short sp\_fg;{fg color}
  \struc short sp\_data[32];{sprite data}
\endstructure{\bf SFORM}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{AES Object Type}

\routines too many to mention.

\#include \<gemfast.h>

\beginstructure{typedef struct \bf object}
  \struc short ob\_next;{$\rightarrow$ object's next sibling}
  \struc short ob\_head;{$\rightarrow$ head of object's children}
  \struc short ob\_tail;{$\rightarrow$ tail of object's children}
  \struc unsigned short ob\_type;{type of object}
  \struc unsigned short ob\_flags;{flags}
  \struc unsigned short ob\_state;{state}
  \struc unsigned long ob\_spec;{object-specific data}
  \struc short ob\_x;{upper left corner of object}
  \struc short ob\_y;{upper left corner of object}
  \struc short ob\_width;{width of obj}
  \struc short ob\_height;{height of obj}
\endstructure{\bf OBJECT}
\medskip

\begindefines
  \threecolrule{Define}{Value}{Object Type}
  \noalign{\hrule}
  \threecolrule{G\_BOX}{20}{box with attributes}
  \threecolrule{G\_TEXT}{21}{graphics text}
  \threecolrule{G\_BOXTEXT}{22}{box with graphics text}
  \threecolrule{G\_IMAGE}{23}{simple picture}
  \threecolrule{G\_USERDEF}{24}{user function}
  \threecolrule{G\_IBOX}{25}{invisible box}
  \threecolrule{G\_BUTTON}{26}{centered text in box}
  \threecolrule{G\_BOXCHAR}{27}{box with single character}
  \threecolrule{G\_STRING}{28}{string}
  \threecolrule{G\_FTEXT}{29}{formatted graphics text}
  \threecolrule{G\_FBOXTEXT}{30}{box w. form. graphics text}
  \threecolrule{G\_ICON}{31}{icon}
  \threecolrule{G\_TITLE}{32}{title of drop down menue}
\enddefines
\medskip

\begindefines
  \threecolrule{Define}{Value}{Object Flags}
  \noalign{\hrule}
  \threecolrule{NONE}{0x0000}{}
  \threecolrule{SELECTABLE}{0x0001}{}
  \threecolrule{DEFAULT}{0x0002}{default choice}
  \threecolrule{EXIT}{0x0004}{exit, when selected}
  \threecolrule{EDITABLE}{0x0008}{object is editable}
  \threecolrule{RBUTTON}{0x0010}{}
  \threecolrule{LASTOB}{0x0020}{last object in tree}
  \threecolrule{TOUCHEXIT}{0x0040}{}
  \threecolrule{HIDETREE}{0x0080}{}
  \threecolrule{INDIRECT}{0x0100}{}
\enddefines
\medskip

\begindefines
  \threecolrule{Define}{Value}{Object State}
  \noalign{\hrule}
  \threecolrule{NORMAL}{0x0000}{}
  \threecolrule{SELECTED}{0x0001}{}
  \threecolrule{CROSSED}{0x0002}{}
  \threecolrule{CHECKED}{0x0004}{}
  \threecolrule{DISABLED}{0x0008}{not selectable}
  \threecolrule{OUTLINED}{0x0010}{}
  \threecolrule{SHADOWED}{0x0020}{}
\enddefines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Graphic- and VDI-Rectangle}

\#include \<gemfast.h>

\beginstructure{typedef struct \bf graphic\_rectangle}
  \struc int g\_x;{}
  \struc int g\_y;{}
  \struc int g\_w;{}
  \struc int g\_h;{}
\endstructure{\bf GRECT}
\medskip

\beginstructure{typedef struct \bf vdi\_rectangle}
  \struc int v\_x1;{}
  \struc int v\_y1;{}
  \struc int v\_x2;{}
  \struc int v\_y2;{}
\endstructure{\bf VRECT}
\medskip

\beginstructure{typedef struct \bf orect}
  \struc struct~{\bf orect} \*o\_link;{}
  \struc int o\_x;{}
  \struc int o\_y;{}
  \struc int o\_w;{}
  \struc int o\_h;{}
\endstructure{\bf ORECT}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{TEDINFO Structure Type}

\#include \<gemfast.h>

\beginstructure{typedef struct \bf text\_edinfo}
  \struc char \*te\_ptext;{ptr to text}
  \struc char \*te\_ptmplt;{ptr to template}
  \struc char \*te\_pvalid;{ptr to validation chrs.}
  \struc short te\_font;{font}
  \struc short te\_junk1;{junk word}
  \struc short te\_just;{justification}
  \struc short te\_color;{color information word}
  \struc short te\_junk2;{junk word}
  \struc short te\_thickness;{border thickness}
  \struc short te\_txtlen;{length of text string}
  \struc short te\_tmplen;{length of template string}
\endstructure{\bf TEDINFO}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{ICON Block Type}

\#include \<gemfast.h>

\beginstructure{typedef struct \bf icon\_block}
  \struc short \*ib\_pmask;{ptr to icon mask}
  \struc short \*ib\_pdata;{ptr to icon data}
  \struc char \*ib\_ptext;{ptr to icon text}
  \struc short ib\_char;{char. to appear in icon}
  \struc short ib\_xchar;{x-pos. of char.}
  \struc short ib\_ychar;{y-pos. of char}
  \struc short ib\_xicon;{x-pos. of icon}
  \struc short ib\_yicon;{y-pos. of icon}
  \struc short ib\_wicon;{width of icon}
  \struc short ib\_hicon;{height of icon}
  \struc short ib\_xtext;{x-pos. of text}
  \struc short ib\_ytext;{y-pos. of text}
  \struc short ib\_wtext;{textwidth in pixels}
  \struc short ib\_htext;{textheight in pixels}
  \struc short ib\_resvd;{}
\endstructure{\bf ICONBLK}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Resource File Header}

\#include \<gemfast.h>

\beginstructure{typedef struct \bf rshdr}
  \struc short rsh\_vrsn;{}
  \struc short rsh\_object;{pos. of object field}
  \struc short rsh\_tedinfo;{pos. of TEDINFO structs}
  \struc short rsh\_iconblk;{pos. of ICONBLK structs}
  \struc short rsh\_bitblk;{pos. of BITBLK structs}
  \struc short rsh\_frstr;{pos. of free strings}
  \struc short rsh\_string;{pos.of bound strings}
  \struc short rsh\_imdata;{image data}
  \struc short rsh\_frimg;{pos. of free images}
  \struc short rsh\_trindex;{pos. of object tree table}
  \struc short rsh\_nobs;{counts of various structs}
  \struc short rsh\_ntree;{no. of object trees}
  \struc short rsh\_nted;{no. of TEDINFO structs}
  \struc short rsh\_nib;{no. of ICONBLK structs}
  \struc short rsh\_nbb;{no. of BITBLK structs}
  \struc short rsh\_nstring;{no. of strings}
  \struc short rsh\_nimages;{no. of images}
  \struc short rsh\_rssize;{total bytes in resource}
\endstructure{\bf RSHDR}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Bit-Image-Structure (BITBLK)}

\#include \<gemfast.h>

\beginstructure{typedef struct \bf bit\_block}
  \struc char \*bi\_pdata;{ptr to bit forms data}
  \struc short bi\_wb;{width of form in bytes}
  \struc short bi\_hl;{height in lines}
  \struc short bi\_x;{source x in bit form}
  \struc short bi\_y;{source y in bit form}
  \struc short bi\_color;{fg color of blt}
\endstructure{\bf BITBLK}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Application-Block-Structure}

\#include \<gemfast.h>

\beginstructure{typedef struct \bf user\_block}
  \struc int (\*ub\_code)(void \*parmblock);{ptr to user function}
  \struc long ub\_parm;{optional parameter}
\endstructure{\bf USERBLK}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Parameter-Block-Structure}

\#include \<gemfast.h>

\strucindent=0.38\hsize
\beginstructure{typedef struct \bf parm\_block}
  \struc {\bf OBJECT} \*pb\_tree;{ptr to object tree}
  \struc short pb\_obj;{object number}
  \struc short pb\_prevstate;{previous state}
  \struc short pb\_currstate;{current state}
  \struc short pb\_x, pb\_y;{x- \& y-pos. of object}
  \struc short pb\_w, pb\_h;{width \& height of object}
  \struc short pb\_xc, pb\_yc;{x- \& y-pos. of clip. rect.}
  \struc short pb\_wc, pb\_hc;{width \& height of clip. rect.}
  \struc long pb\_parm;{parameter from USERBLK}
\endstructure{\bf PARMBLK}\defaultstrucindent

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Multi Event Flags}

\routines {\bf evnt\_multi}()

\#include \<gemfast.h>

\begindefines
  \threecolrule{Define}{Value}{Event}
  \noalign{\hrule}
  \threecolrule{MU\_KEYBD}{0x0001}{keyboard event}
  \threecolrule{MU\_BUTTON}{0x0002}{mouse button event}
  \threecolrule{MU\_M1}{0x0004}{first mouse event}
  \threecolrule{MU\_M2}{0x0008}{second mouse event}
  \threecolrule{MU\_MESAG}{0x0010}{message event}
  \threecolrule{MU\_TIMER}{0x0020}{timer event}
\enddefines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Keyboard States}

\routines {\bf evnt\_button}(), {\bf evnt\_mouse}(), {\bf
evnt\_\-multi}(), {\bf graf\_\-mk\-state}()

\#include \<gemfast.h>

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{K\_RSHIFT}{0x0001}{right shift key}
  \threecolrule{K\_LSHIFT}{0x0002}{left shift key}
  \threecolrule{K\_CTRL}{0x0004}{control key}
  \threecolrule{K\_ALT}{0x0008}{alternate key}
\enddefines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Message Event, Window Handling}

\#include \<gemfast.h>

\routines {\bf wind\_create}()

\begindefines
  \threecolrule{Define}{Value}{Window Attribute}
  \noalign{\hrule}
  \threecolrule{NAME}{0x0001}{name line}
  \threecolrule{CLOSER}{0x0002}{closing field}
  \threecolrule{FULLER}{0x0004}{full size field}
  \threecolrule{MOVER}{0x0008}{move field}
  \threecolrule{INFO}{0x0010}{info line}
  \threecolrule{SIZER}{0x0020}{change size field}
  \threecolrule{UPARROW}{0x0040}{up arrow}
  \threecolrule{DNARROW}{0x0080}{down arrow}
  \threecolrule{VSLIDE}{0x0100}{vertical slider}
  \threecolrule{LFARROW}{0x0200}{left arrow}
  \threecolrule{RTARROW}{0x0400}{right arrow}
  \threecolrule{HSLIDE}{0x0800}{horizotal slider}
\enddefines

\routines {\bf evnt\_mesag}(), {\bf evnt\_multi}()

\begindefines
  \threecolrule{Define}{Value}{Message}
  \noalign{\hrule}
  \threecolrule{MN\_SELECTED}{10}{drop down menue sel.}
  \threecolrule{WM\_REDRAW}{20}{window needs redraw}
  \threecolrule{WM\_TOPPED}{21}{make window current}
  \threecolrule{WM\_CLOSED}{22}{window closed}
  \threecolrule{WM\_FULLED}{23}{window to full size}
  \threecolrule{WM\_ARROWED}{24}{arrow message}
  \threecolrule{WM\_HSLID}{25}{horiz. slider moved}
  \threecolrule{WM\_VSLID}{26}{vert. slider moved}
  \threecolrule{WM\_SIZED}{27}{window size changed}
  \threecolrule{WM\_MOVED}{28}{window moved}
  \threecolrule{WM\_NEWTOP}{29}{window activated}
  \threecolrule{AC\_OPEN}{40}{accessory selected}
  \threecolrule{AC\_CLOSE}{41}{accessory closed}
\enddefines
\smallskip

\begindefines
  \threecolrule{Define}{Value}{Arrow Message}
  \noalign{\hrule}
  \threecolrule{WA\_UPPAGE}{0}{page up}
  \threecolrule{WA\_DNPAGE}{1}{page down}
  \threecolrule{WA\_UPLINE}{2}{line up}
  \threecolrule{WA\_DNLINE}{3}{line down}
  \threecolrule{WA\_LFPAGE}{4}{page left}
  \threecolrule{WA\_RTPAGE}{5}{page right}
  \threecolrule{WA\_LFLINE}{6}{column left}
  \threecolrule{WA\_RTLINE}{7}{column right}
\enddefines

\routines {\bf wind\_set}()

\nobreak
\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{WF\_NAME}{2}{set window name}
  \threecolrule{WF\_INFO}{3}{set info line}
  \threecolrule{WF\_CURRXYWH}{5}{set window size}
  \threecolrule{WF\_HSLIDE}{8}{set horiz. slider pos.}
  \threecolrule{WF\_VSLIDE}{9}{set vert. slider pos.}
  \threecolrule{WF\_TOP}{10}{make window current}
  \threecolrule{WF\_NEWDESK}{14}{new default object tree}
  \threecolrule{WF\_HSLSIZE}{15}{set size of horiz. slider}
  \threecolrule{WF\_VSLSIZE}{16}{set size of vert. slider}
\enddefines

\routines {\bf wind\_get}()

\nobreak
\begindefines
  \threecolrule{Define}{Value}{Arrow Message}
  \noalign{\hrule}
  \threecolrule{WF\_KIND}{1}{reserved}
  \threecolrule{WF\_WORKXYWH}{4}{calc. window work area}
  \threecolrule{WF\_CURRXYWH}{5}{calc. compl. window sz}
  \threecolrule{WF\_PREVXYWH}{6}{calc. prev. window sz}
  \threecolrule{WF\_FULLXYWH}{7}{calc. max. window size}
  \threecolrule{WF\_HSLIDE}{8}{get horiz. slider pos.}
  \threecolrule{WF\_VSLIDE}{9}{get vert. slider pos.}
  \threecolrule{WF\_TOP}{10}{handle of top window}
  \threecolrule{WF\_FIRSTXYWH}{11}{get first rectangle}
  \threecolrule{WF\_NEXTXYWH}{12}{get next rectangle}
  \threecolrule{WF\_RESVD}{13}{reserved}
  \threecolrule{WF\_HSLSIZE}{15}{get horiz. slider size}
  \threecolrule{WF\_VSLSIZE}{16}{get vert. slider size}
  \threecolrule{WF\_SCREEN}{17}{addr. of internal buffer}
\enddefines

\routines {\bf wind\_update}()

\nobreak
\begindefines
  \threecolrule{Define}{Value}{Type}
  \noalign{\hrule}
  \threecolrule{END\_UPDATE}{0}{screen redraw ready}
  \threecolrule{BEG\_UPDATE}{1}{begin of screen redraw}
  \threecolrule{END\_MCTRL}{2}{}
  \threecolrule{BEG\_MCTRL}{3}{}
\enddefines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Form\_Dial Opcodes}

\routines {\bf form\_dial}()

\#include \<gemfast.h>

\begindefines
  \threecolrule{Define}{Value}{Meaning}
  \noalign{\hrule}
  \threecolrule{FMD\_START}{0}{reserve area for dial. box}
  \threecolrule{FMD\_GROW}{1}{draw growing rectangle}
  \threecolrule{FMD\_SHRINK}{2}{draw shrinking rectangle}
  \threecolrule{FMD\_FINISH}{3}{release area}
\enddefines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Resource Structure Defs}

\routines {\bf rsrc\_gaddr}(), {\bf rsrc\_saddr}()

\#include \<gemfast.h>

\begindefines
  \threecolrule{Define}{Value}{Type}
  \noalign{\hrule}
  \threecolrule{R\_TREE}{0}{ptr to object tree}
  \threecolrule{R\_OBJECT}{1}{ptr to object struct}
  \threecolrule{R\_TEDINFO}{2}{ptr to text object}
  \threecolrule{R\_ICONBLK}{3}{ptr to icon}
  \threecolrule{R\_BITBLK}{4}{ptr to BITBLK}
  \threecolrule{R\_STRING}{5}{ptr to string}
  \threecolrule{R\_IMAGEDATA}{6}{ptr to image}
  \threecolrule{R\_OBSPEC}{7}{ptr to TEDINFO struct}
  \threecolrule{R\_TEPTEXT}{8}{ptr to text}
  \threecolrule{R\_TEPTMPLT}{9}{ptr to text mask}
  \threecolrule{R\_TEPVALID}{10}{ptr to text template}
  \threecolrule{R\_IBPMASK}{11}{ptr to icon mask}
  \threecolrule{R\_IBPDATA}{12}{ptr to icon data}
  \threecolrule{R\_IBPTEXT}{13}{ptr to icon text}
  \threecolrule{R\_BIPDATA}{14}{ptr to bit pattern}
  \threecolrule{R\_FRSTR}{15}{addr. of ptr to free string}
  \threecolrule{R\_FRIMG}{16}{addr. of ptr to free image}
\enddefines

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{GEM Meta File Format}

\routines {\bf v\_meta\_extents}(), {\bf vm\_page\-size}(), {\bf
vm\_\-co\-ords}() 

\strucindent=.39\hsize
\beginstructure{typedef struct \bf metaheader}
  \struc short mf\_header;{-1 (0xffff)}
  \struc short mf\_hlength;{length of header (24)}
  \struc short mf\_version;{version number (usually 101 or 301)}
  \struc short mf\_ndcrcfl;{NDC/RC flag (0 or 2)}
  \struc short mf\_extents[4];{set with {\bf v\_meta\_extents}()}
  \struc short mf\_pagesz[2];{pagesize in 1/10 mm}
  \struc short mf\_coords[4];{coordinate system}
  \struc short mf\_imgflag;{$\ne$0, if bit image}
  \struc short mf\_resvd[9];{unused}
\endstructure{\bf METAHDR}\defaultstrucindent

All values in metafiles are in Intel format (Little Endian).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{GEM IMG File Format}

\strucindent=.39\hsize
\beginstructure{typedef struct \bf imgheader}
  \struc short im\_version;{version number (usually 1)}
  \struc short im\_headlength;{length of header}
  \struc short im\_nplanes;{number of planes}
  \struc short im\_patlen;{no. of bytes for ``pattern run''}
  \struc short im\_pixwidth;{width of pixel (mm/1000)}
  \struc short im\_pixheight;{height of pixel (mm/1000)}
  \struc short im\_scanwidth;{width of ``scan-line'' in pixel}
  \struc short im\_nlines;{number of ``scan-lines''}
\endstructure{\bf IMGHEADER}\defaultstrucindent

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\section{Limits}
%
%\#include \<limits.h>
%
%\begindefines
%  \threecolrule{Define}{Value}{Meaning}
%  \noalign{\hrule}
%  \threecolrule{CHAR\_BIT}{8}{Bits in Storage Unit}
%  \threecolrule{CHAR\_MAX}{127}{Max.~Char}
%  \threecolrule{CHAR\_MIN}{-128}{Min.~Char}
%  \threecolrule{SCHAR\_MAX}{127}{Max.~Signed Char}
%  \threecolrule{SCHAR\_MIN}{-128}{Min.~Signed Char}
%  \threecolrule{UCHAR\_MAX}{255}{Max.~Unsign.~Char}
%  \threecolrule{SHRT\_MAX}{32767}{Max.~Short}
%  \threecolrule{SHRT\_MIN}{-32768}{Min.~Short}
%  \threecolrule{LONG\_MAX}{2147483647L}{Max.~Long}
%  \threecolrule{LONG\_MIN}{-2147483648L)}{Min.~Long}
%  \threecolrule{USHRT\_MAX}{65535U}{Max.~Unsign.~Short}
%  \threecolrule{ULONG\_MAX}{4294967295UL}{Max.~Unsign.~Long}
%  \threecolrule{\#if \_\_MSHORT\_\_}{}{16 bit ints}
%  \threecolrule{INT\_MAX}{SHRT\_MAX}{Max.~Int}
%  \threecolrule{INT\_MIN}{SHRT\_MIN}{Min.~Int}
%  \threecolrule{UINT\_MAX}{USHRT\_MAX}{Max.~Unsign.~Int}
%  \threecolrule{\#else}{}{32 bit ints}
%  \threecolrule{INT\_MAX}{2147483647}{Max.~Int}
%  \threecolrule{INT\_MIN}{-2147483648}{Min.~Int}
%  \threecolrule{UINT\_MAX}{4294967295U}{Max.~Unsign.~Int}
%  \threecolrule{\#endif}{}{}
%\enddefines

\copyrightnotice

\bye

% Local variables:
% auto-save-interval: 1024
% eval: (require 'gin-mode)
% eval: (gin-mode 1)
% eval: (auto-fill-mode 1)
% compile-command: "plain varcard"
% End:
