Advanced System Programmers Guide For The Amiga
Advanced System Programmers Guide For The Amiga
Programmer's Guide
for the Amiga
Bleek
Jennrich
Schulz
AbaCUS.
F~tPrinting,Novemberl989
Printed in U.S.A.
Copyright 1988, 1989
Abacus
5370 52nd Street SE
Grand Rapids, MI 49512
Copyright 1988
This book is copyrighted. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, electronic, mechanical, photocopying,
recording or otherwise without the prior written permission of Abacus or Data Becker,
GmbH.
Every effort has been made to ensure complete and accurate information concerning the
material presented in this book. However, Abacus Software can neither guarantee nor be
held legally responsible for any mistakes in printing or faulty instructions contained in this
book. The authors always appreciate receiving notice of any errors or misprints.
AmigaBASIC and MS-DOS are trademarks or registered trademarks of Microsoft
Corporation. Amiga 500, Amiga 1000, Amiga 2000, Graphicraft, Musicraft, Sidecar and
Textcraft are trademarks or registered trademarks of Commodore-Amiga Inc. K-Seka
assembler is a registered trademark of Kuma Corporation.
ISBN'
ii
1-55755-047-6
Foreword
This book is written by programmers for programmers. Although
technical books are usually difficult to understand and very practical,
this book is different. Amiga Advanced System Programmers
Guide is similiar to working with the Abacus book Amiga C for
Advanced Programmers. We have tried to write a book that helps
the programmer with programming but doesn't contain too much
theory. Our goal was to provide information about large subjects with
many example programs.
We wrote this book with more information than any other book on this
subject. This book contains complete information about the parameter
statements in programs through the CLI and the WOrkbench, about all
of the devices of the Amiga, complete with example programs, about
the IFF format from Electronic Arts, and about the basic structures of
the Amiga operating system.
Bruno lennrich spent three months working with all of the devices and
thoroughly documented them so that anyone can begin to use them.
Wolf-Gideon Bleek concentrated on the parameter transfer and collected
information on programming style. So, you as a programmer can not
only program, but also develop a good programming style. He also
worked with Intuition and placed all of the information from
Preferepces together.
Peter Schulz explained the complicated keymaps and math libraries in
simple terms. This has made calculations, even with complicated
functions, much simpler.
All of the authors contributed to the documentation of all of the
libraries and the IFF format, with each writing about the library and the
format that he knows best
You should have a complete collection of information when this book
is used in conjunction with a reference book. So this book should
always be next to your computer.
(
iii
Table of Contents
Forewad ...............................................................iii
1.
Introduction ........................................... .. .. . .. . . .. .. .. .. .. . .. 1
2.
2.1
2.2
2.3
2.4
2.5
3.
3.1
3.2
Data Transfer............................................................... 19
CLI arguments ............................................................20
The .info file ...............................................................25
4.
4.1
4.2
4.3
4.3.1
4.3.2
4.3.3
4.3.4
4.3.5
4.3.6
4.3.7
4.4
4.4.1
4.4.2
4.4.3
4.4.4
4.4.5
4.4.6
4.4.7
4.5
4.5.1
4.5.2
4.5.3
4.5.4
4.5.5
4.5.6
4.6
4.6.1
4.6.2
4.6.3
4.6.4
4.7
4.7.1
4.7.2
4.7.3
4.8
4.8.1
4.8.2
4.8.3
4.9
4.9.1
4.9.2
4.9.2.1
4.9.2.2
4.10
4.11
4.11.1
4.11.2
4.11.3
4.11.4
4.11.5
4.12
4.13
4.14
4.14.1
4.14.2
4.14.3
4.14.4
4.14.5
4.14.6
4.14.7
5.
5.1
5.1.1
5.1.2
5.1.3
5.1.4
6.
6.1
6.1.1
6.1.2
vi
6.1.3
6.1.4
6.1.5
6.1.6
6.1.7
6.1.8
6.1.9
6.1.10
6.1.11
6.1.12
6.2
6.2.1
6.2.2
6.2.3
6.2.4
6.2.5
6.2.6
6.2.7
6.3
6.3.1.
6.3.2
6.3.3
6.3.4
6.3.5
6.3.6
6.3.7
6.3 8
6.3.9
6.4
6.4.1
6.4.2
6.4.3
6.5
6.5.1.
6.5.2
6.5.3
6.5.4
6.5.5
6.6
6.6.1
6.6.2
6.6.3
6.6.4
6.6.5.
6.6.6
6.6.7
vii
6.6.8
6.6.9
6.7
6.8
6.8.1
6.8.2
6.8.3
6.8.4
6.9
6.10
6.11
6.12
6.13
6.14
7.
7.1
7.1.1
7.1.2
7.2
7.2.1
7.2.1.1
7.2.1.2
7.2.1.3
7.2.2
7.3
7.3.1
7.3.2
7.4
Appendix A
AppendixB
viii
1.
ABACUS
1.
INTRoDUCTION
Introduction
Advanced System Programmer's Guide-an impressive title. The name
Amiga Advanced System Programmer's Guide tells you exactly what
you get: Information about the Amiga operating system, how the
system routines function, which of these functions are executable by
you, and how the hardware works. This book looks at the Amiga
system from an expanded viewpoint.
Chapter 2 of the Amiga Advanced System Programmer's Guide
discusses programming style. This chapter builds a base for good style
in program development. It thoroughly explains the division, organization and composition of a program. It describes the anatomy of the
version number, how to call libraries and how to document your
program clearly so that it can be understood by others.
Chapter 3 contains a description of the arguments which appear at the
beginning of a program. This explains how to read values that are
entered in the CLI, as well as arguments entered through the
Workbench. Most commercial Amiga applications use Workbench
access instead of the CLI. This chapter also shows which functions are
read by the . in f 0 structures, and shows you how to set the
corresponding routine at the beginning of a program. This chapter also
shows the two ways to start a program: From the CLI and from the
Worlcbench.
Chapter 4 describes all the Amiga devices available. Devices execute all
data exchanges between external or simulated internal devices, this book
describes device usage in detail. You'll find explanations for each
device's mode and command, as well as demonstration programs. With
the help of this book, you can address the Amiga's output and input
devices correctly with a minimum of hassle.
Chapter 5 discusses Interchange File Format (IFF), in simple ILBM
format as well as the more complex music and text formats. You'll find
lists and tables for the music and text formats. Chapter 5 concludes
with an explanation of the Anim format from Aegis. This represents a
complex mixture of ILBM data and the Anim format's own chunks.
Chapter 6 comprises the bulk of this Guide. Here you fmd descriptions
of the Amiga library functions, along with documentation for each
library. This documentation can be used by both assembly language and
C programmers. In addition to general syntax and arguments, each
1. INTRODUCTION
You need information about the function which closes a window, but
you can't remember the function's name. You know that it's part of the
Intuition library, since Intuition controls all windows. You'd take the
following steps:
1.
Check the table of contents for the fIrst page of the Intuition
library chapter. This chapter contains a listing of Intuition
functions.
2.
3.
ABACUS
2.
2.
Good Programming
Style
We live together on this planet under many rules and conventions.
There are conventions of dress, language, and more. Many of these
standards are basic, common sense rules. For example, most states
consider driving through a red light illegal.
Communicating with a computer must be done under certain rules as
well. There are more obvious rules you should follow in programming
(e.g., don't hit the Amiga when the system crashes). However, some
smaller conventions are very valuable to the user and developer alike.
Think about the Amiga's graphic user interface, Intuition. Certain icons
represent certain tools (applications) and projects (files run from
specific tools). Some icon designs have become standards, and it's best
to keep the standard icon design (e.g., AmigaBASIC projects).
This chapter looks at some helpful rules that you can follow in writing
elegant, stylish source code, as well as some hints for better program
development.
2.1
2.
for a few weeks and come back to it later. Without comments you have
no idea of what works when in the program. The only solution is to
analyze the program from the beginning and figure out what it does.
Comment programs carefully, for your own information as well as for
others who might study the program later.
Program header
You'll usually find information about the program's name, purpose,
author, last date of revision and other information in the program
header. Look at the following example, which was taken from the
Abacus book Amiga C for Advanced Programmers:
/***************************************
* Author:
*
* Wgb
*
Date:
Comments:
---------- ---------10/16/1987
first test
window
*
*
*
*
***************************************/
,*
*
'* Open window through Intuition *
'* ----------------------------- *
,*
*
, * Author : Wolf-Gideon Bleek
*
, * Date
: May 22, 1988
*
'* Greetings: Denis "Angle"
*
, * Version : 1.1
*
, * Operating system: VI. 2 & VI. 3 *
.*
*
'*********************************
ABACUS
Here we also find information about the program's version and the
operating system versions. Both values have different meanings. The
operating system version may dictate how the program must be
compiled. The values are important for BASIC programs because the
libraries must be loaded during program execution.
The greeting entry is optional; it can add a personal touch to the code.
If you wish to thank someone for their efforts in helping write a
program, the program header is the pJace to insert the note of thanks.
The version number of the program should be in the program text so
you can differentiate easily between two similar versions of a program
by looking at the version number. This number should also appear in
the program itself for the same reason. In other words, the version
number should appear twice: Once in the program header, and once in
the program itself so that the user can easily find it.
You should specify the operating system version. This is the only way
error free use can be guaranteed for the user. You can also use this to
recognize if the program uses features that are implemented with the
new version. For example, a program which is compatible with
Kickstart 1.1 cannot support an auto boot from the hard disk since
KickStart 1.1 does not support this feature. On the other hand, a
program will only be compatible with every Amiga if it correctly
accesses the operating system functions.
The number to the left of the decimal point represents the major
version. This number is a zero if the program is still in the
development phase (e.g., Version 0.1 for an early design). The first
fully functional program version appears as version 1.0.
The Y parameter represents the minor version number. The Y usually
begins at zero (e.g., version 1.0) and goes up to nine (e.g., version
1.9). The .Y parameter can also be notated in tenths or hundredths.
These smaller notations indicate lesser changes to a program such as
minor error corrections.
It is up to the programer to change the version number when updating
the program. The programmer must decide the extent of the version
2.1
ABACUS
1***************************************
*
* Function to erase an already
* existing Lexicon structure:
* FreeLexicon()
*
*
*
*
*
* Additions:
*
* - support of entries
*
* - select, i f saved
*
*
*
* Input parameters:
*
* Lexicon - pointer to best structure *
*
*
* Return parameters:
*
* none
*
*
*
* Date: April 3, 1988
*
* Author: Wolf-Gideon Bleek
*
* Greetings: Christian
*
*
*
***************************************/
The fIrSt lines of text in the function header clearly defme the function's
purpose. The third line of text states the C function's name. These
items are most important to the majority of programmers.
The Additions lines prove to be very useful in the development phases
of a function. Changes may be started during a programming session
and not completed at the end of that particular session. These additions
tell the programmer where development left off for the next session.
The input parameters specify any values needed by the function. C.
AmigaBASIC and other languages allow long parameter names. We
recommend that you use names that clearly describe the variable
whenever possible.
The return parameters describe the results of this routine. Functions
often have only one return parameter. if any. If a parameter name is
required. use names that clearly describe the variable.
The example above includes the date of completion. the author's name
and a personal greeting. This can be expanded as needed.
2.2
Version specifies the version number that your program needs. You can
fmd the version number by entering the AmigaDOS Version command
from the CLI. Stating a Version value of zero allows program access to
ABACUS
all the libraries, even those not normally accessible through command
words. The following line combines the opening and the error check
into one short routine:
IF (! (Library = OpenLibrary("LibName", Version))
exit (FALSE) ;
* ===================================== *
* Author:
* -----* Wgb
Date:
06/15/1988
Comments:
also memory
*
*
*
*
*
*****************************************/
Open_All ()
{
void
*OpenLibrary();
struct Window *OpenWindow();
if (!(IntuitionBase = (struct IntuitionBase *)
OpenLibrary ("intuition . library" , OL)))
{
2.
1*****************************************
* Author:
*
* Wgb
Date:
15.06.1988
Comments:
*
*
*
Intuition, Window *
Graphics 'Mem
*
*****************************************/
Close_All ()
{
if (FirstWindow)
if (IntuitionBase)
i f (GfxBase)
i f (UndoBuffer)
i f (FileBuffer)
)
10
C1oseWindow(FirstWindow);
CloseLibrary(IntuitionBase);
CloseLibrary(GfxBase);
FreeMem(UndoBuffer, 512L);
FreeMem(FileBuffer, 30L);
ABACUS
11
2.3
Assembly language
programming
Assembly language offers much more freedom in programming than
the C language. Assembly language code can be executed directly,
without the compiler and linker needed by C source codes. Higher level
languages and assembly language must be able to handle certain
services called registers. The Amiga's microprocessor has eight data
registers and seven address registers in addition to the address counter,
the two stack pointers and the status register.
All of these registers can be accessed from a program. However, there
are some rules that you must heed if you want to correctly use the
Amiga's operating system. Each library function assumes that you
know which register is used and which registers remain unused.
12
ABACUS
function. These registers work best for small data transfers and
calculations.
The dos.library uses the D2 and D3 registers constandy because of a
constant need for buffer memory. Keep these registers in mind when
accessing the dos.library from a program. In addition, notice that all of
the other registers called by the function are saved.
We wish to comment here about saving of registers. When you write
your own functions in your programs, state in the function header
which registers are saved and which are not saved. This makes it much
easier in later development. Hold to the library conventions of register
listing to avoid confusion.
Note:
13
2.4
DEVS
LIBS
SYS
RAM DISK:Env
RAM DISK:T
Workbench 1.3
Workbench 1.3
Workbench 1.3
Workbench 1.3
Workbench 1. 3
Workbench 1. 3
Workbench 1.3
Wgb:fonts
Wgb:S
Wgb:L
Wgb:c
Wgb: devs
Wgb: libs
Wgb:
14
The DFO: tells the system to look in the internal disk drive.
What about users who have two disk drives. and place the
Workbench disk in an external drive?
How can the user tell the program to look on the hard disk for
fonts?
ABACUS
You can see that this solution is not ideal. The Amiga's operating
system accesses the directory with the desired contents through the
abovementioned name. The Assign command allows you to assign
the fonts directory, but the program will still access the fonts directory,
whatever drive this directory is on.
The developer should know what exists in which directory. The
following list describes the contents of each system directory.
FONTS
OverlayCodeSegments.
15
DEVS
desired.
LIBS
SYS
16
2.S INTUITION
ABACUS
2.5
Intuition
A big factor in program development lies in writing for the end user.
Intuition offers us an alternative to using the Shell and UI for access.
Menus
Menus allow the user to select different items. We're going to look at
the menu display for now, instead of programming menus. No matter
how helpful the menus may be, poor presentation can ruin the menus.
Here are some rules to help you when developing menu routines.
Write out a list of all the menu titles and items you want to include in
the program. The menu line can contain up to ten menu titles, which
appear on the menu line when you press the right mouse key. Choose
menu titles carefully-make sure that these titles clearly explain the
items below the titles.
The menu titles should be placed starting with the most important (or
most used) title farthest to the left. The titles should decrease in
importance from left to right. Most often the left menu title is the File
menu title.
Shortcuts
Requesters
17
2.
Sketch out the way you want the requester to appear. The requester
must appear organized and clear. For example. a requester appearing to
confllDl execution of an important function (e.g. deleting a file) should
contain at least two gadgets to allow positive or negative feedback from
the user. A simple YES and NO gadget will serve this purpose. or even
OK and CANCEL.
Include a gadget for alternate selection in a requester. For the
abovementioned requester used to ConfllDl file deletion. you could have
a YES gadget. a NO gadget and even a BACKUP ONLY gadget to
allow the user to delete only the backup copy of the file.
Key response
Some gadgets let the user select a gadget from the keyboard instead of
the mouse. The keyboard is not supported from Intuition like the
menus. Intuition handles the keyboard as a gadget specifically assigned
to one of the gadgets in the requester.For example. BeckerText from
Abacus surrounds this gadget with a bold red border. When the user
presses the <Return> key while in an active requester. the reading
routine reads the <Return> key as the specified gadget.
Choose this keyboard actuated gadget carefully (e.g. do not make the
YES gadget of a Delete file requester accessible from the keyboard).
18
3.
ABACUS
3.
DATA TRANSFER
Data Transfer
Sometimes user interaction with a program begins before the program
even runs. This early interaction involves the entry of arguments
(parameters), which may not take effect immediately. For example, if
you enter the following from the CLI, the text editor ED loads into
memory, then a file loads into ED and appears on the screen:
ed filename
This same process can be used from the Workbench. You can move the
mouse pointer onto the icon of a text file created by a word processor
(e.g., BeckerText) and double-click on the text file icon. The word
processor loads first (assuming it is readily available), then the
operating system loads the selected file into the word processor.
Getting user
data
The programmer can use these two methods to get data from the user.
Some programs cannot operate without additional arguments. Many
Shell and CLI commands require arguments to operate correctly.
We've just seen how some programs require certain data to execute
correctly. This chapter views the transfer of data from two sources.
First we'll examine how the CLI accepts arguments from the user when
invoking a command. C programming for arguments is very simple,
thanks to the way the C compiler processes data. Then we'll see how
data is transferred by the Workbench.
19
3.
DATA TRANSFER
3.1
ell arguments
Many CLI commands require additional arguments. The syntax can
look something like this:
cli_command argument
The invoked CLI command reads and confirms the arguments, then
executes the command based on these arguments if possible.
Arguments
The main () function of the C language has two arguments that are
seldom used but are very helpful. The first argument specifies the
number of arguments needed. The second argument represents a pointer
to a string array into which all of the arguments are placed. The
following routine reads the input line, from which we can read the
individual entries.
1****************************************
====================================
* Inputsub.c
* Author: Date:
July 1988
Wgb
Comments:
Aztec Routine
*
*
*
*
*
*
*
*
*
*
*
****************************************/
*include <libraries/dosextens.h>
extern int argc, arg len;
extern char-** argv, *-arg lin;
_cli~rse(pp,-alen, aptr)struct Process *pp;
long alen;
register char *aptr;
{
20
==
'\f' II
ABACUS
cp++;
i f (*cp < ' ')
break;
if (*cp = ,n,)
I
cp++;
while (e = *cp++)
I
*aptr++ = e;
if (e = '''')
I
if (*ep == ,n,)
ep++;
else
I
aptr[-1) = 0;
break;
}
else
I
while(le=*cp++) "
e != '\x'
*aptx++ = e;
*aptr++ = 0;
&,
i f Ie =
0)
--ep;
*aptr = 0;
if argv= AllocMemlong) ( arge+1)*sizeof(* argv),OL)== 0)
1_arge = 0;
return;
}
_argv[e) = 0;
}
Program
description
The program takes the length of the input line from the CLI, then
allocates memory for the argument tables. When these are not present,
it means that no arguments were given in the command line. The
program name, spaces and arguments are then copied into the argument
table memory. This serves as the base for the following loop.
The loop checks the entire list for any separator characters (i.e., spaces,
tabs, form feeds, carriage returns and ends of lines). When the loop
fmds one of these characters, it determines how the characters are
handled, and whether a command character is found. If one of the
command characters is encountered, it is determined in many
comparisons which characters are handled or if a quotation mark is
21
3. DATA TRANSFER
encountered. This quotation mark tells the loop to look after the
quotation marlc for additional separators.
Quotation
marks
After this test, the loop treats the character suing between the quotes as
if no separating characters are found. Then the program loop places a
null byte after the text to end it This operation repeats until the entire
text has been checked. Then another memory function allocates new
memory for the pointer tables (more on this later). All of the pointers
to the individual texts are entered in this block of memory.
The last entry in the pointer table is set to zero to make the end
recognizable without number variables. To see how this routine wom,
here is a program that displays the number of parameters given as CLI
arguments, then lists all of the values in table form.
1***************************************
=====================
* DisplayClLc
* Author: Date:
Comrrents:
*
*
*
*
*
*
June.l988
only listing
Wgb
*
***************************************/
main (ArgC, ArgV)
int ArgC;
char *ArgV[]:
{
int i;
printf ("Number of arguments: !fsd\n", ArgC);
for (i=O; i<ArgC; i++)
printf("CLIArg !fsd: >!fss<\n", i, ArgV[i]);
}
Program
description
The main () function handles the ArgC and ArgV arguments. ArgC
(Argument Counter) represents a counter variable which contains the
total number of assigned arguments. The program name is considered
one of these arguments within the entire input line. This input line is
assigned to a text table. The program name can include a disk path, if
such a path is needed. Program names are included as arguments, even
when a program is started from the Workbench (more on this later).
ArgV (Argument Vector) is the pointer to the text table mentioned
previously. It is handled as a one-dimensional array of char elements
(characters). The routine created from the enuies of this table recognizes
spaces between two words as a break between two arguments. There
may be times when a space is required in a text (e.g., file name
instead of f i 1 e n a me). If you wish to read two words as one
argument, then the desired text must be placed within quotation marks.
For example:
22
ABACUS
Wrong:
Right:
Let's execute the program with some arguments. Enter the following:
DisplayCLI 1. DFO: Hello Wally
More about
quotation
marks
of
0:
1:
2:
3:
4:
arguments: 5
<DisplayCLI>
<1>.
<DFO:>
<Hello>
<Wally>
Argument
templates
23
3.
DATA TRANSFER
eLi
dir ?<Return>
Testing ror
argument
templates
Our own program should have the ability to test for a question mark. It
should also test for the proper number of arguments. If it detects an
incorrect number of arguments, the program should display an
appropriate error message.
The following program executes this task. We made this the main ()
function of the program. You may wish to follow this style in your
own programming.
1***************************************
* Program: Read CLI arguments
* ReadCLI.c
* Author: Date:
*
*
*
* =================================== *
* ------ ----------
* Wgb
06/20/1988
Comments:
***************************************1
iinclude <exec/types.h>
main (ArgC, Argv)
int ArgC;
UBYTE *Argv[ J;
{
int i;
i f (ArgC == 1)
printf("No parameters from the CLI!\n");
else
printf ("'lsd Parameter, that can be evaluated\n", ArgC-l);
if ArgC == 2) && (*Argv[l] == '?'
printf ("Format: 'Iss [ J [ J \n", ArgV [0]);
Program
description
24
ABACUS
3.2
Arguments
and the
Workbench
How can the user enter arguments in an application started from the
Workbench? Let's look at what happens when we start a program from
Workbench. The program receives information from a startup routine
determined by the main () function. This startup routine replaces the
argument table given by text entered in the CLI, while assigning values
from the Workbench. We'll now look more closely at these values.
The frrst data received is a list of files apd locks available to this
program. The files refer to a list of files invoked when you double-click
a program icon. The locks are pointers to the direcUXies, supplying the
program with pure filenames. Look at the following program:
1***************************************
======================
*
*
*
* WBMessage.c
* Author: Date:
Cormnents:
*
*
* Wgb
*
*
*
* ------
06/20/1988
*
*
***************************************1
'include <exec/types.h>
'include <workbench/startup.h>
'include <stdio.h>
extern struct WBStartup ~nchMsg;
main 0
{
int i;
struct WBArg *Arg;
for (i=O, Arg=WBenchMsg->sm_ArgList; i<WBenchMsg->sm_NumArgs;
i++, Arg++)
printf(WWBArg %d: Lock=Ox%lx Name = %s\nn,
i, Arg->wa_Lock, Arg->wa_Name);
printf(ttPRESS <Return> TO EXIT\nW);
Delay (5*60L);
}
25
3.
DATA TRANSFER
Program
description
This program assumes that it was started from the Workbench. Later
you will see an example of a program that can be started either from the
CLIor the Workbench. It displays the message WBenchMsg, which
contains all of the applicable filenames and corresponding locks. These
are listed in table format in the for () loop.
Compile and link the program, then assign it a tool icon. Once you've
done that, we can begin experimenting. Open the Workbench screen and
select the icon of this program. Select the Workbench function Info
item from the Workbench menu. The Tool Types string gadget
should contain the following:
WINDOW=CON:0/0/600/80/TestWindow
======================================-=
* ReadToolTypes.c
* Author: Date:
Conments:
* ------
* Wgb
*
*
July 1988
Aztecs Routine
*
*
*
*
*******************************************/
iinclude <libraries/dosextens.h>
iinclude <workbench/workhench.h>
iinclude <workbench/startup.h>
iinclude <workhench/icon.h>
void *IconBase = 0;
_wb-parse(pp, wbrn)
register struct Process *pp;
struct WBStartup *wbrn;
(
26
(wind 2);
fhp->fh_Type;
wind;
_Open("*", MODE_OLDFlLE);
ABACUS
FreeDiskObject(dop);
closeit:
CloseLibrary(IconBase);
IconBase ,;. 0;
}
Program.
description
Click on this gadget and delete this text. Enter the following in its
place:
DFO: WSMessage
More-about
Tools and
Projects
\5\n",
27
3. DATA TRANSFER
if
s=
Compile and link the source, then assign it an icon. Click on the
Notepad text you created in the last example and select the
Duplicate item from the Workbench menu. Press the <Shift>
key and click on both Notepad text icons. Now double-click the
program icon. We get a longer list with more locks and filenames.
What sense does it make to use all of the filenames? Each filename
looks to the data in the .info file. We can read this data, examine it and
even process it
The Get Dis k 0 b j e c t () function. which lies within the
icon . library reads the data from the jnfo file. We can set a new
current directory using the lock, then read the .info file:. Look at the
following program code:
1***************************************
=====================
* ListToolTypes.C
* Author: Date:
*
*
*
Comments:
*
*
*
*
*
06/20/1988
Access to .info *
file only
*
* Compile options
*
*
* cc +L listtooltypes.c
*
* In listtooltypes.o -lc32
Wgb
***************************************/
finclude <exec/types.h>
finclude <workbench/workbench.h>
finclude <workbench/startup.h>
'include <workbench/icon.h>
'include <stdio.h>
extern struct WBStartup *WBenchMsg;
extern struct IconBase *IconBase;
void
*OpenLibrary ();
main 0
{
int i, j;
char **ToolArray, *Value;
LONG OldDir;
struct DiskObject *Lock;
struct WBArg *Arg;
if (! (IconBase = (struct IconBase *)
OpenLibrary("icon.library", OL)
printf(-Library not received!\n");
exit (FALSE);
}
28
ABACUS
else
(
FreeDiskObject(Lock);
)
CurrentDir(OldDir);
)
)
printf("\nWAIT A MOMENT!\nR);
CloseLibrary(IconBase);
Delay(5*60L);
}
Program
description
All this routine does is release the DiskObject and then return to the
current directory. When we first access the text array contained in
Tool Types, we can see which values were assigned. Now let's
replace the display routine:
ToolArray = Lock->do ToolTypes;
j = 0;
cb
Create multiple ToolTypes in an .info flle for the next test Mter
saving, compiling and linking, return to the Workbench. Click on one
of the Notepad texts and select the Info item from the Workbench
menu. Click on the Tool Types suing gadget. Tool Type s are
entered in the following manner:
TYPE = FIAGS
29
3. DATA TRANSFER
Flags
* ;================================== *
*
Comments:
*
* -----*
* EvalToolTypes.c
* Author: Date:
* Wgb
06/20/1988
tests FlLETYFE
*
*
*
*
***************************************/
'include <exec/types.h>
'include <workbench/workbench.h>
'include <workbench/startup.h>
Unclude <workbench/icon.h>
'include <stdio.h>
extern struct WBStartup *WBenchMsg;
extern struct IconBase *IconBase;
void
*OpenLibrary () ;
main()
{
int i, j, Test;
char **ToolArray, *Value;
LONG OldDir;
struct DiskObject *Lock;
30
3.2
ABACUS
else
{
else
printf ("ToolType FlLETYFE is not present! \n");
}
FreeDiskObject(Lock);
}
CurrentDir(OldDir);
}
printf("\nWAIT A MOMENT!\n");
CloseLibrary(IconBase);
Delay(5*60L);
}
The above program doesn't fulfill the set provisions, since it is only a
short demo. Adding these features to your own programs would make
using the Amiga much simpler for the user. The last example program
makes the connection between CLI checks and .info fIle evaluations. It
allows the user the possibility to set three flags: a(dd), p(rint) and
i(nsert). This can occur through the CLI with a preceding hyphen (-a,
-p. -io), or through the .info fIle (entering ADD, PRINT and INSERT
next to the FLAGS keyword). Here's the listing:
31
3.
DATA TRANSFER
/****************************************
* --------------------- *
FlAGS.C
* Author:
06/20/1988
*Wgb
*
*
Comment sa
Date:
*
*
-a -p -i
*
FLAGS*
ADD IPRINT I INSERT *
***************************************/
'include <exec/types.h>
linclude <workbench/workbench.h>
'include <workbench/startup.h>
'include <workbench/icon.h>
linclude <stdio.h>
extern struct WBStartup *WBenchMsg;
extern struct lconBase *IconBase;
void
*OpenLibrary ();
main (ArgC, Arq'J)
int ArgC;
UBYTE *Arq'J[];
{
int i, j;
int TestA = 0, TestP = 0, TestI
char **ToolArray, *Value;
LONG OldDir;
struct DiskObject *Lock;
struct WBArg *Arg;
0;
1**********************************
~e=====
* Author: Date:
*
* Wgb
__ ===_z=_ **
*
COlI'I!Ients:
---------- *
06/20/1988 -a -p -i
*
**********************************1
i f (ArgC > 0)
{
if (*ArgV[i] == (UBYTE)'-')
{
i f (* (Arq'J[ij +1)
if (* (ArgV[ij +1)
i f (* (ArgV[ij +1)
else
1****************************************
*
* =--======-:_-========-=======-=- *
*
*
* Author:
Date:
COlI'I!Ients:
*
---------------- *
* Wgb
06/20/1988 ADD I PRINT I INSERT *
****************************************1
32
ABACUS
i f (! (IconBase -
(struct IconBase *)
OpenLibrary(Wicon.library-, OL)))
else
(
FreeDiskObject(Lock);
}
CurrentOir(OldDir);
}
}
printf(n\nKAIT A MOMENT!\n"):
CloseLibrary(IconBase):
1* Delay(5*60L): *1
}
Program
description
ends.
33
3. DATA TRANSFER
Program info
2.
3.
There is no info for a program if this is not clicked! That can be found
out if the lock = O.
Sequence of ToolTypes:
34
1.
2.
3.
ABACUS
Example
notepad
topaz. 8
0,0,50,50
NOGLOBAL
Name
NOGLOBAL
GLOBAL
NOWRAP
WRAP
NOFONTS
FORMFEED
DRAFT
Meaning
Meaning
(_.
Notepad text
Global font
Window coordinates
Set flags
Notepad nags:
Disables global font function
Enables global font fWlction
Disables word wrap
Enables word wrap
No font table loaded \.
Enables form feed
Enables normal printing
35
ABACUS
4.
Devices
You've probably heard the word device used by other Amiga
programmers. Some of the source codes in this book access devices.
This chapter will help you understand the purpose and practical
application of devices.
4.1
OpenLibrary ()
OpenDevice ()
The structure controlling the device (in this case, the internal disk drive)
is an IORequest structure:
37
4. DEVICES
Offsets
0 OxOO
20 Oxl4
24 OxlS
28 Oxlc
30 Oxle
31 Oxlf
32 Ox20
struct IORequest
{ /* defined in "exec/io.h" */
struct Message io_Message;
struct Dev~ce *io Device;
struct unit
*io-Unit;
UWORD
io-Command;
UBYTE
io Flags;
BYTE
io-Error;
/* 32 == NumBytes of-this structure */
(
:IORequest
Device initialization
We already mentioned that the device structures must be initialized
before use, unlike the libraries. This is done using the Exec support
function CreatExtIO (). "Exec support function" means that this
function is not based in a system library. Instead, it can be found in the
linker library for your compiler (c .lib for Aztec C or amiga .lib
for Lattice C). Here's a simple example of how CreatExtIO ()
works:
/**********************************************************/
/*
CreateExtIO ()
(Exec support) * /
/*
*/
/* Function:
Create device block
*/
/*--------------------------------------------------------*/
/* IOReplyPort: MsgPort for WaitIO() etc.
*/
/* Size:
Size of the device block
*/
/**********************************************************/
38
ABACUS
Common ground
All of the device request structures or device blocks have one thing in
common: The first element is an IORequest sttucture. This means
that all of the different device blocks can be handled the same from
Crea teExt IO ( ) . The difference fll"St appears aft.er the first few bytes
of the IORequest structure. Let's look at the IOAudio sttucture
(the audio device block):
struct IOAudio
{
= (struct lOAudio *)
i f (OWnlOAudio
This sample call shows the purpose of the sizeof parameter for
CreateExtIO (). It gives the size of the I/O blocks to be allocated.
IOReplyPort
39
4. DEVICES
pm. Message ports are needed for message reportS. They act as anchor
points for the devices. They hold reports to the system just as an
anchor holds a ship to the bottom of the sea. These ports must be
initialized before they can be used:
struct MsgPort *AnyOldPort;
AnyOldPort = Cstruct MsqPort *)
CreatePortC"anyold.port", 0);
if (anyoldport == 0) Closelt("CreatePort() - Error n ) ;
Freesignal(SignaIBit);
return (NULL) ;
1* no memory *1
Port->mp Node.ln Name
Port->mp-Node.ln-pri
Port->mp-Node.ln-Type
Port->mp-Flags Port->mp=SigBit
Port->mp SigTask
1* Initial~zation *1
= Name;
= Priority;
=
=
=
=
NT MSGPORT;
PA-SIGNAL;
Si9naIBit;
FindTask(OI);
When using the devices the message ports generally have no name, so
the initialization of a message port can be done by using the following
sequence:
struct MsgPort *Port;
Port = (struct MsgPort *)CreatePort(OL, OL);
40
ABACUS
4.1
The three routines listed above give you the power to access any device.
Because the steps for opening a device are always the same. we'll now
list some universal routines for allocating and de-allocating device
blocks. for opening and closing devices:
1***************************************************** *****/
Device-Support Functions
*1
(c) Bruno Jennrich
*1
1*
1*
1*
1*
*1
June 8 1988
*/
/***************************************************** *****1
1***************************************************** *****/
1* Compile Info:
*1
/*--------------------------------------------------------*/
*/
1* cc Devs Support
*/
1***************************************************** *****/
'include "exec/types.h"
'include "exec/io.h"
'include "exec/devices.h"
VOID Closelt();
/* Closelt() exists
*/
/* in your own program */
VOID *CreatePort () ;
/* Exec-Support
*/
VOID *CreateExtIO () ;
VOID DeletePort () ;
VOID DeleteExtIO ();
1***************************************************** ******/
/*
GetDeviceBlock ()
*/
/*
*/
/* Function:
Device-Block open and initialization
*/
/*
/*---------------------------------------------------------*/
/* Input - Parameter:
*/
1*
1* Size:
*/
Size of the Device-Blocks in bytes
*/
/*---------------------------------------------------------*/
/* Return value:
*/
/*
*/
1*
Initialize Device-Block
*/
/***********************************************************/
1IPTR GetDeviceBlock (Size)
ULONG
Size;
(
41
4. DEVICES
*1
Device Port
(struct MsgPort *) CreatePort (0,0);
if (Device Port =- 0) CloseIt ("Couldn4t get DEVICE-PORT !");
1* Tries to allocate Device-Block. If that is not
*1
1* possible, give Device-Port back and leave
*1
1* program.
*1
Device Request a (APTR) CreateExtIO (Device_Port, Size);
i f (Device Request = 0)
{
DeletePort (Device Port) ;
CloseIt ("Couldn4t-get DEVICE-BLOCK !");
*1
1***********************************************************1
1*
FreeDeviceBlock ()
*I
1*
*1
1* Function:
Release Device-Block
*1
1*---------------------------------------------------------*1
1* Input - Parameter:
*1
1*
*1
1* IORequest: Release Device-Block
*1
1***********************************************************1
*1
*1
if (IORequest != 0)
{
1***********************************************************1
I*
Open
Device ()
*I
1*
- *1
1* Function:
Open any Device
*1
1*---------------------------------------------------------*1
1* Input - Parameter:
*1
1* Name:
Name the Devices (i.e. "audio.device") *1
I * Un! t :
Device-Uni t
*I
*1
*1
*1
*I
1***************************************************** ******/
UWORD Error;
1* Error from OpenDevice () *1
1* If Size> 0, allocate Device-Block.
*1
1* If Size == 0, use initialized device block*1
42
ABACUS
1* from user
if (Size != 0) *Device_Request
*1
GetDeviceBlock(Size);
1* Open Device *1
Error = OpenDevice (Name, Unit, *Device_Request, Flags);
if (Error ! = 0)
{
1* NOTE! !!
1*
*1
*1
1***************************************************** *******/
1*
*1
Close A Device
1*
*1
1* Function:
Device-Block free and close Device
*1
1*----------------------------------------------------------*1
1* Input - Parameter:
*1
1*
*1
1* IORequest:
Released Device-Block
*1
/************************************************************1
VOID Close A Device (IORequest)
struct IORequest
*IORequest;
{
*1
*1
*1
if (IORequest != 0)
{
if (IORequest->io_Message.mn_ReplyPort != 0)
DeletePort (IORequest->io Mess'age.mn ReplyPort) ;
if (IORequest->io Device != of
CloseDevice (IORequest);
DeleteExtIO (IORequest);
/***********************************************************/
1*
Do Command ()
*1
1*
1* Function:
Execute command
*1
*1
I*----------------------------------~----------------------*1
1* Input - Parameter:
1*
1* DeviceBlock: Device-Block
*1
*1
*1
1 * Command:
*1
corrnnand
1***************************************************** ******/
VOID Do Command (DeviceBlock,Command)
struct IORequest *DeviceBlock;
UWORD
Command;
(
DeviceBlock->io Command
DoIO(DeviceBlock);
Command;
Closing a device
'" them again with the help of these
You can open devices and then close
functions. You must close an open device when finished with it, just as
43
4. DEVICES
you must close a library. While programs and libraries may be used at
the same time, this is not possible with devices. The user can only
access one device at a time. For other users to obtain access, the devices
must be closed after they have been used. This happens through the
Exec support routines DeleteExt IO () and DeletePort () , as
well as the CloseDevice () command:
1***************************************************** ******/
/*
DeletePort ()
(Exec support) * /
/* Function:
Release port
*/
/*---------------------------------------------------------*/
/* Input parameters:
*/
/* IOReplyPort: Released port
*/
1***********************************************************1
VOID DeletePort(IOReplyPort)
struct MsgPort *IOReplyPort;
{
44
4.1
ABACUS
functions. This ensures that the device can be used from other programs
again.
The device to be closed is informed through ClaseDevice () over
the IORequest block, which contains a pointer to the opened device
(IORequest->ia_Device). This pointer extracts
ClaseDevice () itself and uses it for the closing. When you want to
use the routines from Devs_Suppart. you make a routine with the
name ClaseIt () available for use. This is always called when an
error is encountered while opening a device. You will encounter such
C 1 a s e I t () routines in this book. and we want you to have
confidence in the demands that this routine makes:
1*****************************************************/
/*
Close It ()
(User) */
/* Function: display encountered error.
*/
/*
Close everything.
*/
/*---------------------------------------------------*/
/* Input Parameters:
*/
/* String:
Error String
*/
1*****************************************************I
VOID Closelt(String)
char
*String;
{
UWORD Error
= 0;
UWORD i;
UWORD *dff180 = (UWORD *)Oxdff180;
if (strlen(String) > 0)
{
for(i=O;i<Oxffff;i++) *dff180 = i;
puts (String);
puts("\n");
Error = 100;
/* free-up routine */
exit(Error); /* leave program *1
Warning:
You should only use ClaseTt () as an "emergency exit" You should
never use ClaseIt () for convenience as the exit of the program,
which frees all of the structures for you. Rule of thumb: The routine
that allocates memory also releases memory.
4S
4.
DEVICES
4.2
device.
A device has many similarities to a library. When the device is opened,
IORequest->io_Device provides some routines for establishing
communication between program and device. This device library
contains the following commands and other data:
Command:
Offset:
Open
Close
Expunge
Extfunc
BeginIO
-Ox06
-OxOc
-Ox12
-OxIS
-Oxle
-Ox24
AbortIO
Open
Cl.ose
Expunge
If a device must be loaded from disk, the memory allocated for the
device structures is released by Expunge. Open and Close increment
and decrement the allocated amount. The occupied memory is not
completely released by Close. Expunge releases all memory once it
is called from the Exec function RemDevice ().
Extfunc
The Ext func routine is reserved for special tasks (e.g., printer device
DO_SPECIAL). The routines BeginIO and Abort IO are the
routines we are interested in:
Begin:rO
BeginIO initiates the data transfer between the program and the
device. After the device block is completely initialized (data pointer
adjusted, command given, etc.), this command is called from
SendIO () as well as from DolO () . The call looks like this:
46
4.1
ABACUS
BeqinIO:
move. 1
jmp
* Al contains *IORequest *
20(al), a6 * Device Library after A6 *
-$le(a6) * jump to BeqinIO
*
SendIO (IORequest) ;
WaitIO(IORequest);
47
4. DEVICES
Just stating the command does nothing. When you want to include
data, a data pointer and a variable supply the length or number of data
bytes to be transferred. The transfer of data is no longer possible with
the help of the simple IORequest structure. The IOStdReq
structure or a device specific structure (see IOAudio) must be used
instead:
Offsets
o
2D
24
28
30
31
32
36
40
44
48
struct
IOStdReq
OxOD
Oxl4
Oxl8
Oxlc
Oxle
Oxlf
Ox20
Ox24
Ox28
Ox2c
Ox30
48
Flag and error variables also appear in device blocks. You can control
the execution of a device command with the help of flag variables.
Because almost every device has its own flags, these flags can specify
when it is necessary to use the device. All devices have the
IOF _QUICK flag in common. This IOF _QUICK flag is set if a
command can be processed immediately. The read and write commands
of the ttackdisk.device, for example, go in a ttackdisk task. The
program that was called must wait for this command to be processed
with assistance from a message port. When reading disk status (e.g.,
ABACUS
write protect on), a set IOF_QUICK flag may not occur, since this
command is executed without the trackdisk task.
Error variables The error variable is of particular importance. If the error variable equals
zero after a device command. everything is running all right. When the
error variable contains a value other than zero, an error occurred. You
should react according to the severity of the error (e.g., a warning to the
user). Each device has its own errors.
The following errors are common to all devices:
Variable
Value Meaning
(-1) Device cannot be opened
IOE~ABORTED
(-2) Command interrupted by AbortIO ()
IOERR NOCMD
(-3) invalid command
IOERR BAD LENGTH (4)
io_Length has an invalid value
IOERR OPENFAIL
oovice.
Extended
commands
49
4. DEVICES
4.3
(1)
CMD READ
(2)
(3)
(6)
(7)
(8)
CMD
CMD
CMD
CMD
WRITE
STOP
START
FLUSH
4.3.1
sets parameters
fmds out port status
If another user opens the parallel device, you no longer have access.
Setting the PARB_SHARED flag (32) before you open the device
ensures that multiple users can access the parallel device at one time:
struct IOExtPar *ParReq = OL;
'define PAR_LEN (ULONG) sizeof(struct IOExtPar)
VOID *GetDeviceBlock();
ParReq = (struct IOExtPar*)GetDeviceBlock(PAR LEN);
ParReq->io ParFlags = (UBYTE) PARS SHARED;
Open_A_Device("parallel.device", OL, ParReq, OL, OL);
50
ABACUS
Problems with Transferring data from multiple programs to the parallel device can
sharing
cause problems. For example, texts sent from two different word
processors may run together through the device.
Now back to the Open_A_Device () command. You must assign
this address to a pointer to the device block (&ParReq-ParReq is
its pointer). The parallel device's device block looks like the following:
Offset
Structure
struct IoExtPar
{
0
48
52
53
54
62
4.3.2
Oxoo
0x30
0x32
Ox33
0x34
Ox3c
(Par_Support) *
*
*
*--------------------------------------------------------------*
* Input - Parameter:
* ParReq:
* Data:
* Len:
Device-Block
Date to be sent
number of bytes to be sent
*
*
*
****************************************************** *********1
VOID Parallel_Write (ParReq,Data,Len)
struct IOExtPar
*ParReq;
APTR
Data:
Len:
ULONG
{
ParReq->IOPar.io Data
= Data;
ParReq->IOPar.io-Length = Len;
Do_Cormland (ParR;q, (UWORD) CMD_WRITE):
If you give the value -1 for Len (the number of bytes to be written), the
parallel device writes data until it encounters a null byte. The parallel
device writes this null byte and stops writing data.
51
4.
DEVICES
4.3.3
*
*
*--------------------------------------------------------------*
* Input - Parameter:
* ParReq:
* Data:
* Len:
Device-Block
Data buffer
Number of bytes to be read
*
*
*
*
*
****************************************************** *********1
ParReq->IOPar.io Data
= Data;
ParReq->IOPar.io-Length = Len;
Do Command (ParReq, (UWORD) CMD_READ);
You can stop the character reading process using a defined character.
The IOPArray can contain the eight terminators:
Offset
Structure
struct IOPArray
o
4
8
OxOO
ULONG PTermArrayO;
Ox04
ULONG PTermArrayl;
Ox08}; /* defined in "devices/parallel.h" */
Terminators
52
ABACUS
1***************************************************** **********
*
Parallel_Setparams ()
(Par_Support) *
*
*
* Function: Change interface parameters
*
*--------------------------------------------------------------*
*
*
*
*
Input - Parameter:
ParReq:
Device-Block
Flags:
new Flags
TermArrayO/l: new terminators
*
*
*
***************************************************************/
VOID Paralell SetParams (ParReq,Flags,TermArrayO,TermArray1)
struct IOExtPar
*ParReq;
BYTE
Flags;
ULONG
TermArrayO;
ULONG
TermArray1;
{
4.3.4
IOPTF PSEL
1 (Printer Selected)
= 1: OFFLINE
= 0: ONLINE
Bit 1
IOPTF PAPEROUT
= 1:
= 0:
Bit 2
Bit 3
Bit 4-7
OK
PAPER OUT
IOPTF PBUSY = 4 (Printer busy)
= 1: Printer has nothing to do
= 0: Printer printed
IOPTF RKDIR = B (Direction (Read, Write
= 1: It was written
= 0: It was read
reserved
53
4.
DEVICES
Bits 0, 1, and 2 are active low. There is a 0 in the flag labeled Status.
PaperOut indicates that the flag IOTPF_PAPEROUT is not set
(these flags are defined in devices/parallel.h). You have
already seen that the parallel device is often assigned to an interfaced and
active printer. Basically, the above bits can be used for other devices
such as an EPROM burner. This status byte informs the computer that
the parallel device is not ready to begin processing the data it received
The following command sequence displays the status of the parallel
device:
Do Corrmand(ParReq, (UWORD)PDCMD_QUERY);
Status = ParReq->io_Status;
4.3.5
*
*
*
Par.c
(c) Bruno Jennrich
August 1988
(User)
*
*
*
***************************************************************/
1***************************************************** **********
* Compile-Info:
* cc Par.c
* In Par.o Par Support.o Devs Support.o -lc
*
*
***************************************************************/
iinclude "exec/types.h"
'include "exec!memory.h"
'include "exec/io.h"
'include "devices/parallel.h"
struct IOExtPar *ParReq = 01;
idefine PAR LEN (ULONG) sizeof (struct IOExtPar)
VOID *GetDeviceBlock();
1***************************************************** **********
*
*
* Function: If error, close all
*
*--------------------------------------------------------------*
Closelt()
(User)
* Input - Parameter:
* String: Error-Message
*
*
***************************************************************/
S4
ABACUS
char
*String;
m:lRD i;
UWORD *dff1BO = (m:lRD *)Oxdff1BO;
m:lRD Error = 0;
if (strlen (String) > 01)
{
for (i=O;i<Oxffff;i++)
puts (String);
Error = 10;
*dff1BO = i;
main ()
(User) *
***************************************************************/
main ()
{
The Selected pin (pin 13) of the Centronics port usually indicates
whether or not a printer is connected. If this pin still equals zero after
thirty seconds, the program aborts.
4.3.6
ParErr_DevBusy
ParErr_BufToBig
ParErr InvParam
ParErr LineErr
ParErr_NotOpen
55
4. DEVICES
4.3.7
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ASoo
STROBE
DataO
Datal
Data2
Data3
Data4
DataS
Data6
Data7
ACK
BUSY
POUT
SEL
+5v
NC
RESET
GND
GND
GND
GND
GND
GND
GND
GND
GND
A1000
DRDY
DataO
Datal
Data2
Data3
Data4
DataS
Data6
Data7
ACK
BUSY
POUT
SEL
GND
GND
GND
GND
GND
GND
GND
GND
GND
+5v
NC
RESET
A2000
STROBE
DataO
Datal
Data2
Data3
Data4
DataS
Data6
Data7
ACK
BUSY
POUT
SEL
+5v
NC
RESET
(Paper Out)
(Selected == OnLine)
GND
GND
GND
GND
GND
GND
GND
GND
GND
The Amiga 500 and 2000 require a DB25 male plug for connection to
their parallel ports.
Note:
56
ABACUS
4.4
Structure
struct lOExtSer
{
o
48
52
56
60
64
68
76
77
78
79
80
82
OxOO
Ox30
Ox34
Ox38
Ox3c
Ox40
Ox44
Ox4c
Ox4d
Ox4e
Ox4f
Ox50
Ox52
Notice the tenninator array (see Section 4.1). This array also consists
of eight bytes or two long words:
Offset
Structure
struct lOTArray
(
o Oxoo
4
8
Ox04
Ox08
ULONG TermArrayO;
ULONG TermArrayl;
/* defined in "devices/serial-h" */
MD RESET
(I)
CMD
CMD
CMD
CMD
CMD
(2)
(3)
(6)
(1)
(8)
READ
WRITE
STOP
START
FLUSH
57
4.
DEVICES
4.4.1
(9)
(10)
(11)
sets parameters
stops ttansfer
If another program already has access to the serial device, you won't be
able to access it at that time. The serial device offers the option of
sharing the device between users:
struct IOExtSer *SerReq = OL;
'define SER LEN (ULONG) sizeof(struct IOExtSer)
VOID *GetDeviceBlock();
SerReq = (struct IOExtSer *) GetDeviceBlock(SER LEN);
SerReq->io SerFlags = (UBYTE) SERB SHARED;
oPen A Device
(nserial.device n , OL, &SerReq, OL, OLl;
- -
4.4.2
58
Ser Support. c
August 1988
(c) Bruno Jennrich
*
*
*
*
*
ABACUS
****************************************************** *********1
iinclude "exec/types.h"
'include "exec/io.h"
iinclude "devices/serial.h"
1***************************************************************
*
* Function: Read data
Serial_Read 0
(Ser_Support) *
*
*--------------------------------------------------------------*
* Input - Parameter:
*
* SerReq: Device-Block
*
* Data: Data buffer
*
* Len:
Amount of data to be read
*
***************************************************************/
SerReq->IOSer.io_Data = Data;
SerReq->IOSer.io Length = Len;
Do_Corrmand (SerReq, (UWORD) CMD_READ);
}
1****************************************************** *********
*
Serial Write()
(Ser Support)*
* Function: Write data
*
*--------------------------------------------------------------*
* Input - Parameter:
*
* SerReq: Device-Block
*
* Data: Data to be written
*
* Len:
Amount of data to be written
*
***************************************************************/
SerReq->IOSer.io_Data = Data;
SerReq->IOSer.io Length = Len;
Do_Command (SerReq, (UWORD) CMD_WRlTE);
These two commands require the address of the data to be sent, or the
address of the buffer to which the data should be written, as well as the
number of bytes to be transferred. If you enter a value of -1 for Len,
the serial device writes data until it encounters a null byte. The serial
device writes this null byte and stops writing data.
When reading you must determine whether io_TermArray is used.
The serial device reads data until a character from the TermArray is
received. When the serial device encounters a null byte during reading,
the reading process stops.
Note:
S9
4.
DEVICES
4.4.3
Transfer
protocols
Serial uansfer reads and writes data one bit at a time. An error occmring
during this transfer is quite possible. In parallel uansfer (one byte at a
time instead of one bit at a time), the odds of errors increase eight
times. Serial ttansfer offers the programmer many different transfer
protocols. These protocols allow a "re-take" of anincorrecdy transferred
byte.
The serial device currently supports the XOn/XOff transfer protocol.
XOn/XOff is the default protocol (after OpenDevice ( unless the
SERB_XDISABLED bit (bit 7) is set (bit 7 = 128). It is turned off
when SerReq->io_SerFlags = SERB_XDISABLED. Control
characters, which allow control over XOn/XOff uansfer, are determined
by SerReq-> _io_CtlChar. Like TermArray, this element
consists of a ULONG which can read the ASCII codes from characters:
Bits 31-24 test the xOn character, and bits 23-16 detennine the XOff
character. Bits 15-8 should take the INQ character, while bits 7-0
should be used for the ACK character. The INQ and ACK (handshaking)
are not cwrendy supported by the serial device.
Bits
The number of bits per byte that you want to send or receive also
direcdy affect the transfer protocol. You have the option of sending 7 or
8 bits (SerReq->io_WriteLen) or receiving 7 or 8 bits
(SerReq->io_ReadLen). A stop bit follows the seventh or eight
bit This stop bit marks the end of the transferred value. Seven bits are
most often used to send and receive ASCII codes. The ASCII codes here
have the values 0 to Oxf. You can increase the number of stop bits to 2
to further ensure data security when you are sending seven bits.
(SerReq->io_StopBit = (BYTE) 2).
Baud rate
60
ABACUS
Break
When you want to interrupt the data transfer you rnust send a break
signal. The break signal ensures that all of the connections are set to
zero for a specific amount of tirne. The time that the connections
should be in the low condition can be specified in microseconds in
SerReq->io_BrkTime. The SDCMD_BREAK command sends the
break signal. You rnust be sure that the same parameters exist on both
the receiver's side and the sender's side, otherwise the transfer will not
interact.
Buffers
The Amiga also rnanages sorne software based parameters. The serial
device also controls one of the Arniga's own read buffers. Normally this
buffer is 512 bytes. If you need a larger buffer, you can specify the new
buffer length in SerReq->io_RBufLen. You rnust then execute
SDCMD SETPARAMS. First the new buffer is allocated and the data
that was previously stored in the old buffer is lost. All of the
parameters that were changed are first given to the serial device after
SDCMD SETPARAMS.
Terminators
It is the same with a change of the terminators. You sirnply specify the
eight (or less) new terminators that end a read command (Len = -1) and
set the EOFMODE flag in SerReq->io_SerFlag. The terminators
are used after SDCMD SETPARAMS. You should make sure that the
only parameter change during a read or write operation is the change to
the SERB_XDISABLED parameter. Any other changes abort transfer
with an error.
Flags
The serial device includes a set of flags that can control data transfer.
Here are the flags and what they do:
SERB PARTY_ON
(1):
SERB_PARTY_ODD
(2):
SERB 7WiRE
(4):
When set before OpenDevice (), seven-wire cornrnunication
becomes active. Normal data transfer uses three lines:
TXD (fRANSMIT DATA)
RXD (RECEIVE DATA)
GND (GROUND)
61
4. DEVICES
SERB_QUEUEDBRK
(8):
SERB_RAD_BOOGIE
(16):
SERB SHARED
(32):
Controls sharing the serial interface with other users. This flag can
only be set before OpenDevice (), or Open_A_Device ().
SERB EOFMODE
(64):
Controls io_TerrnArray and IORequest usage. Setting this flag
instructs the serial device to verify characters against io TerrnArray,
and instructs the serial device to end IORequest as soon as the device
detects and end of file character. This flag may be set without
SDCMD_SETPARAMS to activate and deactivate the established
terminators.
SERB XDISABLED
(128):
62
ABACUS
4.4.4
device:
Do_ Conrnand (SerReq,
Status
(UWORD) SDCMD_QUERY) ;
SerReq->io_Status;
= 0:
Bit 0
BUSY
no transfer
Paper out
Paper is present
ONLINE
OFFLINE
Data Set Ready
= 1: No data
= 0: Clear To Send
= 1: Not clear
= 0: Carrier Detect (carrier signal present)
= 1: No carrier
= 0: Ready To Send
= 1: Not ready
= 0: Data Terminal Ready
= 1: Not ready
= 1: Read Buffer Overrun (Read buffer full)
= 0: No overrun
= 1: Break Sent
= 0: No break
= 1: Break received
= 0: No break
= 1: Transmit XOFFed (xOff sent)
= 0: No XOFF
= 1: Received XOFFed (xOff received)
= 0: No XOFF
Unused
= 1:
= 0:
= 1:
= 0:
= 1:
= 0:
Bit 1
Bit 2
Bit 3
Bit 4
Bit 5
Bit 6
Bit 7
Bit 8
Bit 9
Bit 10
Bit 11
Bit 12
Bits 13-15
OVERRUN
WRITEBREAK
RFADBRFAK
XOFEWRITE
XOFFREAD
ACl'IVE
AOORT
(1)
(2)
(4)
(8)
(16)
(32)
(32)
63
4. DEVICES
(64)
IOSERF BUFRFAD
As you see, bit four (32) appeAlI's twice. This mayor may not be an
error, which makes it hard to determine which bit stands for which
condition. Avoid checking the iO_Flags variable, and go direcdy
over the SDCMD_QUERY and io_Status instead.
4.4.5
(5)
(6)
SerErr_ NotOpen
SerErr PortReset
SerErr_ParityErr
SerErr lnitErr
SerErr TineErr
SerErr_ BufOlTerflow
SerErr Nd)sr
SerErr NoCTS
SerErr DetectedBzeak
64
(7)
(8)
(9)
(10)
(11)
(12)
(13)
(14)
(15)
memory)
Parameter change not allowed
ABACUS
4.4.6
ASOO
Al000
A2000
GND
GND
GND
(Ground)
TXD
TXD
TXD
RXD
RXD
RXD
RTS
CTS
DSR
RTS
CTS
DSR
RTS
CTS
DSR
(Transmit Data)
(Receive DaIa)
(Request To Send)
(Clear To Send)
(Data Set Ready)
GND
GND
GND
DCD
DCD
DCD
+12v
-12v
AUDO
NC
+12v
-12v
AUDO
(GroInI)
(Data Ouriet Defect
--
---AUDI
-DTR
-RI
---
----
---
-Sv
AUOO
AUDI
EB
INI'2*
---
--
--
DTR
+Sv
+12v
C2*
RESB*
(Audio 0u1pUl)
(Audio 0u1pUl)
(Audio Input)
- - (716 KHz Takt)
AUDI (External interrupt [IRQ])
DTR
-RI
(Ring Indicator)
--
- - (3.SSMHz)
- - (But'fmoJd reset)
65
4.
DEVICES
ComDuter A
ColllDuter B
Pin
GND
TXD
RXD
GND
RXD
TXD
1
3
2
DCD
DCD
8
8
DTR
20
20
RTS
CTS
DSR
DTR
DCD
DSR
RTS
GND
GND
6
4
7
DCD
CTS
3
4
S
6
Connect pin 2 of one connector with pin 3 of the other connector, and
soon.
4.4.7
*
*
Ser.c
August 1988
(c) Bruno Jennrich
*
*
/***************************************************************
* Compile-Info:
*
* cc Ser
*
* In Ser.o Ser Support.o -Devs Support.o -lc
*
***************************************************************/
tinclude "exec/types.h"
iinclude "exec/io.h"
'include "devices/serial.h"
struct IOExtSer *SerReq;
tdefine SER_LEN (ULONG) sizeof (struct IOExtSer)
/***************************************************************
CloseIt()
(User) *
*
*--------------------------------------------------------------*
66
ABACUS
*
*
* String: Error-Message
***************************************************************/
UWORD i;
UWORD *dff180 = (UWORD *)Oxdff180;
UWORD Error = 0;
if (strlen (String) > 01)
{
for (i=O;i<Oxffff;i++)
puts (String);
Error = 10;
*dff180
i;
1***************************************************** **********
main ()
*
*--------------------------------------------------------------*
*
*
Input - Parameter:
*
*
****************************************************** *********1
main (argc,argv)
UWORD arge;
BYTE
*argv[];
(
BYTE Buffer(256);
Open_A_Deviee ("serial.device",Ol,&SerReq,Ol,SER_LEN);
i f (arge > 1)
{
Call the program with any command parameter (e.g., Ser x) on the
receiving Amiga. This Amiga waits until data is received. Remove the
disk from the drive and place it in the sending Amiga. Start the
program without command parameters (enter Ser) and watch the result:
The text sent appears on the receiving computer's screen.
67
4. DEVICES
4.5
Command
PRD_PRTCOMMAND (10)
Hardcopy
PRD_DUMPRPORT (11)
These three task regions of the printer device use three different device
blocks. The printer commands and hardcopy access have their own
special device blocks:
Offset
Structure
--------
0
20
24
28
30
31
32
34
35
36
37
38
OxOO
Ox14
Ox18
Oxlc
Oxle
Oxlf
Ox20
Ox22
Ox23
Ox24
Ox25
Ox26
Offset
PRO_PRTCOMMAND */
printer command *1
Parameter *1
*1
Structure
0
20
24
28
30
31
32
36
40
44
46
48
50
52
56
60
62
68
OxOO
Ox14
Ox18
Oxlc
Oxle
Oxlf
Ox20
Ox24
Ox28
Ox2c
Ox2e
Ox30
Ox32
Ox34
Ox38
Ox3c
Ox3e
struct Message
io_Message;
struct Device
*io Device;
struct Unit
*io=Unit;
UWORD
io Command;
1* PRO]RTCOMMANO *1
io -Flags;
UBYTE
BYTE
io=Error;
struct RastPort *io RastPort; 1* Graphic RastPort*1
struct ColorMap *io=colorMap; 1* color table */
ULONG
io_Modes;
1* ViewPort Modes *1
UWORD
io SrcX;
1* Start point *1
io-SrcY;
UWORD
UWORD
io-SrcWidth; 1* width *1
UWORD
io-SrcHeight;l* Height *1
LONG
io-DestCols; 1* print width *1
LONG
iO-DestRows; 1* print height *1
UWORD
iO-Special; 1* Special Flags */
1* defined in "devices/printer. h" */
ABACUS
The following routine allows open access to all three device blocks
through the Normal. DumpRastPort and Command pointers:
struct IODRPReq
*PrtPtr = OL; /* Dummy pointer */
struct IOStdReq
*Normal;
struct IODRPReq
*DumpRastPort;
struct IOPrtCmciReq *Command;
'define PRT LEN (ULONG) sizeof (struct IODRPReq)/*larger block*/
Open A Device ("printer. device", OL, &PrtPtr, OL, PRT_LEN);
Normil(struct IOStdReq *)PrtPtr;
DumpRastPort
(struct IODRPReq *)PrtPtr;
Command
= (struct IOPrtCmciReq *)PrtPtr;
4.5.1
Printer_RawWrite()
(Printer_Support) *
*
*
***************************************************************/
PrtReq->io Data
= Data;
PrtReq->io-Length = Len;
Do_command-(PrtReq, (UWORD) PRD_RAWWRITE);
4.5.2
69
4. DEVICES
Printer Escape
Sequences
Command
name
aRIS
aRIN
aIND
aNEL
aRI
Command
number
OL
IL
2L
3L
4L
aSGRO
aSGR3
aSGR23
aSGR4
aSGR24
aSGRl
aSGR22
aSFC
5L
6L
7L
8L
9L
lOL
llL
12L
aSBC
13L
aSHORPO
aSHORP2
aSHORPl
aSHORP3
aSHORP6
aSHORPS
aDEN6
aDENS
aDEN4
aDEN3
aDEN2
aDENt
aSUS2
aSUSt
aPLU
aPLD
14L
lSL
16L
t8L
19L
20L
21L
22L
23L
24L
2SL
26L
27L
28L
32L
33L
34L
3SL
36L
37L
38L
39L
40L
41L
aFNTO
aFNTl
aFNT2
aFNT3
aFNT4
aFNTS
aFNT6
aFNT7
70
Escape
Meaning
~uence
ESCc
ESC#l
ESCD
ESCE
ESCM
ESCIOm
ESC[3m
ESC[23m
ESC[4m
ESC[24m
ESC[lm
ESC[22m
ESC[30mESC139m
ESC[40mESC49m
ESCrOw
ESC[2w
ESC[1w
ESC13w
ESC[6w
ESqSw
ESCr6"z
ESC[S"z
ESC[4"z
ESCj3"z
ESC[2"z
ESCjl"z
ESC[2v
ESC[lv
ESCL
ESCK
ESCiB
ESCiR
ESC(K
ESC(A
ESC(E
ESCiH
ESC(Y
ESC(Z
Reset
Initializing
Linefeed
LF=CR+LF
Reverse linefeed
Normal character set
Italics on
Italics off
Underline on
Underline off
Boldon
Bold off
Set
foreground color
Set
background color
Normal type
Elite on
Elite off
Condensed off
Expandedprint on
Expanded print off
Shaded print on
ShadedJ:!int off
Double-strike on
Double-strike off
NLQon
NLQoff
Superscript on
Supersc~t off
Superscript (half step)
Subscript {half stejJl
US character set
French character set
German character set
English character set
Danish character set 1
Swedish character set
Italian character set
Spanish character set
4.5
ABACUS
Printer Escape
Sequences
Command
aFNT8
aFNT9
aFNTlO
aPROn
aPROPO
aTSS
aJFY5
aJFY7
aJFY6
aJFY3
aJFYI
aVERPO
aVERPI
aSLPP
aPERF
aPERFO
aLMS
aRMS
aTMS
aBMS
aS1BM
Command
number
42L
43L
44L
45L
47L
48L
49L
SOL
51L
53L
54L
55L
56L
57L
58L
59L
60L
61L
62L
63L
64L
aSLRM
65L
aCAM
aHTS
aVTS
a1BCO
a1BC3
a1BCI
a1BC4
a1BCALL
aTBSALL
aEXTEND
66L
67L
68L
69L
70L
71L
72L
73L
74L
75L
name
Escape
Meaning
ESC(J
ESC(6
ESC(C
J
characteJ"set
Norweftian characteJ" sa
Danish character set 2
~rtional text on
Proportional text off
ESC~
ESC(Op
ESC~nE
Pro~onal~aces=n
ESC[5 F
ESC[7 F
ESC[6 F
ESC[3 F
ESC[1 F
ESCIOz
ESC[lz
ESCjnt
ESC[nQ
ESC(Oq
ESC#9
ESC#O
ESC#8
ESC#2
ESC[Pnlr
ESC[Pn2r
ESC[Pnls
ESC[Pn2s
ESC#3
ESCH
ESC]
ESC[Og
ESC13jt
ESC[1g
ESCl4R
ESC#4
ESC#5
ESCIPn"x
Left justification
Ri&.htiustification
Block characters on
Adjust characteJ" width
Centering
Line~cil!K 1/S"
Line spacing 1/6"
Setj:)age lel!Kthl!!l
Pa/ite break (n>O)
Page break
Set left margin
Set right mar...&!n
Set page header
Set page footer
Set top (nl) and
bonom{n21 mar~s
Set left (nl) and
right (n2) margins
Clear all mar~ns
Horizontal tabs
Vertical tabs
Clear horizontal tab
Clear all horiz. tabs
Clear vertical tab
Clear all venical tabs
Clear all tabs
Set default tabs
Extended font
You can see the advantage of using this table. If someone wants to
write a text that contains underlined superscripts, the word processor
only needs to send the command "ESC[4m" for underline and "ESC[2v"
for superscripts. It's the same, no matteJ" what printer you're using. The
corresponding printer driver contains a similar table that has the printer
specific escape sequences.
71
4. DEVICES
The eighth entry of the sequence in this table is "ESC-I" (Star NL-lO).
The printer device replaces "ESC[4m" with "ESC-I" and the following
text is underlined. This functions only when you use the CMD_ WRI TE
command instead of the PRD_RAWWRITE command:
/***************************************************************
Printer Write ()
(Printer Support) *
*
*
*
* Data:
* Len:
String to be output
Number of characters to be output
******************************************************.********/
Printer Write
(PrtReq, Data, Len)
struct IOStdReq *PrtReq;
APTR
Data;
ULONG
Len;
(
PrtReq->io Data
Data;
PrtReq->iO-Length = Len;
Do_Comrnand-(PrtReq, (UWORD) CMD_WRITE);
4.5.3
Printer commands
You can use these escape sequences as printer commands. When escape
sequences contain only parameters (e.g., setting the left and right
margins), no simple substitution can be made. A routine in the printer
driver processes the irreplaceable escape sequences. This routine can be
accessed directly with the command PRD_PRT COMMAND:
1***************************************************** **********
Printer_Command()
(Printer_Support) *
*
*
*--------------------------------------------------------------*
* Input - Parameter:
*
* PrtReq: Device-Block
* Command: command
* PI-P4:
Parameter
*
*
*
****************************************************** *********1
Printer Command
(PrtReq,Command,PO,Pl,P2,P3)
struct IOPrtCmdReq *PrtReq;
UWORD
Corrrnand;
UBYTE
PO, Pl,P2, P3;
72
ABACUS
Here is a short example. To establish the left and right margins, you
can call:
Printer Command (PrtReq, 651, (BYTE) 2, (BYTE) 78, (BYTE) 0,
(BYTE) 0);
You can also replace the number 651 with the command name aSLRM.
The ParmO-Parm4 variables specify the printer driver routines.
4.5.4
Hardcopy
The PRD_ DUMPRPORT command provides the developer with an easy
method of printing a screen to the printer.
There are a few parameters you must provide when accessing
PRD DUMPPORT:
1.)
2.)
3.)
4.)
5.)
6.)
7.)
DestRows and
DestCols
73
4. DEVICES
74
DENSITYl OxlOOL
DENSITY2 Ox200L
DENSITY3 Ox300L
DENSITY4 Ox400L
CENTER Ox040L
Center graphic
ABACUS
Maximum
printable area
The printer driver contains the width and height of the maximum
printable area. You get page setups from these two maxima
(MaximaX/MaximaY), reserved through Special_Aspect.
/***************************************************************
(Printer_Support) *
*
*
*
* Function: Hardcopy
*
*--------------------------------------------------------------*
* Input - Parameter:
*
* PrtPtr:
* RastPort:
* ColorMap:
* Modes:
* SrcX,SrcY:
* SrcWidth,
* SrcHeight:
* DestCols:
* DestRows:
* Special:
Device-Block
RastPort of the graphic to be printed
ColorMap contains the actual colors
Display modes
Top left corner of graphic to be printed
*
*
*
*
*
*
*
*
*
*
*
***************************************************************/
VOID Printer Dump (PrtPtr,RastPort,ColorMap,Modes,SrcX,SrcY,
SrcWidth,SrcHeight,DestCols,DestRows,Special)
struct IODRPReq
*PrtPt r;
struct RastPort
*RastPort;
struct ColorMap
*ColorMap;
ULONG
Modes;
UWORD
SrcX,SrcY;
UWORD
SrcWidth,SrcHeight;
LONG
DestCols,DestRows;
UWORD
Special;
{
PrtPtr->io RastPort
PrtPtr->io=ColorMap
PrtPtr->io Modes
PrtPtr->io SrcX
PrtPtr->io SrcY
PrtPtr->io SrcWidth
PrtPtr->io=SrcHeight
PrtPtr->io DestCols
PrtPtr->io-DestRows
PrtPtr->io_Special
=
=
RastPort;
ColorMap;
Modes;
SrcX;
SrcY;
SrcWidth;
SrcHeight;
DestCols;
DestRows;
Special;
1* Viewmodes *1
1* Start point *1
1* Width *1
1* Height *1
1* Print width */
/* Print height */
/* Special-Flags */
The following program uses the Dump routine to print a section of the
current window. You must select the section using the mouse.
Combine the previous printer support routines to make the
Printer_SupporLc file. Don't forget the include files in the
Printecsuppport.c file.
7S
4.
DEVICES
1***************************************************** **********
*
*
*
Prt.c
August 1988
(c) Bruno Jennrieh
*
*
*
***************************************************************/
1***************************************************** **********
* Compile-Info:
* cc Prt
* In Prt.o Printer Support.o Devs Support.o -lc
*
*
***************************************************************/
tinclude "exec/types.h"
ftinclude "exec/io.h"
/tinel ude "devices/printer. hOI
iinclude "intuition/intuitionbase.h"
/tinclude "intuition/intuition.h"
tinclude "graphics/gfxbase.h"
tinclude "graphics/view.h"
union PrinterIO
(
/* Printer Blocke */
struct IOStdReq
Normal;
stroct IODRPReq
DumpRastPort;
stroct IOPrtCmdReq Conmand;
);
union PrinterIO
PrtReq;
stroct IODRPReq
*PrtPtr = 01;
stroct IOStdReq
*Normal;
struct IODRPReq
*DumpRastPort;
struct IOPrtCmdReq *Corrunand;
idefine PRT_LEN (ULONG) sizeof (struct IODRPReq)
stroct IntuitionBase *IntuitionBase = OL;
stroct Window
*Window = OL;
struct GfxBase
*GfxBase = OL:
VOID *OpenLibrary();
/***************************************************************
closelt ()
*
*
(User) *
*
*
*--------------------------------------------------------------*
* Input-Parameter:
*
*
* String: Error-Message
***************************************************************/
UWORD i;
UWORD *dff18D
(UWORD *)Oxdff180;
UWORD Error = 0;
if (strlen (String) > 01)
{
for (i=O;i<Oxffff;i++)
puts (String);
Error = 10;
if (PrtPtr != 01)
76
*dff180
i;
4.5
ABACUS
Mark_PrintArea ()
(User) *
*
*
* Function: Choose section for hardcopy
*
*--------------------------------------------------------------*
* Input-Parameter:
*
*
***************************************************************/
(ULONG)
(ULONG)
(ULONG)
(ULONG)
0;
0;
0;
0;
SetDrMd (Window->RPort,COMPLEMENT);
while *LeftMouse
*xl
*yl
&
(UBYTE)Ox40)
(UBYTE) Ox40);
(ULONG)Window->MouseX;
(ULONG)Window->MouseY;
xold
yold
Move
Draw
Draw
Draw
Draw
*xl;
*yl;
(Window->RPort,*xl,*yl);
(Window->RPort,xold,*yl);
(Window->RPort,xold,yold);
(Window->RPort,*xl,yold);
(Window->RPort,*xl,*yl);
/* first rectangle */
(UBYTE) OxO)
*x2 = (ULONG)Window->MouseX;
*y2
(ULONG)Window->MouseY;
i f *x2 != xold) II
(*y2 ! = yold))
Move
Rectangle */
Draw
Draw
Draw
Draw
(Window->RPort,*xl,*yl);
Move
Draw
Draw
Draw
Draw
(Window->RPort,*xl,*yl);
(Window->RPort,*x2,*yl);
(Wlndow->RPort,*x2,*y2);
(Window->RPort,*xl,*y2);
(Window->RPort,*xl,*yl);
/* Rubberband-
(Window->RPort,xold,*yl);
(Window->RPort,xold,yold);
(Window->RPort,*xl,yold);
(Window->RPort,*xl,*yl);
77
4. DEVICES
xold
yold
Move
Draw
Draw
Draw
Draw
*x2;
*y2;
(Window->RPort,*xl,*yl);
(Window->RPort,xold,*yl);
(Window->RPort,xold,yold);
(Window->RPort,*xl,yold);
(Window->RPort,*xl,*yl);
1* erase rectangle */
SetDrMd (Window->RPort,JAM2);
i f (*xl > *x2)
{
xold
*xl;
*xl = *x2;
*x2 = xold;
i f (*yl > *y2)
(
yold
*yl;
*yl = *y2;
*y2 = yold;
1***************************************************** *******
*
main ()
(User) *
*
*
* May have to change SPECIAL_DENSITYl depending on quality *
****************************************************** ******1
main 0
{
ULONG xl,yl,x2,y2;
if IntuitionBase = (struct IntuitionBase *)
OpenLibrary (n intuition. library" ,OL) )
(struct
IntuitionBase *) 01)
CloseIt ("No Intuition !! !"):
if GfxBase = (struct GfxBase *)
OpenLibrary ("graphics library" , OL) )
(struct GfxBase
*) 01)
CloseIt ("No Graphics!!! ");
Window = IntuitionBase->ActiveWindow;
Mark_PrintArea (Window,&xl,&yl,&x2,&y2);
Open A Device (nprinter.device",OL,&PrtPtr,OL,PRT LEN);
Normal(struct IOStdReq *) PrtPtr;
DumpRastPort = (struct IODRPReq *)PrtPtr;
Command
= (struct IOPrtCmdReq *)PrtPtr:
Printer_Dump (DumpRastPort,
Window->RPort,
GfxBase->ActiView->ViewPort->ColorMap,
(ULONG) GfxBase->ActiView->ViewPort->Modes,
(UWORD) xl,
(UWORD) yl,
(UWORD) (x2-xl),
(tJWORD) (y2-yl),
(ULONG) (x2-xl),
(ULONG) (y2-yl),
(UWORD)SPECIAL DENSITYl);
CloseLibrary (GfxBase);
CloseLibrary (IntuitionBase);
Close_A_Device (PrtPtr);
78
ABACUS
4.5.5
4.5.6
79
4. DEVICES
UWORD Status;
PrtReq->io_Data
(APTR) 'Status
The status stands in this UWORD after the call of the PRD _QUERY
f;Ommand (Do_Command (PrtReq, (UWORD) PRD_QUERY). The
entire UWORD is needed for the serial printer, while the parallel printer
needs only the lower byte (bits 0-7) of the UWORD to reserve the StablS.
With that you know how you must interpret the status returned in
Act u a l . You can tell if it is being handled as a serial
i
(io-Actual == 2) (X' a parallel pinter (io Actual =- 1). The
sectiOns on the serial and parallel devices indicare the meanings of these
bits.
You can now select seven print densities instead of four, if the printer
supports these.
'define SPECIAL NOFORMFEED OxOBOO
This flag stops the printer from printing. This may seem silly-why
open the printer device and then print nothing? Remember that the
printer driver calculates the size of the hardcopy based on the data you
placed in io_DestCols, io_YDotslnch, etc. The size of the
hardcopy on the printer then passes to the variables io_DestCols
and iO_DestRows. io_DestCols and io_DestRows contain the
number of columns and lines needed to create the hardcopy. Using the
SPECIAL_NOPRINT flag can then test, for example, if the hardcopy
can be printed in the desired size, or if some parameters need changing.
80
4.6
ABACUS
4.6
(10)
KBD READMATRIX
(11)
CMD CLEAR
(5)
4.6.1
KEY_LEN);-
81
4.
DEVICES
4.6.2
*
*
* Input - Parameter:
*
* GamePortRequest:
GamePort-Device-Block
* Type:
Controller-Type
*--------------------------------------------------------------*
*
*
***************************************************************/
VOID KeyBoard ReadEvent (KeyRequest,InputEvent)
struct IOStdReq
*KeyRequest;
struct InputEvent
* InputEvent;
{
KeyRequest->io Data
= (APTR) InputEvent;
KeyRequest->io-Length = (ULONG) sizeof (struct InputEvent);
Do Command (KeyRequest, (UWORD) KBD_READEVENT);
The second option consists of reading the status of all of the keys (this
second option is currently not implemented, but may be added soon).
The address of a byte array is frrst given to the iO_Data pointer of the
device block. This array will later contain the status of every key on the
keyboard. Each bit of this array represents one key (bit = 0 => key not
pressed).
The first byte contains the status for the keys coded 0-7. the second
contains the status for the keys coded 8-15, and so on. You must
specify the number of bytes ofthe array in i 0_Lengt h to execute the
KDB_READMATRIX command. Then the array fills with the status of
each key.
1***************************************************** **********
KeyBoard_ReadMatrix ()
(Key_Support) *
*
*
*--------------------------------------------------------------*
* Input - Parameter:
* KeyRequest: Device-Block
* Array:
Byte-Array for Status
* Len:
Size of arrays
*
*
*
*
***************************************************************/
VOID KeyBoard ReadMatrix (KeyRequest,Array, Len)
struct IOStdReq
*KeyRequest;
APTR
Array;
82
ABACUS
ULONG
Len;
KeyRequest->io Data
(APTR) Array;
KeYRequest->io~Length = Len;
4.6.3
The resets
routine
handler.
83
4.
DEVICES
4.6.4
Key.c
(c) Bruno Jennrich
*
*
***************************************************************/
/***************************************************************
* Compile-Info:
* cc Key.c
* ln Key.o Key Support.o Devs Support.o -lc
*
*
*
****************************************************** *********1
flinclude "exec/types.h"
'include "exec/io.h"
'include "exec/devices.h"
'include "devices/inputevent.h"
'include "devices/keyboard.h"
struct InputEvent Event;
struct IOStdReq *KeyRequest=Ol;
'define KEY LEN (ULONG) sizeof (struct IOStdReq)
/***************************************************************
*
CloseIt ()
* Function: In case of error, close everything
(User) *
*
*--------------------------------------------------------------*
* Input - Parameter:
.. String: Error-Message
*
*
***************************************************************/
UWORD i;
UWORD *dff180 = (UWORD *)Oxdff180;
UWORD Error = 0;
if (strlen (String) > 01)
{
for (i=O;i<Oxffff;l++)
puts (String);
Error = 10;
*dff180
i;
84
ABACUS
4.7
4.7.1
READEVENT
ASKCTYPE
SETCTYPE
ASKTRIGGER
SETTRIGGER
CLEAR
(9)
(10)
(11)
(12)
(13)
(5)
This sequence opens gameport 2 for access. If you want to use both
gameports for a game, you must open the gameport device twice, once
with GamePortRequest = OL and with GamePortRequest =
lL.
Controller
specification
(1)
(2)
(3)
mouse
relative joystick
absolute joystick
4.
DEVICES
as a different device device. You can, however, instruct the input device
to check a joystick instead of a mouse (see Section 4.8-The input
device).
Gameport 1
access
The input device controls gameport 1 until you take over the entire
system through software, or disable the input task. Avoid disabling the
input task, since this can cause problems throughout the system. When
you want to use gameport 1 without disturbing the input task, you can
access it direct over hardware register joyOdat ($dftooa).
The GP _ SETCTYPE command helps you determine which controller
should be checked with OpenDevice (). You only need to give the
following routine the flags GPCT_MOUSE, GPCT_RELJOYSTICK,
and GPCT ABSJOYSTICK:
1***************************************************** **********
GamePort_SetCType()
*
*
*--------------------------------------------------------------*
* Input - Parameter:
GamePortRequest:
* Type:
GamePort-Device-Block
Controller-Type
*
*
*
*
***************************************************************/
VOID GamePort SetCType (GamePortRequest,Type)
struct IOStdReq
*GamePortRequest;
UBYTE
Type;
{
GP_Type
= Type;
GamePortRequest->io_Data
= (APTR) &GP_Type;
GamePortRequest->io Length = 11;
Do_Command (GameportRequest, (UWORD)GPD_SETCTYPE);
Operating
systems and
controllers
86
ABACUS
*--------------------------------------------------------------*
* Input - Parameter:
* GamePortRequest: GamePort-Device-Block
Address of the bytes, assigned to the
* Type:
controller type
*
*
*
*
*
*
***************************************************************/
GamePortRequest->io Data
= (APTR) Type;
GamePortRequest->io-Length = 11;
Do_Command (GamePortRequest, (UWORD)GPD_ASKCTYPE);
Other than the gameport device block, you need the address of the bytes
into which the controller type should be placed. If the value zero
(GPCT_NOCONTROLLER) is returned in Type, you can then use the
gameport for your own controller. The gameport is occupied by another
program when Type == -1 (GPCT_ALLOCATED). When the
value 1,2 or 3 is returned in Type, that means that your program is
being used by the gameport, and the controller that was returned is
supported by the gameport device.
4.7.2
GamePort_ReadEvent()
(Game_Support) *
*
*
*--------------------------------------------------------------*
* Input - Parameter:
*
*
* GamePortRequest: GamePort-Device-Block
*
* ReadEvent:
Addesse of an InputEvent strukture, in which*
*
the controller status is written
*
***************************************************************/
87
4. DEVICES
GamePortRequest->10 Data
- (APTR) ReadEvent;
GameportRequest->1o-Length - (ULONG) (sizeof (struct
InputEvent;
GamePortRequest->10 Command = (UWORD)GPD_READEVENT;
DolO
(GamePortReqUest);
When you read the mouse (or a trackball), the two variables listed
above receive the number of steps that the mouse has moved. The faster
you move the mouse, the larger the value. When you move the mouse
up, the Y COOftIinate is negative. When you move the mouse down, the
y coordinate is positive. When you move the mouse left, the X
coordinate is negative, and when you mouse the mouse right. the X
coordinate is positive.
+
Remember that the value given here represents the movement, rather
than the actual position of the mouse pointer. If you want to conb'ol
88
4.7
ABACUS
one of your own mouse pointers, you only need to add the values in
ReadEvent. ie_X and ReadEvent. ie_Y (see Section 4.8) to the
position of the mouse pointer.
GPCT_RELJOYSTICK:
When you plug a relative joystick in the gameport, the system returns
the stick status in the form of the numbers -1, 0 and 1. The pattern
given in the figure above represents the negative and positive values.
The center position of the joystick returns a zero to the variables.
GPCT _ABSJOYSTICK:
Movement patterns for the absolute and relative joysticks are the same.
The difference between them is that GPCT_RELJOYSTICK constantly
supplies the position, while GPCT_ABSJOYSTICK only states when
the joystick is brought to a new position.
Mouse and
fire buttons
The ReadEvent structure also comes into play for reading the mouse
buttons on a mouse or the fire button on a joystick. The ie_Code
field describes the status of these buttons. When this element has the
value IECODE LBUTTON (Ox68), either the fire button or the left
mouse key was pressed. The right mouse key is tested through
IECODE_RBUTTON (Ox69). You also have the option of reading the
release of the button by instructing the gameport device through
SETTRIGGER:
/***************************************************************
GamePort_SetTrigger ()
(Game_Support) *
*
*
*--------------------------------------------------------------*
* Input - Parameter:
* GamePortRequest:
* GPT:
*
*
GamePort-Device-Block
*
GamePortTrigger-Structure, which determines*
when
the
movement
message
mshould
be
sent
*
*
and if the keypress or release of the key *
*
should be announced
*
*
***************************************************************/
VOID GamePort_SetTrigger (GamePortRequest,GPT)
struct IOStdReq
*GamePortRequest;
struct GamePortTrigger
*GPT;
{
GamePortRequest->io_Data
(APTR) GPT;
GamePortRequest->io_Length = (ULONG) (sizeof (struct
GamePortTrigger;
Do_Command (GamePortRequest, (UWORD)GPD_SETTRIGGER);
Don't let the comments in this routine confuse you: the factors in this
function primarily control mouse movement (more on this later).
89
4.
DEVICES
Keypresses
o
2
4
6
8
DxDD
DxD2
DxD4
DxD6
DxD8
Structure
-------struct GamePortTrigger
{/* defined in "devices/gameport. h" * /
UWORD gpt_Keys;
UWORD gpt TimeOut;
UWORD gpt=XDelta;
UWORD gpt_YDelta;
Timeout states the number of vertical blanks that should be sent from
the gameport device between ReadEvents (60 per second). XDelta
and YDel t a state after how many pulses of the controller a
ReadEvent should be created. This only works when using a mouse
as an input device. The mouse contains two shafts fitted with wheels,
and the wheels have holes drilled in them. When the mouse changes
position, the holes interrupt a light source. The gameport checks for
this light change.
These pulses are added together. When the sum of the values exceeds
the values given in XDel ta and YDel ta, the mouse pointer moves
to point XDelta and YDelta. When you give the value 1 for
XDel ta and YDel ta, the mouse pointer moves the fastest. This
means that you need less room on your desk to move the pointer from
the upper left corner of the screen to the lower right corner of the
screen.
Preferences
Preferences program also allows the user to set the mouse speed. The
mouse speed assigned after every boot operation is an input device
routine which accesses the gameport device.
How does Prefer~nces know which values to set for the mouse speed?
GamePort_AskTrigger reads the GamePort Trigger of the
corresponding gameport:
/***************************************************************
GamePort_AskTrigger()
(Game_Support) *
*
*
Input - Parameter:
*
*
GPT:
*--------------------------------------------------------------*
* GamePortRequest: GamePort-Device-Block
90
ABACUS
to be filled
(see SetTrigger)
***************************************************************/
GamePortRequest->io_Data
(APTR) GPT;
GamePortRequest->io Length
(ULONG) (sizeof (struet
GamePortTrigger;
Do_Command (GamePortRequest, (UWORD)GPD_ASKTRIGGER);
4.7.3
GamePort.e
(e) Bruno Jennrieh
August 1988
*
*
*
*
****************************************************** *********1
1***************************************************** **********
* Compile-Info:
*
* ee GamePort
* In GamePort.o Game Support.o Devs Support.o -lc
*
*
*
*
***************************************************************/
lIinclude
lIinclude
#include
lIinclude
#include
#include
"exeelrYpes.h"
"exec1memory.h"
"exec/io.h"
"exec/devices.h"
"devices/inputevent.h"
"devices/gameport.h"
struct IOStdReq
*GamePortRequest=O;
struct GamePortTrigger GPT;
struct InputEvent
ReadEvent;
91
4.
DEVICES
/***************************************************************
CloseIt()
(User) *
* Function: In case of an error, release structure and memory *
*--------------------------------------------------------------*
* Input - Parameter:
* String: Error-Message
*
*
****************************************************** *********1
VOID Closelt(String)
UBYTE
*String;
{
i;
puts (String);
if (GamePortRequest != 0) Close A Device (GamePortRequest);
exit (Error);
/***************************************************************
The_GamePort_DeviceO
(User)*
*
*
***************************************************************/
Open A Device
("gamep-;;rt. device" , 11, &GamePortRequest, 01, GP LEN);
printf (" Please put mouse in second GamePort!\n");
printf (" right mouse key == end of program\n");
GamePort_SetCType (GamePortRequest, (UBYTE)GPCT_MOUSE);
GPT.gpt Keys
= (UWORD) (GPTF UPKEYS+GPTF DOWNKEYS);
/* Annoui;"ce both * /
GPT.gpt_Timeout
(UWORD) 0;
GPT.gpt XDelta
(UWORD) 1;
GPT.gpt=YDelta
(UWORD) 1;
GamePort_SetTrigger (GamePortRequest,&GPT);
ReadEvent.ie Code = 0;
while (ReadEvent. ie_Code != IECODE_RBUTTON)
{
if (ReadEvent.ie Code
IECODE_LBUTTON) printf ("Left
Button\n");
if (ReadEvent.ie_Code
printf ("Left Button released\n");
GamePort~eadEvent (GamePortRequest,&ReadEvent);
printf ("x: %d\n y: %d\n",ReadEvent.ie X,ReadEvent.ie Y);
Do_Command (GamePortRequest, (UWORD)CMD=CLEAR);
GamePort SetCType (GamePortRequest, (UBYTE) GPCT NOCONTROLLER);
Close A Device (GamePortRequest);
lII3.inO
{
92
ABACUS
4.8
IND ADDHANDLER
IND REMHANDLER
IND WRITEEVENT
(9)
IND
IND
IND
IND
IND
(12)
(13)
(14)
(15)
(16)
SETTHRESH
SETPERIOD
SETMPORT
SETMTYPE
SETMTRIG
(10)
(11)
4.8.1
CMD RESET
(1)
CMD CLEAR
(5)
CMD STOP
CMD START
(6)
(7)
93
4.
DEVICES
4.8.2
o
4
5
6
8
Oxoo
Ox04
Ox05
Ox06
Ox08
Structure:
struct InputEvent
{/* defined in "devices/inputevent.h" * /
struct InputEvent *ie NextEvent;
UBYTE
ie -Class;
UBYTE
ie=SubClass;
UWORD
ie Code;
UWORD
ie=Qualifier;
union
{
struct
{
10 OxOA
12 OxOC
10 OxOA
14 OxOE
22 Ox16
WORD
WORD
ie_xy;
APTR
ieJ>osition;
struct timeval
94
(OxOO)
(OxOl)
(Ox02)
(Ox03)
(Ox04)
(Ox05)
(Ox06)
(Ox07)
(Ox08)
(Ox09)
ABACUS
IEX::lASS MENULIST
IEX::lASS_ CIDSEWINDCJf
IEX::lASS_SIZEMNXlf
IEX::lASS_ REF'RESHIr.[N[)
IEX::lASS NEJiPREFS
IEX::lASS DISI<REMJIlED
IEX::lASS DISKINSERTED
IEx:::IASS ACTIV9lINIXIi
IEOASS_INACI':IVEMNIXJi
(OxOA)
(OxOB)
(OxOC)
(OxOD)
(OxOE)
(OxOF)
(OXI0)
(Ox11)
(OxI2)
menu clicked on
window close gadget clicked
window resized
window refreshed
new PrefeteneeS
disk removed
disk inserted
window activated
winOOw deactivated
Let's examine each input event and how ie_Class interprets them:
IBCLASS Nu11
A NOP input event. Data from the event has no meaning.
IBCLASS RAWItBY
Places the keyboard code of the pressed key in ie_Code (not the
ASCU code). i e _ Qu ali fie r contains the status of the <Ctrl>,
<Shift> and <Alt> keys:
(Oxoool)
(OxOOO2)
~I~RSHIE"l'
IEQlALlFIER_ CAPSIro<
(OxOOO4)
IEQlALlFIER_ <XNmOL
(OxOOO8)
IEQlALlFIER_ IALT
(Oxool0)
(OxOO2O)
~ER_RALT
(Ox0040)
~ER_I.CX:MWID
(Ox0080)
~_RXMWID
IEQlALlFIER_ NtH:RICPAD
(OxOloo)
IEQlALlFIER_ REPFAT
(Ox02OO)
(Ox04OO)
~IER_INl'ERRllPT
~ER_M.JLTIBRONX'AST (OxOSOO)
(Ox 1000)
~IER_IaJTI'CN
(0x2000)
~IER_RElJTlXN
(Ox4000)
~ER_MEUI'TCN
~IER_
LSHIE"l'
(Ox8000)
m
m
When the bit is set, the <Shift>, <Alt> or <Ctr!> key was also pressed
as well as the key in ie_Code. The illustration shows the layout of
the key codes. The numbers on the keys are equal to the value retwned
in ie_Code. The two input events are sent from the input device
when one key is pressed. The keypress and the release of the key are
two separate events. You can differentiate the two input events because
the high value bit (bit 7 = Ox80) is set in actual keyboard code
(ie_Code) when the key is released (lOCMP flag: RAWKEY).
95
4. DEVICES
96
4.8
ABACUS
IECLASS_RAWMOOSE
Returns a mouse movement to ie_x and iey. These two variables
are part of a union. Here are two macros to allow you to move the
mouse in the X or Y direction without entering input event
ieyosi tion. ie_x time after time:
4define ie_X ie-position.ie_x;
4define ie_Y ie-position.ie_y;
IECLASS EVENT
An internal event of the input device. It is a necessary part of keeping
the system informed of changes to the current input window.
ie_Code has the value IECODE_ NEWACTIVE (OxOl).
IECLASS POINTERPOS
The absolute mouse position as placed in ie_X and ie_Yo This event
functions only when the IDCMP flag MOUSEMOVE is set for the
current window.
IECLASS TIMER
Places the current system time in timeval. This event comes from
the input task every 60th of a second (IDCMP flag: INTUITICKS).
IECLASS GADGETDOWN
Places the address of a clicked gadget in ie_Posi tion. ie_addr.
This event functions only when the IDCMP flag GADGETDOWN is set
for the current window. System gadgets like the front gadget
(WINDOW-TO-FRONT) or the back gadget (WINDOW-TO-BACK)
cannot be checked.
IECLASS GADGETUP
Places the address of a released gadget in ieyosition. ie_addr.
This event functions only when the IDCMP flag GADGETUP is set for
the current window.
IECLASS_REQOESTER
Sent when a requester is represented in the current window.
IECODE_REQSET (OxOl) is in ie_Code with the requester
encountered first. When another one is encountered without the ftrst
requester disappearing, this event is no longer sent.
When all of the requesters have disappeared, another input event is sent.
This time the value I ECODE_REQCLEAR (OxOO) is given in
97
4. DEVICES
IECLASS MENULIST
Places the code of the menu selected from the current window in
i e _ Code. This event functions only when the IDCMP flag
MENUP I CK is set for the current window.
IECLASS CLOSEWINDOW
Sent when the user clicks on the close gadget of the current window.
This event functions only when the IDCMP flag CLOSEWINDOW is
set for the current window.
IECLASS SIZEWINDOW
Sent when the size of the current window changes. This event functions
only when the IDCMP flag NEWSIZE is set for the current window.
IECLASS REFRESHWINDOW
Sent when the current window should be refreshed. This event functions
only when the IDCMP flag REFRESHWINDOW is set for the current
window.
IECLASS NEWPREFS
Sent when new preferences are present due to changes from the
Preferences program (IDCMP flag: NEWPREFS).
IECLASS_DISKREMOVED
Sent when the user removes a disk from a disk drive (IDCMP flag:
DISKREMOVED).
IECLASS DISKINSERTED
Sent when the user inserts a disk in a disk drive (IDCMP flag:
DISKINSERTED).
IECLASS ACTIVEWINDOW
Makes the window most recently clicked the active window.
IECLASS INACTIVEWINDOW
Deactivates the currently active window.
Intuition and
the input
device
98
ABACUS
/***************************************************************
(Input_Support) *
Input_AddHandler()
*
*
*
*--------------------------------------------------------------*
* Input - Parameter:
*
*
*
* InputRequest: Input-Device-Block
*
* Handler:
Address of your own handler routine (C)
*
* Data:
Address of data area for handler routine
*
****************************************************** *********1
User Routine
Input Handler.is Data
Input-Handler.ls-Code
Input=Handler.is=Node.ln_Pri
(ULONG) Handler;
= Data;
=
=
(VOID
51;
(*)
(Input_Code;
InputRequest->io Data
= (APTR)&Input Handler;
Do_Command(InputRequest, (UWORD) IND_ADDHANDLER);
This routine specifies the device block with which the device was
opened (or a copy of the original device block). Then the routine gives
the address of the handler routine that was written in C. You also have
the option of specifying a range of memory for use by your handler
routine (e.g., for variables).
Unfortunately the input task is not in the position to call C routines,
because the parameters are passed in the stack in C. The input task
gives the parameters (input event and data region) in the hardware
registers. For this reason, we must switch to an interface that moves
the parameters from the hardware register onto the stack, and then call
the C program. We have developed a short machine language routine
for this purpose:
/***************************************************************
_Input_Code.asm
(Input_Support) *
*
*
*--------------------------------------------------------------*
* Input - Parameter:
*
*
*
*
* Function: Call Input-Handler Routine (C-Routine)
*--------------------------------------------------------------*
* Return values:
*
*
****************************************************** *********1
lIasm
public geta4
public =Input_Code
99
4. DEVICES
_Input_Code:
move.l
a4,-(sp)
jsr
geta4
movem.l ~O/al,-(sp) ; parameter auf Stack
move.l
jsr
movem.l
move.l
rts
ilendasm
User Routine,aO
(aO) (sp)+,aO/al
(sp)+,a4
Input_RemHandler()
(Input_Support) *
*
*
*---------------------------_._---------------------------------*
* Input - Parameter:
*
*
*
InputRequest: Input-Device-Block
*****************************w*********************************/
100
4.8
ABACUS
InputRequest->io Data
= (APTR) 'Input Handler;
Do_Command (InputRequest, (UWORD)IND_REMHANDLER);
These two routines give you the infonnation needed to write a macro
recorder that registers all of the encountered input events. Here's the
code for just such a recorder. Combine all the input support routines
presented in this section to make the InpucSupportc me. The header
for the InpucSupport.c file is presented at the end of this section.
1***************************************************** **********
*
*
Recorder.c
August 1988
(c) Bruno Jennrich
*
*
***************************************************************/
/***************************************************************
*
*
Compile-Info:
cc Recorder
In Recorder.o Input Support.o Devs iSupport.o -lc
*,*
* Function:
CloseIt ()
(User) *
Release all occupied memory and structures
*
*--------------------------------------------------------------*
* Input - Parameter:
* String: Error-Message
*
*
***************************************************************/
Closelt (String)
BYTE
*String;
(
UWORD *dff180
(UWORD *)Oxdff180;
UWORD i;
UWORD Error;
Error = 0;
if (strlen (String) > 0)
(
101
4.
DEVICES
i;
puts (String);
i f (FileHandle != 0)
Clo:se (FlleHandle);
i f (InputRequest != 01) Clo:se_A_Device (InputRequest);
if (Recorder ! = 0)
Frel~Mem
(Recorder,HowMuchEvents*INEV U,N);
exit (Error);
1***************************************************** **********
C_Handler ()
(User) *
*----------------------------_._--------------------------------*
* Input - Parameter:
* Input: InputEvent
* Data: Pointer to data
* Return value:
* InputEvent, that should be processed further.
*
*
*
*---------------------------------------------------------------*
******************************,r********************************/
i f (!End)
{
if (Input->ie_Class == IECI.Jl,SS_RAWKEY)
{
/* Escape */
Pointer
= &Recorder[*Datal:
/* InputEvent */
Pointer->ie NextEvent
0;
Pointer->ie-Class
Input->ie Class;
Pointer->ie SubClass
Input->ie-SubClass;
Pointer->ie-Code
Input->ie -Code;
Pointer->ie-Qualifier
Input->ie=Qualifier;
Pointer->ie-TimeStamp.tv secs
Input>ie TimeStamp. tv secs;
Pointer-=>ie TimeStamp. tv micro
Input>ie TimeStamp. tv micro;
*Data+=l;
else End = TRUE;
return (Input);
1***************************************************** **********
Input _Device ()
(User) *
*
*
****************************************************** *********1
Input_Device ()
{
102
0;
ABACUS
Input_AddHandler (InputRequest,C_Handler,&ActualEvents);
while (!End);
/**********-****************************************************
*
main ()
(User) *
*
*
*
*
* Input - Parameter:
* argv[l]: Name of the Macro File
* argv[2]: Number of events
***************************************************************/
main (argc,argv)
UWORD argc;
BYTE
**argv;
(
i f ( argc !; 3)
{
*1
Input_Device ();
FileHandle; Open (argv[l),MODE_NEWFILE);
if (FileHandle ;; 01)
CloseIt ("Cannot Open MacroFile ! !!");
Write (FileHandle,&ActualEvents,41);
1* save length *1
Write (FileHandle,Recorder,ActualEvents*INEV LEN);
1* save events *1
Close (FileHandle);
FreeMem (Recorder,HowMuchEvents*INEV_LEN);
Program
description
This program first opens the input device. Then the input handler is
installed. This handler calls our C_Handler routine. Only RAWKEY
events are recorded in this C Handl e r routine. Whether it was
recorded or not, the received input event is given in the other input
handler (all of the input handlers like interrupt server are organized in a
list). This happens by simply returning the received input event. The
return () routine writes the address of the received input event in DO
for this. If you place the value 0 in DO, you must remember that the
following handler can no longer be accessed.
103
4.
DEVICES
((ULONG)
(sizeof(struct InputEvent))
/*****************************"*********************************
Input_WriteEvent()
(Input_Support) *
*
*
*
* Function: Givw InputEvent in other Input-Handler again
*
*-----------------------------_._-------------------------------*
Input - Parameter:
*
* InputRequest: Input-Device-Block
Event:
InputEvent to redirect
*
*
*
*
******************************~*********************** *********/
InputRequest->io_Data
104
(APTR) Event;
4.8
ABACUS
InputRequest->10 Length
InputRequest->io=Flags
INEV LEN;
(UBYTE) 0;
This routine lets you send an input event to all of the present handlers.
If you installed your own handler, this handler also receives your input
event, as long as a handler with a higher priority has not changed the
input events.
Based on the above routine we can actually write a program to play
back the entered keypresses. Our program must open the file created by
the recorder, read the saved number of recorded input events, allocate
memory as needed and load the input events into this allocated memory.
Then these input events only need to be executed by
Input_WriteEvent():
1***************************************************** **********
*
*
*
Play.c
August 1988
(c) Bruno Jennrich
*
*
*
***************************************************************/
/***************************************************************
* Compile-Info:
*
* cc Play
* ln Play.o Input Support.o Devs Support.o -lc
***************************************************************/
#include
iinclude
iinclude
#include
iinclude
iinclude
"exec/types.h"
"exec/memory.h"
"exec/interrupts.h"
"exec/nodes.h"
"devices/input.h"
"devices/inputevent.h"
VOID *Al1ocMem();
VOID *Open () :
#define MODE OLDFILE
1005L
#define INPUT LEN
(ULONG) (sizeof (struct IOStdReq
ide fine RECORD SIZE
50001
#define INEV LEN
ULONG) (sizeof (struct InputEvent))
#define MEMTYPE
(MEMF_CHIP I MEMF_CLEAR)
UWORD
*FileHand1e
01:
struct InputEvent *P1ayer
01:/* Memory for InputEvents */
ULONG
Length
01;/* Niumber of InputEvents */
struct IOStdReq
* InputRequest= 01:
1***************************************************** **********
CloseIt ()
(User) *
*
*
*--------------------------------------------------------------*
* Input - Parameter:
* String: Error-String
*
*
*
***************************************************************/
lOS
4. DEVICES
BYTE
*String;
i:
puts (String);
if (FileHandle != 01)
if (Player != 01)
if (InputRequest !~ 01)
Close (FileHandle);
FreeMem (Player,Length*INEV_LEN);
Close_A_Device (InputRequest);
exit (Error);
/***************************************************************
*
* Input - Parameter:
* argv[l]:
MacroFile
main
(User) *
*
*
*****************************~t*********************** **********/
main (arge,argv)
UWORD argc;
BYTE
**argv;
{
UWORD i;
i f (arge ! = 2)
{
106
4.8 THE
ABACUS
INPUT DEVICE
This program shows you how to open and use a device with as little
effort as possible. The program section that sends out the input events
consist of only three functions and a control instruction (for (; ; ) i).
You find the compiled programs Recorder and Play on the optional disk
in the CH - 4 / 4 8 directory. We have also included a macro in this
directory. You can play it back by entering the directory and entering:
Play Macro
4.8.3
Setting repeat
speed
The Preferences program offers the option of changing the key repeat
speed. This parameter controls the speed at which a key repeats when
the user presses and holds the key. The key repeat speed is set from
Preferences using slider gadgets. When booting, the system reads the
repeat rate from the devs/ system configuration file and places the
value in IND_SETTHRESH. If you want to change the repeat speed
after booting, you must load the Preferences program, change the repeat
speed and exit to the Workbench. The following routine allows you to
change the repeat speed without returning to Preferences:
1***************************************************** **********
(Input_Support) *
Input_SetPeriod()
*
*--------------------~-----------------------------------------*
* Input - Parameter:
* InputRequest: Input-Deviee-Bloek
* Sees, Micro: Time that should pass between two repetitions
*
*
*
***************************************************************/
VOID Input Set Period
struet timerequest
ULONG
(InputRequest,Sees,Miero)
*InputRequest;
Sees, Micro;
107
4. DEVICES
You only need to give this routine the time that should pass between
two repetitions of a pressed key.
Changing the
repeat
threshold
When you press and hold a key, the key delays before beginning key
repeat. The time that passes between the pressing down and the
repetition of a key is called the repeat threshold. You can completely
change this threshold with the following routine.
/***************************************************************
Input_SetThresh ()
(Input_Support) *
*
*
*--------------------------------------------------------------*
* Input - Parameter:
*
*
*
* InputRequest: Input-Device-Block
*
* Sees, Micro: After how many seconds and micro seconds the *
***************************************************************/
1* !!!! *1
Sees;
Micro;
Setting the
mouse speed
Now from the keyboard to the mouse. Here's one of the input device
functions usually reached through Preferences:
/****************************~,*********************** ***********
*
Input SetMTrig()
(Input_Support) *
* Function: Set threshold for mouse movement
*
*--------------------------------------------------------------*
* Input - Parameter:
*
* InputRequest: Input-Deviee-Bloek
*
* Keys:
Mouse button pressed or released?
*
* Timeout:
Send mouse report after how many VBlanks?
*
* XDelta,YDelta: Announce after n mouse movements?
*
**********~******************************************* *********/
(InputRequest,Keys,Timeout,XDelta,YDelta)
*InputReq~est;
Keys,Timeout,XDelta,YDelta;
108
(APTR) &GPT;
(ULONG) (sizeof (struet
ABACUS
This routine informs the input device of how many pulses the mouse
should announce for one move in the X or Y direction. As mentioned
above, there are two shafts fitted with wheels perpendicular to each
other inside of the mouse. These wheels have holes drilled in them.
When moving the mouse, each wheel rotates, interrupting a light
source. This pulse is then sent to the input device, or the input device
reads this pulse from the hardware register.
When the number of this pulse of the given value has been reached, the
input device ensures that the mouse pointer moves to a point on the
screen. XDelta and YDelta give the number of the pulse in the X
and Y direction by which the mouse pointer was moved to a point on
the screen. The larger this value is, the slower the mouse is.
The Timeout parameter helps you determine the number of vertical
blanks after which a mouse report or mouse event should be sent, in
case the mouse is not moved extensively. The parameter has the value
1 (for Intuition). The mouse position is renewed after each vertical
blank in the Intuition window, or on the Intuition screen. The Keys
parameter allows the system to announce the release of a mouse button
(G P T F UP KEY S) instead of pressing down a mouse button
(GPTF_ DOWNKEYS).
Assigning the
mouse port
The following routine allows the user to connect the mouse to the
second gameport instead of the default first gameport
1***************************************************** **********
Input_SetMPort ()
(Input_Support) *
* Function: Set mouse port
*
*--------------------------------------------------------------*
* Input - Parameter:
* InputRequest: Input-Device-Block
* Port:
0: GamePort 1
*
1: GamePort 2
*
*
***************************************************************/
VOID Input_SetMPort (InputRequest,Port)
struct IOStdReq
* InputRequest;
UBYTE
Port;
{
UBYTE PointerToPort;
PointerToPort = Port;
InputRequest->io_Data
InputRequest->io_Length
(APTR) &PointerToPort;
(ULONG) 1;
You must give this routine the input device block and a one or zero.
Then, depending on which value you entered, the mouse is read from
109
4. DEVICES
You can change the mouse controller as well as the mouse port. For
example, this means that a joystick can take over almost all the
functions of the mouse, except for the right mouse button. The
following routine executes this.
/***************************************************************
Input SetMType ()
* Function: Set mouse controller type
(I nput _Support) *
*
*--------------------------------------------------------------*
* Input - Parameter:
*
* InputRequest: Input-Device-Block
* Type:
new controller type
*
*
***************************************************************/
VOID Input_SelMType
struct IOSldReq
UBYTE
(InpulRe~~esl,Type)
*InputRequest;
Type;
UBYTE MouseType;
MouseType = Type;
InputRequest->io_Data
= (APTR) &MouseType;
InputRequest->io_Length
= 11;
Do_Command (InputRequest, (miORD)IND_SETMTYPE);
MOUSE:
RELJOYSTICK:
ABSJOYSTICK:
NOCONTROLLER:
Remember that this command must include the address of the type.
That is why the given parameter lis written in an extra variable, whose
address is given in the device block.
The following is the start of the InpuCSupport.c file:
/***************************************************************
* Compile-Info:
Input_Support.c
cc Input Support
*
*
***************************************************************/
#include "exec/types.h"
#include "exec/memory.h"
#include "exec/interrupts.h"
lIinclude "exec/nodes.h"
#include "devices/input.h"
#include "devices/gameport.h"
#include "devices/timer.h"
lIinclude "devices/ inputevent. h"
ULONG User Routine;
'define INEV LEN
ULONG) (sizeof (struct InputEvent)))
VOID Input_Code();
struct Interrupt Input_Handler;
110
ABACUS
4.9
You can now access the console device. The console device supports
the following commands:
CMD READ
CMD WRITE
CMD CLEAR
CD ASKKEYMAP
CD SETKEYMAP
(2)
(3)
(5)
(9)
(10)
CD ASKDEFAULTKEYMAP
(11)
CD SETDEFAULTKEYMAP
(12)
read keypress
display text
clear console buffer
send current keyboard layout
set new keyboard
arrangement
find out default keyboard
arrangement
set default keyboard
arrangement
As you see, the console device uses few commands, but they play an
important role in developing such complicated applications as editors
(see DiskEd), word processors, etc.
The console device is controlled through command strings. These are
sent to the console device with the help of the command CMD _ WRI TE.
You should prepare another device block for the C MD _ WR I T E
command so that the READ and WRITE commands do not interfere
with each other:
struct IOStdReq *ConsoleWrite = OL;
ConsoleWrite = (struct IOStdReq*) GetDeviceBlock(CON_LEN);
Console_Copy (ConsoleRead, ConsoleCopy);
111
4. DEVICES
Console_Copy ( )
(Con_Support) *
*
*
*--------------------------------------------------------------*
* Input - Parameter:
*
*
*
* Function:
Device-Block copy
* OldStdReq: Original
* NewStdReq: Copy
***************************************************************/
NewStdReq->io Device =
OldStdReq->io_Device;
NewStdReq->io Unit =
OldStdReq->io_Unit;
Console_W.ri te ()
(Con_Support) *
*----------------------------_._--------------------------------*
* Input - Parameter:
* ConWrite: Device-Block
* String: String to be displayed
* Len:
Length of string
*
*
***************************************************************/
ConWrite->io Data
= (APTR) String;
ConWrite->io Length = Len;
Do_Command (ConWrite, (UWORD)CMD_WRITE);
1***************************************************** **********
Console_Read ()
(Con_Support) *
*--------------------------------------------------------------*
*
*
*
*
Input - Parameter:
ConWrite: Device-Block
String:
Address of the buffers
How many characters to be read
Len:
*
*
****************************************************** *********1
112
ABACUS
ConRead->io Data
(APTR) String;
ConRead->io-Length = Len;
ConRead->io-Colll1land = (UWORD) CMD_READ;
Doro (ConRead) ;
In addition to the device block, these routines give you the address of
the sUing to be displayed, or the address of the range of memory into
which the read keypress should be written. It also gives you the number
of characters to be displayed or read. If you enter -11 as the number of
characters to be displayed, all of the strings that end with a null byte are
displayed.
When you read keypresses from the keyboard by means of
Console_Read (), it returns the ASCII code that represents the
depressed key. Remember that this is not automatically displayed. You
must provide for the output yourself by means of
Console_Write () OrCMD_WRITE. As was already mentioned, a
certain number of control strings exist with which you can test for the
form of the input and output:
BELL
(Ox7)
Screen flashes and tone sounds.
BACKSPACE
(Ox08)
Moves the cursor one position to the left. The character to the left of
the cursor is not deleted. You can delete the character by combining a
backspace and a space.
LINE
(OxOa)
Moves the cursor one position down. When the cursor arrives at the
bottom line of the screen, the screen scrolls up one line (see SET
FEED
MODE).
VERTICAL
FORM
CR
FEED
TAB (OxOb)
Moves the cursor one line up. When the cursor arrives at the top line of
the screen, the screen scrolls down one line.
(OxOc)
Oears the console window.
(OxOd)
Places the cursor in the fIrst column but not in the next line.
113
4.
DEVICES
SHIFT
IN
(OzOa)
OUT
(OzOf)
Disables <Shift> key. Only capital letters are displayed in the output.
CAP S
LOC!C
!Cay
(Ozlb)
<Escape> key.
CSI
(Oz9b)
("<CSI>c")
[N]
SPACES
("<CSI> [N]
8":1
UP
[N]
Moves the cursor N lines up. When N is omitted, the cursor moves up
one line. N is a decimal string. For example, "<CSI>2A" moves the
cursor up two lines.
CURSOR
DOWN
[N]
("<CSI>[N]B")
Moves the cursor N lines down. When N is omitted, the cursor moves
down one line. N is a decimal string. For example, "<CSI>2B" moves
the cursor down two lines.
CURSOR
FORWARD
("<CSI>[N]C n )
[N]
BACKWARD
[N]
("<CSI>[N]I)")
Moves the cursor N columns to the left. When N is omitted, the cursor
moves left one column. N is a decimal string. For example,
"<CSI>200" moves the cursor 20 characters to the left.
CURSOR
NEXT
LINE
[N]
Moves the cursor N lines down and to the flrst column (has the same
effect as pressing the <Return> key).
114
ABACUS
CURSOR
PRECEDING
LINE
[N]
(n<CSI>[N] [;M]H n )
CURSOR
TO
END
OF
DISPLAY
("<CSI>J n )
Clears the screen from the current cursor position to the end of the
screen. To clear the entire screen, you can use the following sequence:
"<CSI>l;l;H" (Cursor home) and "<CSI>J" (Delete).
ERASE
TO
END
OF
( n<CSI>K n )
LINE
Deletes line from the current cursor position to the end of the current
line (same as <Ctrl><Y> function in ED).
INSERT
LINE
("<CSI>L")
LINE
("<CSI>M")
Deletes the line at the current cursor position. Lines below the deleted
line scroll up to fill in the deletion (same as <Ctrl><B> function in
ED).
DELETE
CHARACTER
(n<CSI>[N]p n )
UP
[N]
LINES
Scrolls the entire screen up N lines. The blank lines below fill with
blank spaces.
SCROLL
DOWN
[N]
LINES
Scrolls the entire screen down N lines. The blank lines above fill with
blank spaces.
SET
MODE
("<CSI>20h n )
MODE
(n<CSI>20L n )
Treats a line feed as <Line feed> only when a line feed is sent (OxOa),
the cursor moves to the next line but remains in the same column.
l1S
4.
DEVICES
DEVICE
STATUS
REPORT
("<CSI>6n")
<Background>m")
<Style>
o
1
3
4
7
normal text
bold print
italics
underline
inverse
<I'oreground>
30
31
Color 0
Color 1
37
Color 7
<Background>
40
41
Color 0
Color 1
47
Color 7
For example, if you want the text displayed underlined and bold and in
colors 0 and I, you must send the following sequence:
"<CSI>4;30;40m"
"<CSI>l;30;4lm"
SET
PAGE
LENGTH
("<CSI><LEN>t")
Specifies the number of lines that the console device should control in
the window. The entire window is usually allocated for text output, but
you can reduce the text area with this and the following commands.
116
ABACUS
When changing the size of the window the console device calculates the
new value from the current character set and alters the size of the text
range correspondingly. This happens only if you have not established
your own values. When you want the console device to manage the size
of the window or the text range by itself, you must call the commands
with statements of values, for example" <CSI>t".
SET
LINE
WIDTH
(n<CSIXwidth>u")
Specifies the number of characters per line. You can use the remaining
space for graphics.
SET
LEFT
OI'I'SBT
("<CSI><offset>:z:")
Specifies the starting vertical raster line (not column) at which the text
range should start. For example,"<CSI>8x" uses eight lines of space in
the left window margin for small graphics, scroll bars, etc.
SET
TOP
OFFSBT
("<CSI><offset>y")
Specifies the starting horizontal raster line (not text line) at which the
text range should start. The remaining space can be used for displaying
graphics, tab positions, etc.
CURSOR
ON
("<CSI>O
p")
Enables cursor.
CURSOR
01'1'
("<CSI>
p")
Disables cursor.
WINDOW
STATUS
("<CSI>o
q")
Sends window status request The system returns a status report in the
following form, readable using CMD_READ:
R<CSI>l:l;,<bottom border>; right border> r"
The window status report returns the positions of the upper left comer
(1,1) and the lower right comer.
RAW
EVENTS
o
1
2
3
4
5
6
no operation
keypress and the release of the key
mouse button pressed
window was activated
mouse pointer position
unused
timer events
117
4. DEVICES
8
9
10
11
12
13
14
15
16
gadget clicked
gadget released
requester displayed
menu selected
close gadget clicked
window resized
window redrawn
Preferences changed
disk: removed
disk inserted
The RAW EVENTS read through the console device are identical to
those events accessible from the input device. Here too the
corresponding flags for checking the event must be set. The following
syntax sends the required events:
<CSI>Event number{
When you look at the input event structure, you determine large
coincidences between this structure and the control string, which are
sanded from the console device. Each decimal string means the
following:
<Cl.ass>
Returns the number of results received from the console device. You
can check multiple results of all of the results from the console device.
For example, if you want keypresses and mouse button clicks to be
returned, you can access them through "<C S I > 1 {" followed by
"<CSI>2 {n, or simply through n<CSI>l; 2 {".
<SubCl.aaa>
Most often contains the value O. SubClass contains the value 1 only
when the mouse is plugged into gameport 2.
<KeyCode>
Contains the decimal string that indicates the keyboard code of the
1
2
4
8
16
32
118
left <Shift>
right <Shift>
<Caps lock>
<Ctrl>
left <Alt>
right <Alt>
ABACUS
64
128
256
512
1024
2048
4096
8192
16384
32768
left <Amiga>
right <Amiga>
numeric keypad key
key repeated (repeat function)
interrupt (unused)
multi broadcast (result for current window)
left mouse button
middle mouse button (unused)
right mouse button
relative mouse movement
<x> <y>
<Seconds>
<Microseconds>
Returns the system time in microseconds.
The user must decode the string supplied by the console device and
interpret the values found there. It takes little time to calculate how
much more he gets directly though the IDCMP flags of the events and
the keyboard code.
Now that we've described all of the control strings that can be sent and
received, we have here a short application that you can enter, compile,
link: and run. This console device editor allows you to enter control
strings from the keyboard and watch the result frrsthand. Because the
control sequence can be chosen by sources other than through the
keyboard, we check the escape key and interpret Escape as <CSI>. You
can get out of the editor by entering <q><Retum>.
Combine all of the Con_Support routines presented in this chapter to
form the Con_Support.c program. Compile the COD_Support.c
program and link it to the following program. Don't forget the proper
include files in the COD_SUpport.c file (exec/types.h, exec/memory.h,
eXec/devices.h, devices/console.h, devices/keymap.h)
1***************************************************** **********
*
Conni.e
*
*
*
*************************.*************************************1
1***************************************************** **********
*
*
Compile-Info:
ee Conni.e
In ConnLo Con Support.o Devs Support.o -Ie
*
*
***************************************************************/
119
4.
DEVICES
'include
'include
'include
'include
'include
'include
'include
nexec/types.h"
"exec/memory.hn
nexec/devices.h"
"devices/console.h"
ndevices/keymap.h"
nintuition/intuitioribase.h n
nintuition/intuition.h"
'define HEMTYPE
(MEMF CHIP I HEMP CLEAR)
'define CON_LEN (ULONG)-(sizeof (struct IOStdReq
VOID
VOID
VOID
VOID
VOID
VOID
*Open () ;
*AllocMem () ;
*GetDeviceBlock();
*OpenLibrary () ;
*OpenScreen();
*OpenWindow();
struct Screen
* Screen
struct Window
*Window
struct IntuitionBase *IntuitionBase
struct NewScreen
01;
01;
01;
New Screen = {
0,0,640,200,4,
0,1,
HIRES,
CUSTOMSCREEN,
01,
(UBYTE*) "No Name",
01,
01
};
struct NewWindow
NewWindow
0,0,
640,200,
0,1,
01,
(ULONG) ACTIVATE,
01,
01,
(UBYTE*) "Console-Device-
struct IOStdReq
*ConsoleRead
*ConsoleWrite
01,
01;
1***************************************************** **********
CloseIt ()
(User) *
*--------------------------------------------------------------*
* Input - Parameter:
* String: Error-Message
*
*
***************************************************************/
120
ABACUS
for (i=O;i<Oxffff;i++)
puts {String);
Error = 10;
*dff180
i;
if (Window != 01)
CloseWindow (Window);
if (Screen != 01)
CloseScreen (Screen);
if (IntuitionBase != 01) CloseLibrary (IntuitionBase);
if (ConsoleRead != 0)
if (ConsoleWrite != 0)
exit (Error);
Close_A_Device (ConsoleRead);
FreeDeviceBlock (ConsoleWrite);
1***************************************************** **********
*
Open_Screen_and_WindowO
(User) *
*
*
***************************************************************/
VOID Open_Screen_and_Window()
{
1***************************************************** **********
*
Close_Screen_and_WindowO
(User)*
***************************************************************/
VOID Close_Screen_and_Window()
{
CloseWindow (Window);
CloseScreen (Screen);
CloseLibrary (IntuitionBase);
121
4.
DEVICES
/***************************************************************
main ()
(User) *
***************************************************************/
main ()
{
i;
UWORD
InputString[256];
*BufPointer;
/*
/*
/*
UWORD Pos;
Quit
FALSE; /*
BOOL
BOOL Return
FALSE; /*
BYTE
BYTE
ConsoleRead
ConsoleWrite
ConsoleRead->io Data
ConsoleRead->io=Length
(APTR) Window;
(ULONG) (sizeof (struct Window;
Open_A_Device ("console.device",Ol,&ConsoleRead,Ol,Ol);
Console_Copy (ConsoleRead,ConsoleWrite);
BufPointer = InputString;
Pos = 0;
while (!Quit)
(
while (!Return)
{
*BufPointer = (BYTE)O;
Console Read (ConsoleRead,BufPointer,ll);
if (*Bufpointer == (BYTE)OxOB) /* Backspace */
(
i f (Pos>O)
{
*BufPointer = (BYTE)O;
BufPointer--;
if (*BufPointer == (BYTE) Oxlb)
{
/* <
Console Write
(ConsoleWrite,"\OlO\OlO\OlO\OlO\OlO",-ll);
Console_Write (ConsoleWrite,"
Console Write
(ConsoleWrite,"\OlO\010\010\OlO\010",-ll);
",-11);
else
(
i f (Pos <256)
{
III
> */
ABACUS
if (*Bufpointer
==
(BYTE) Ox9b)
if (*BufPointer
==
OxOd) 1* Return *1
Return = TRUE;
Console Write (ConsoleWrite,"\012 n,1l);
if (*InputString == 'q') Quit = TRUE;
1* 'q' pressed? *1
else
if (*BufPointer == Oxlb) 1* Escape *1
{
Console_Write (ConsoleWrite,n<CSI>R,Sl);
else Console Write (ConsoleWrite,BufPointer,ll);
BufPointer++;
Pos++;
Return = FALSE;
*BufPointer = (BYTE)O;
if (*InputString == (BYTE)Oxlb)
{ 1* Display control string after Return *1
*InputString = (BYTE) Ox9b;
Console_Write (ConsoleWrite,InputString,-ll);
BufPointer
Pos = 0;
InputString;
Note:
123
4. DEVICES
4.9.1
Key mapping
The console device allows the option of overlaying new keys. This
makes it possible to print a string like "Hello people, how are you?" in
response to a single keypress. The console device gets the key code of
the character that was pressed from the input device by way of the
keyboard device. The console then exttacts the ASCII code from the
tables that correspond to the key that was pressed and gives this to the
user. You can change this table, provided you know the keymap
structure:
Offset
Structure
--------
struct KeyMap
{
0
4
8
12
16
20
24
28
32
Oxoo
Ox04
Ox08
OxOc
OxlO
Ox14
Ox18
OxIc
Ox20
124
ABACUS
125
4.
DEVICES
The ASCII codes that should be sent if a single key or a key with a
qualifier is pressed are saved in km LoKeyMap and km Hi KeyMap.
This memory area is a long word array (4 bytes = 4 ASCn codes).
The result is that a key can support only two qualifiers (e.g.,
<Shift><Alt> or <Ctrl><Alt. ASCII codes are sent when a single
key is pressed, when a key is pressed in conjunction with one of the
qualifiers (e.g., <Shift> or <Alt, and when a key is pressed in
conjunction with two qualifiers (e.g., <Shift><Alt.
By using strings instead of simpler ASCII codes, up to eight different
strings can be sent out based on a single key and the corresponding
qualifier. Let's look at a German keymap that makes simple ASCII
codes available as strings:
';ownkeymap.asm
asm
KC NOQUAL
KC=VANILlA
KCF SHIFT
KCF=ALT
KCF CONTROL
KCF=STRING
CSI
equ 0
equ 7
equ 1
equ 2
equ 4
equ 64
equ $9b
public _LoKeyMapTypes
even
_ LoKeyMapTypes:
dc.b KC VANILIA
dc.b KC-VANILIA
dc.b KC-VANILlA
dc.b KC-VANILlA
dc.b KC-VANILlA
dc.b KC-VANILlA
dc. b KC-VANILlA
dc.b KC-VANILIA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b 0 dc.b 0
dc.b KC_NOQUAL
dc.b KC VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
dc.b KC-VANILLA
126
;$00
;$01
;$02
;$03
;$04
;$05
;$06
;$07
;$08
;$09
;$Oa
;$Ob
;$Oc
;$Od
;$Oe
;$Oe
;$Of
;$10
;$11
;$12
;$13
;$14
;$15
;$16
;$17
;$18
;$19
;$la
;$lb
Tilde
1
2
3
4
5
6
7
8
9
0
...
\
undefinied
!!!!!! !
undefinied
0 (Number field)
q
e
r
t
z , y on US keyboard
u
i
0
p
I
+
ABACUS
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc. b
dc.b
dc.b
0
KC NOQUAL
KC-NOQUAL
KC-NOQUAL
KC-VANILLA
KC-VANILLA
KC-VANILLA
KC-VANILLA
KC-VANILLA
KC-VANILLA
KC-VANILLA
KC-VANILLA
KC VANILLA
KC-VANILLA
KC-VANILLA
0
0
KC NOQUAL
KC-NOQUAL
KC-NOQUAL
0 KC VANILLA
KC-VANILLA
KC-VANILLA
KC-VANILLA
KC VANILLA
KC-VANILLA
KC VANILLA
KC-VANILLA
KC VANILLA
KC-VANILLA
0
KC_NOQUAL
KC NOQUAL
KC:::NOQUAL
KC_NOQUAL
public _LoKeyMap
even
LoKeyMap:
- dc.h "_","fl1,"]II,"["
dc.b $21+$80,$31+$80,"!","1"
dc.b $22+$80,$32+$80,$22,"2"
dc.b $a7+$80,$33+$8C,"'","3"
dc.b $24+$80,$34+$80,"$","4"
dc.b $25+$80,$35+$80,"%","5"
dc.b $26+$80,$36+$80,"&","6"
dc.b $2f+$80,$37+$80,"/","7"
dc.b $28+$80,$38+$80,"(","8"
dc.b $29+$80,$39+$80,")","9"
dc.b $3d+$80,$30+$80,"=","0"
dc.b $3f+$80,$df+$80,"?"," "
dc.b $27+$80,$60+$80,"'","-;-"
dc.b $7c+$80,$5c+$80,"I","\"
dc.l $0
dc.l $0
dc.b $00,$00,$00,"0"
dc.b $51+$80,$71+$80, "Q", "q"
dc.b $57+$80,$77+$80, "W","w"
dc.b $45+$80, $65+$80, "E","e"
dc.b $52+$80,$72+$80,"R","r"
dc.b $54+$80,$74+$80,"T","t"
;$lc
;$ld
; $le
;$lf
;$20
;$21
;$22
;$23
;$24
;$25
;$26
; $27
; $28
;$29
;$2a
;$2b
;$2c
;$2d
;$2e
; $2f
;$30
;$31
;$32
;$33
;$34
;$35
;$36
;$37
;$38
;$39
;$3a
;$3b
;$3c
; $3d
;$3e
; $3f
undefinied
1 (Number field)
2 (Number field)
3 (Number field)
a
s
d
f
g
h
j
k
I
v
reserved
undefinied
4 (Number field)
5 (Number field)
6 (Number field)
reserved
y, z on US keyboard
x
c
v
b
n
m
undefinied
, (Number field)
7 (Number field)
8 (Number field)
9 (Number field)
;$00
; $01
;$02
;$03
;$04
;$05
;$06
;$07
;$08
;$09
;$Oa
;$Ob
;$Oc
;$Od
;$Oe
;$Oe
;$Of
;$10
;$11
;$12
;$13
;$14
1
2
3
4
5
6
7
8
9
0
-.\
undefinied
undefinied
0 (Number field)
q
w
e
r
t
127
4.
DEVICES
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
public _HiKeyMapTypes
even
_ HiKeyMapTypes:
dc.b KC NOQUAL
dc.b KC:::NOQUAL
dc.b KC NOQUAL
dc.b KC:::NOQUAL
dc.b KC NOQUAL
dc.b KC:::NOQUAL
dc.b KC_NOQUAL
dc.b a
dc.b a
dc.b a
dc.b KC_NOQUAL
dc.b 0
dc.b KCF STRING+KCF SHIFT
dc.b KCF-STRING+KCF-SHIFT
dc.b KCF-STRING+KCF-SHIFT
128
;$15
;$16
;$17
;$18
;$19
;$la
;$lb
;$lc
;$ld
;$le
;$lf
;$20
;$21
;$22
;$23
;$24
;$25
;$26
;$27
;$28
;$29
;$2a
;$2b
;$2c
;$2d
;$2e
;$2f
; $30
;$31
;$32
;$33
; $34
;$35
;$36
;$37
;$38
;$39
;$3a
;$3b
;$3c
;$3d
;$3e
;$3f
$5a+$80,$7a+$80,"Z","z"
$55+$80,$75+$80, "U", "U"
$49+$80,$69+$80,"I","i"
$4f+$80,$6f+$80, "0", "0"
$50+$80, $70+$80, "P", "p"
$dc+$80,$fc+$80,"\","I"
$2a+$80,$2b+$80,"*","+"
$00,$00,$00,$00
$00,$00,$00,"1"
$00,$00,$00,"2"
$00,$00,$00,"3"
$41+$80,$61+$80, "A", "a"
$53+$80,$73+$80, "S", "s"
$44+$80,$64+$80,"O","d"
$46+$80, $66+$80, "F", "f"
$47+$80,$67+$80, "G","g"
$48+$80,$68+$80, "H", "h"
$4a+$80,$6a+$80,"J","j"
$4b+$80, $6b+$80, "K", "k"
$4c+$80,$6c+$80, "L", "1"
$d6+$80, $f6+$80, "V", "v"
$c4+$80,$e4+$80,"O","d"
$00,$00,$00,$00
$00,$00,$00,$00
$00,$00,$00,"4"
$00,$00,$00,"5"
$00,$00,$00,"6"
$00,$00,$00,$00
$59+$80,$79+$80,"Y","y"
$58+$80, $78+$80, "X", "x"
$43+$80,$63+$80,"C","c"
$56+$80, $76+$80, "V", "v"
$42+$80,$62+$80, "B", "b"
$4e+$80,$6e+$80, "N", "n"
$4f+$80,$6f+$80, "M", "m"
$3b+$80,$2c+$80,";",","
$3a+$80,$2e+$80,":","."
$5f+$80,$2d+$80,"_","-"
$00,$00,$00,$00
$00,$00,$00,","
$00,$00,$00,"1"
$00,$00,$00,"2"
$00,$00,$00,"3"
;$40
;$41
; $42
;$43
;$44
;$45
;$46
;$47
;$48
;$49
;$4a
;$4b
;$4c
;$4d
; $4e
z, y on us
U
i
0
p
I
+
undefinied
1 (Number field)
2 (Number field)
3 (Number field)
a
s
d
f
g
h
j
k
1
v
d
reservied
undefined
4 (Number field)
5 (Number field)
6 (Number field)
reserved
y, z on us
x
c
v
b
n
m
undefined
, (Number
7 (Number
8 (Number
9 (Number
Space
BackSpace
Tab
Enter
Return
Escape
Delete
undefined
undefined
undefined
Number feild
undefined
Up Arrow
Down Arrow
Forward Arrow
field)
field)
field)
field)
4.9
ABACUS
de.b
dc.b
dc.b
de.b
de.b
de.b
de.b
dc.b
de.b
de.b
de.b
de.b
dc.b
dc.b
de.b
dc.b
dc.b
dc.b
dc.b
de.b
dc.b
dc.b
dc.b
dc.b
dc.b
: $4f
:$50
: $51
:$52
:$53
: $54
: $55
:$56
: $57
:$58
: $59
: $5a
:$5b
:$5c
:$5d
;$5e
: $5f
: $60
:$61
:$62
: $63
:$64
:$65
;$66
:$67
Backward Arrow
Fl
F2
F3
F4
F5
F6
F7
F8
F9
FlO
undefined
undefined
undefined
undefined
undefined
Help
SHIFT left
SHIFT right
CAPS LOCI<
CTRL
ALT left
ALT right
AMIGA left
AMIGA right
public _HiKeyMap
even
_HiKeyMap:
dc.b
dc.b
dc.b
dc.b
dc.b
de.b
de.b
de.b
de.b
dc.b
dc.b
dc.b
dc.l
dc.l
de.l
dc.l
de.l
de.l
de.l
de.l
de.l
de.l
de.l
de.l
de.l
de.l
de.b
dc.b
dc.b
de.b
de.b
de.l
$00,$00,$00,$20
$00,$00,$00,$08
$00,$00,$00,$09
$OO,$OO,$OO,$Od
$OO,$OO,$OO,$Od
$00,$00,$9b,$lb
$00,$00,$00,$7f
$00,$00,$00,$00
$00,$00,$00,$00
$00,$00,$00,$00
$00,$00,$00,"-"
$00,$00,$00,$00
Up_Arrow
Down Arrow
Forward Arrow
Backward Arrow
Fl
F2
F3
F4
F5
F6
F7
F8
F9
FlO
$00,$00,$00,$00
$00,$00,$00,$00
$00,$00,$00,$00
$00,$00,$00,$00
$00,$00,$00,$00
Help
;$40
;$41
: $42
:$43
: $44
: $45
: $46
:$47
;$48
: $49
;$4a
;$4b
;$4e
;$4d
; $4e
;$4f
; $50
; $51
;$52
: $53
: $54
: $55
: $56
; $57
; $58
: $59
; $5a
:$5b
: $5e
;$5d
;$5e
:$5f
Spaee
BackSpace
Tab
Enter
Return
Escape
Delete
undefined
undefined
undefined
Numerie Pad
undefined
Up Arrow
Down Arrow
Forward Arrow
Backward Arrow
Fl
F2
F3
F4
F5
F6
F7
F8
F9
FlO
undefined
undefined
undefined
undefined
undefined
Help
129
4.
DEVICES
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
dc.b
$00,$00,$00,$00
$00,$00,$00,$00
$00,$00,$00,$00
$00,$00,$00,$00
$00,$00,$00,$00
$00,$00,$00,$00
$00,$00,$00,$00
$00,$00,$00,$00
;$60
;$61
;$62
;$63
;$64
;$65
;$66
;$67
SHIFT left
SHIFT right
CAPS LOCK
CTRL
ALT left
ALT right
AMIGA left
AMIGA right
Up Arrow:
-dc.b 2
; Length of the strings (unshifted)
dc.b Up Arrow UnShift-Up Arrow
; Offset
dc.b 2
; Length of the strings (shifted)
dc.b Up Arrow Shift-Up Arrow
; Offset
Up Arrow UnShift:-dc.b CSI, "A"
Up Arrow Shift:
-dc.b CSI,nT"
Down Arrow:
dc.b 2
; Length of the strings (un shifted)
dc.b Down Arrow UnShift-Down Arrow
; Offset
dc.b 2 ; Length of the strings (shifted)
dc.b Down Arrow shift-Down Arrow
; Offset
Down Arrow UnShift:dc.b CSI, "Bn
Down Arrow Shift:
dc.b CSI,"S"
Forward Arrow:
dc.b- 2
; Length of the
dc.b Forward Arrow UnShift-Forward Arrow
dc.b 3
- ; Length of the
dc.b Forward Arrow Shift-Forward Arrow
Forward Arrow UnShift: dc.b-CSI, "C"
Forward Arrow Shift:
dc.b-CSI, "-A"
strings (unshifted)
; Offset
strings (shifted)
; Offset
Backward Arrow:
dc.b -2
; Length of the strings (unshifted)
dc.b Backward Arrow UnShift-Backward Arrow
; Offset
dc.b 3
- ; Length of the strings (shifted)
dc.b Backward Arrow Shift-Backward Arrow
; Offset
Backward Arrow UnShift:dc.b CSI,"D"
Backward Arrow Shift:
dc.b CSI," @n
Fl:
dc.b 3
dc.b Fl UnShift-Fl
dc.b 4
dc.b Fl_Shift-Fl
Fl UnShift:
dc.b CSI,"O-"
Fl Shift:
-dc.b CSI,"lo-n
F2:
dc.b
130
ABACUS
dc.b F2 UnShift-F2
dc.b 4
dc.b F2 Shift-F2
F2 UnShift:
-dc.b CSI,n1- n
F2 Shift:
-dc.b CSI,"ll-"
Offset
Lenght of the strings (shifted)
Offset
F3:
dc.b 3
dc.b F3 UnShift-F3
dc.b 4
dc.b F3 Shift-F3
F3 UnShift:
dc.b CSI,n2-"
F3 Shift:
-dc.b CSI,"12-"
F4:
dc.b 3
dc.b F4_UnShift-F4
dc.b 4
dc.b F4_Shift-F4
F4 UnShift:
-dc.b CSI,n3-"
F4 Shift:
-dc.b CSI,"13- n
FS:
dc.b 3
dc.b FS UnShift-FS
dc.b 4
dc.b FS Shift-FS
FS UnShift:
dc.b CSI,n4-"
FS Shift:
dc.b CSI,"14- n
F6:
dc.b 3
dc.b F6 UnShift-F6
dc.b 4
dc.b F6 shift-F6
F6 UnShift:
dc.b CSI,"S-"
F6 Shift:
-dc.b CSI,"1S-"
F7:
dc.b 3
dc.b F7 UnShift-F7
dc.b 4
dc.b F7 Shift-F7
F7 UnShift:
dc.b CSI,"6-"
F7 Shift:
-dc.b CSI, "16-"
F8:
dc.b
dc.b
dc.b
3
F8 UnShift-F8
4
131
4. DEVICES
dc.b Fa shift-FS
Fa UnShift:
-dc.b CSI,n7-n
FS Shift:
-dc.b CSI,nI7-n
Offset
F9:
dc.b 3
dc.b F9 UnShift-F9
dc.b 4
dc.b F9 shift-F9
F9 UnShift:
-dc.b CSI,"a-"
F9 Shift:
dc.b CSI,nIS-"
FlO:
dc.b 3
dc.b FlO UnShift-FIO
dc.b 4
dc.b FlO Shift-FlO
FlO UnShift:dc.b CSI,"9-"
FlO Shift:
dc.b CSI,"19-"
Help:
dc.b 3
dc.b Help UnShift-Help
Help_UnShift:dc.b CSI,"?-"
even
'endasm
Note:
For unknown reasons we must use $Oe twice for the keyboard code
instead of one byte in the KeyMapTypes table and eight bytes instead
of four in the Keymap table. If you don't do this, all of the keypresses
end with incorrect codes. For example, "v" instead of Cor "m" instead
ofM.
Remember that the KeyMap and KeyMapTypes arrays begin in word
addresses (even). After detennination of the arrays you should also make
sure that the rest of the program continues with an even address
otherwise a Guru Meditation occurs. This Guru informs you of an
address error (Guru number $000000(3).
Now let's examine the entries in LoKeyMap more closely: you have
determined that the fIrst byte contains the value "A" + $ 8 0 for the
keyboard code $20. The second byte contains "a" + $ 8 0 and the last
two bytes contain the value "A" and "a". Unfortunately the Aztec C
assembler does not understand expressions like "A" + $ 8 O. That is why
we have translated the character "A" into its ASCII code $41. Let's see
which of the four ASCII codes are sent when a key is pressed in
conjunction with a qualifier:
132
ABACUS
II)
.S
.4
C+A
S+C
S+A+C
$80
a+
$80
a+
a+
a+
a-
$80
$80
$30
$80
A+
A-
a+
$80
$80
30
A+
A+
A+
$80
$80
$80 $80
-$30
II)
A+
$80
!II
..it'
a+
II)
II)
S=Shlft
A=AIt
C=Control
A+
$80
A+
a+
a+
$80
$80
$80
-$30
A+
133
4. DEVICES
You see that one of the ASCII codes "a", "An, "A"+$80, or "a"+$80 is
sent only when the qualifiers <All> and <Shift> are pressed. When all
three qualifiers are allowed, bits 5 and 6 ($30) of the sent code are
cleared when the <Ctrf> key is pressed. You also have no option of
testing for the ASCII code sent in conjunction with <Ctrl> ,
independently from the codes established in the keymap.
This changes somewhat when we use strings instead of simple ASCII
codes. Here you must bear in mind that the four bytes in the keymap
act as an entry point to one or more string descriptors. Such a string
descriptor has the following format:
l.)
2.)
byte
byte
Here is an example:
StringDescriptor:
dc.b 8
dc.b Stringtobedisplayed1-StringDescriptor
dc.b 14
dc.b Stringtobedisplayed2-StringDescriptor
Stringtobedisplayed1: dc.b "String 1"
Stringtobedisplayed2: dc.b "second String"
; length
;Offset
; length
;Offset
Because the strings to be displayed are addressed over offsets, the strings
must be placed in the range from +127 to -128 bytes from the
beginning of the string descriptor. Now you can represent all three
qualifiers and their combinations through other strings. The illustration
on the opposite page tells which combination of allowed and pressed
qualifiers display which string.
Remember that with one allowable qualifier, two strings must be
available; for two allowable qualifiers, four strings must be available;
and with three qualifiers, eight strings must be available. A string
descriptor must also be specified for each of the strings to be displayed
Now the pointers Lo/HiCapsable and Lo/HiRepeatable must
be explained.
Certain keys like the <Caps lock> key are not represented by their
shifted values. So <Caps lock> displays a "1" instead of a "!". The
CapsAble pointer points to a 8 byte array from which a bit is
responsible for seeing if a key should execute Caps lock (Bit == 1) or
ignore it (Bit = 0). The CapsAble bit 0 of the first byte is set to
zero for the key number zero (LoCapsable). The first bit of the
second byte pertains to key 8, and so on. The first bit from
HiCapsable pertains to key Ox40. Two pointers point to a 64 bit =
byte size array.
134
ABACUS
S.A
C.A
S.C
S.A.C
CD
()
CD
()
()
CD
()
CD
S=Shlft
A.AII
C=Control
KeyMapEntry
NewA:
de. b 1
de. b A-NewA
de. b 1
de. b B-NewA
de. b 1
de. b C-NewA
de.
de.
de.
de.
b1
b O-NewA
A: de . b "A"
B: de . b "8"
C: de. b-C"
0: de. b "0"
E: de. b "E"
F: de. bOP
G: de. b "G"
H: de . b "H"
b1
b E-NewA
de. b 1
de. b F-NewA
de. b 1
de. bG-NewA
de. b 1
de. b H-NewA
135
4. DEVICES
Then change the corresponding pointer of the keymap structure and the
command CD SETKEYMAP .
. KeyMap.km LoKeyMapTypes = (UBYTE*) &LoKeyMapTypes;
= (ULONG*) &LoKeyMap;
KeyMap.km-LoKeyMap
KeyMap.km-HiKeyMapTypes = (UBYTE*) &HiKeyMapTypes;
KeyMap.km-HiKeyMap
(ULONG*) &HiKeyMap;
Console_setKeyMap(ConsoleRead, &KeyMap);
Console_AskKeyMap ()
(Con_Support) *
*--------------------------------------------------------------*
*
*
*
* ConReq:
Device-Block
*
* KeyMap: Pointer to KeyMap-Structure
*
* Input - Parameter:
*--------------------------------------------------------------*
* Return Value:
*
***************************************************************/
*
*
Console_SetKeyMap()
136
(Con_Support) *
*
*
ABACUS
*--------------------------------------------------------------*
* Input - Parameter:
*
ConReq:
* KeyMap:
Device-Block
Pointer to KeyMap-Structure
*
*
*--------------------------------------------------------------*
* Rerun value:
*
*
*
* FALSE: Error !!!
*
***************************************************************/
You also have the option of bypassing the console device and assigning
a different keymap to the console window. This can be done through
CD ASKDEFAULTKEYMAP and CD SETDEFAULTKEYMAP. When
you use these two commands to install a new keymap, the next time
you invoke the Open_A_Device ("console .device", OL,
&ConsoleRead, OL. OL); command enables the keymap. These
commands are used by the SetMAP eLI command. The SetMAP
command changes the ConUnit structure of the current CLI window.
1***************************************************** **********
Console_AskDelfaultKeyMap()
(Con_Support) *
*
*
*--------------------------------------------------------------*
* Function: Fill KeyMap-Structure
* Input - Parameter:
* ConReq:
* KeyMap:
Device-Block
pointer to KeyMap-Structure
*
*
*--------------------------------------------------------------*
* Retrun value:
*
*
*
***************************************************************/
137
4. DEVICES
/***************************************************************
*
Console SetDefaultKeyMap ()
(Con Support) *
*
*
*
ConReq:
KeyMap:
Device-Block
Pointer to KeyMap-Structure
*
*
*--------------------------------------------------------------*
* Retrun value:
*
* FALSE: Error
!!!
*
***************************************************************1
4.9.2
Console internals
After Open_A_Device the ConsoleRead->io_Unit points to a
ConUn! t structure. This structure contains all of the important
variables needed for using the console:
Offset
138
Structure
--------
struct ConUnit
Oxoo
34
38
40
42
44
Ox22
Ox26
Ox28
Ox2a
Ox2c
WORD
WORD
WORD
WORD
cu_XCP;
cu_YCP;
cu_XMax;
cu_YMax;
46
48
50
52
Ox2e
Ox30
Ox32
Ox34
WORD
WORD
WORD
WORD
cu_XRSize;
cu YRSize;
cu::::XROrigin;
cu_YROrigin;
54
56
58
60
Ox36
Ox38
Ox3a
Ox3c
WORD
WORD
WORD
WORD
62
Ox3e
*1
*1
cu_XRExtant; 1* maximum size
*1
cu_YRExtant; 1* of the text region *1
cu XMinShrink;
1* smaller
*1
cu::::YMinShrink;
1* unrelated *1
1* region by *1
1* Window Resize *1
WORD
cu_XCCP;
struct MsgPort
cu_MP;
1* character position *1
1* maximum character *1
1* position
*1
1* character size *1
1* start of the
1* text region
ABACUS
64 Ox40
WORD
cu_YCCP;
/* Cursor Position
66 Ox42
struct KeyMap
cu KeyMapStruct;
/* KeyMap
98 Ox62
UWORD
cu_TabStops[80];
/* Tab Positions
/* see RastPort Structure: */
178 Oxb2
BYTE
cu_Mask;
179 Oxb3
BYTE
cU_FgPen;
180 Oxb4
BYTE
cU_BgPen;
181 Oxb5
BYTE
cu AOLPen;
182 Oxb6
BYTE
cu=:DrawMode;
183 Oxb7
BYTE
cu_AreaPtSz;
184 Oxb8
APTR
cu AreaPtrn; /* Cursor Pattern
188 Oxbc
UBYTE
cu:)interms [8];
196 Oxc4
struct TextFont *cu_Font;
200 Oxc8
UBYTE
cu AlgoStyle;
201 Oxc9
UBYTE
cu::::TxFlags;
202 Oxca
WORD
cu TxHeight;
cu_Tx Width;
204 Oxcc
UWORD
206 Oxce
cu -TxBaseline;
UWORD
208 OxdO
cu-TxSpacing;
UWORD
210 Oxd2
UBYTE
cu Modes[3];
/* memory for modes
/* and RAW EVENTS
/* (respectively 1 Bit)
213 OxdS
UBYTE
cu RawEvents[3];
216 Oxd8
/* defined in "devices/conunit.h"
4.9.2.1
*/
*/
*/
*/
*/
*/
*/
*/
Console functions
The console device includes functions which can be accessed through
offsets. The ConsoleDevice = ConsoleRead->io Device
represents the basis address for these functions.
Offset
-Ox30
KeyMap)
Command
-------Ox2a
CDInputHandler(&InputEvent)
AO
Actual = RawKeyConvert(&InputEvent, Buffer, Length,
DO
AO
, Al
01
A2
139
4. DEVICES
4.9.2.2
These three key codes are never sent from the console device during
normal operation. First, if you turn on the RAW mode for the mouse
keypress with "<CSI>2{", you can add these key codes through the
control string that was received.
Ox80-0xe7
The key assigned a code ranging from OxOO to Ox67 was released (e.g.,
Ox80 for key OxOO). This code can only be received when the flag
KeF _DOWNUP (OxSO) is set for the key in KeyMapTypes.
Od9
The keyboard code last sent from the keyboard was incorrect
Oxfa
Odb
Odd
Keyboard power-up (keys pressed during booting). This was sent from
Oxfd and Oxfe. (for example: Oxfd, Ox03, Ox04, Oxfe).
Ode
Oxff
140
ABACUS
4.10
The clipboard device can only handle one unit at a time. Therefore. you
must open the clipboard device with different unit numbers, if you wish
to access more than one unit. The device block layout below will help
you understand how this works:
Offset
Structure
-------0
20
24
28
30
31
32
OxOO
Ox14
Ox18
Ox1c
Ox1e
Oxlf
Ox20
36
Ox24
40
44
48
Ox28
Ox2c
Ox30
52
Ox34
struct IOClipReq
/* which unit? */
/* number of */
/*transferred bytes */
ULONG
io_Length; /* number of bytes to*/
/* transfer */
SPTR
io Data; /* data (Stringpointer)*/
ULONG
io::::Offset; /* Offset inside unit */
LONG
io_ClipID; /* identification number */
/* of the clip */
} /* defined in "devices/clipboard.h" */
141
4.
DEVICES
*
*
Function: Write data in the ClipBoard-Device n
*
*---------------------------------------------------------*
* Input - Parameter:
*
Clip_Write 0
(Clip_Support)
*
*
ClipReq: Device-Block
*
Data to be written
*
* Len:
Number of bytes to write
*
* FirstTime: TRUE => first write command
*
*
FALSE => write command of a sequence
*
*---------------------------------------------------------*
* Return value:
*
* Data:
if (First Time==TRUE)
ClipReq->io_Offset = 01;
ClipReq->io Data
= (STRPTR) Data;
ClipReq->iO-Length = Len;
Do_Command (ClipReq, (UWORD) CMD_WRITE);
return (ClipReq->io_Actual);
142
ABACUS
clipboard block, the clipboard device writes your block to disk, placing
it in the directory "SYS:devs/clipboards". The fIlename is the unit
number, notated as a decimal string (e.g., 0).
The following routine reads data from a clipboard device block using
the CMD_ READ command:
1***************************************************** *****
*
*
*
Clip_Read 0
(Clip_Support)
*
*
*---------------------------------------------------------*
* Input - Parameter:
*
* ClipReq: Device-Block
* Data:
Data buffer
* Len:
*
*
*
*
*
*---------------------------------------------------------*
* Return value:
*
* Number of the data that was read (contains errors!)
***********************************************************1
ULONG Clip Read (ClipReq,Data, Len,FirstTime)
struct IOCIipReq *ClipReq;
APTR
Data;
LONG
Len;
BOOL
FirstTime;
{
if (FirstTime=TRUE)
ClipReq->io_Offset
= 01;
ClipReq->io Data
= (STRPTR) Data;
ClipReq->io-Length - Len;
Do Conunand (ClipReq, (UWORD) CMD READ);
return IClipReq->io_Actual);
-
143
4. DEVICES
When you no longer need the block, you must execute the
CMD CLEAR command. This clears the data in the clipboard device and
increments the ClipID counter by one. For write and read accesses
you should only clear the i 0_0 f f set array. Do not write to
io_CUpID, for reasons which we'll explain in a moment.
Converting a large block to another format from the clipboard device
(e.g., conversion to IFF format) can take a lot of time. You can save
time by declaring a CUp (naming the transfer of data blocks in and out
of the clipboard device). First you specify the address of a message port
to the i 0 D a t a pointer. Through this message port you get a
Sati s fy message if the data available for use is needed by both parts.
This also sends a caD_ POS T command. The Sat i s fy message looks
like the following structure:
Offset
Structure
struct SatisfyMsg
o OxOO
20 0x14
22 Ox16
26 Oxla
sm::::ClipID;
If you want to test whether you should execute a previously sent POST
command before leaving the program, just read the i
C 1 i p I D.
Compare its contents with the io ClipID variable ofthe POST
device block. If the value returned from CURRENTWRITEID in
io_CUpID is larger than the CUpID variable of the POST device
block, the other CMD_ WRI TE commands are executed in the meantime
and the announced data transfer does not need to be executed
144
ABACUS
4.11
The IOAudio device block through which the command is given and
developed looks like the following:
Offsets
0
OxOO
32
34
38
42
44
46
48
62
Ox20
Ox22
Ox26
Ox2a
Ox2c
Ox2e
Ox30
Ox3d
struct IOAudio
{/* defined in "devices/audio.h lt */
struct IORequest ioa_Request; /* IORequest to
begin */
WORD
ioa AllocKey;
UBYTE
*ioa-Data;
/* Data pointer */
ULONG
ioa-Length; /*size data field*/
UWORD
ioa-Period; 1* Frequency */
UWORD
ioa -Volume; /* volume * /
UWORD
ioa=eycles; /* cycles */
struct Message
ioa_WriteMessage;
(32)
(11)
(9)
(13)
(12)
(10)
(14)
(8)
(2)
(1)
(7)
(6)
(3)
145
4. DEVICES
(16)
ADIOF SYNCCYCLE
AD I OF_ NOWAI T
(32)
(64)
(-10)
(-11)
(-12)
user
4.11.1
Audio channel
allocation:
Method one
146
ABACUS
*1
*1
*1
*1
The above line controls the precedence of your sounds. The higher the
precedence number, the less chance of your channel being "stolen" by
another user. Stealing refers to another program allocating a sound
channel you already have allocated. If your channel has a high
precedence, a program trying to allocate your sound channel will be
rejected. If the other program has a precedence number higher than
yours, your channel must be released as soon as possible. Commodore-
147
4. DEVICES
Sound
type
128
90 - 100
80- 90
75
50-70
-50 - +50
-70 - 0
-100 --SO
-128
Total silence.
Audio channel The second method works through an audio device command We have
allocation:
placed this command (ADCMD_ALLOCATE) in an audio device support
Method two
function which looks like the following:
1***************************************************************
AUdio_Allocate ()
(Audio_Support) *
*
* Function: Allocate sound channels or audio device block
Prepare for allocation (OpenDevice)
*
*
*
*
*--------------------------------------------------------------*
* Input - Parameter:
* Audio Device Block:
* ChannEi"l Map:* Size: * Precedence:
* Wait:
*
*
*
*
*--------------------------------------------------------------*
* Return value:
*
* Error in command execution
*
***************************************************************/
BYTE Audio Allocate
(Audio Device Block,Channel Map,Size,Precedence,Wait)
struct-IOAudio
*Audio=Device_B1ock;
148
4.11
ABACUS
UBYTE
*Channel_Map;
Size;
ULONG
BYTE
Precedence;
OOOL
Wait;
(
Channel Map;
Size; -
Audio~)evice=Block->ioa=Length
=
=
= Precedence;
Audio_Device_Block->ioa_Request.io_Command
ADCMD ALLOCATE;
-if (Wait) DolO (Audio Device Block);
else
--
(UWORD)
The unset NOWAIT flag waits until the request containing our channels
releases them. A small problem can occur when you use the NOWAIT
flag in conjunction with ADCMD_ALLOCATE, it cannot be used for
channel allocation with OpenDevice () You might think that by
returning the set NOWAIT flag ADCMD_ALLOCATE to the called
program, the channels can be allocated. This is done in case the
supplied channels are inaccessible, but unfortunately they wait for
ADCMD ALLOCATE.
We got around this error with the help of the SendIO () and
Check I 0 () commands. If channels should be released without delay,
we send a asynchronous request (SendIO () ) and check it immediately
to see if the sent command is executing, or if it was already processed.
If CheckIO () returns the value 0, that is one character for us that the
149
4.
DEVICES
channels contain from others. Because we do not want to wait for the
channels to be released, the routine exits with the error
ADIOERR ALLOCFAILED.
If the channels could not be allocated, you get the bit combination of
the allocated channels in * Au d i 0_ D e vic e _ B 1 c k >ioa Request. io unit. It is important to know which channels
were actually allocated(more on this later). With multiple statements
of the channels to be allocated in the Channel_Map (up to 16),
ADCMD_ALLOCATE searches for the combination that requires the
least wait time.
Audio_NoAllocO
(Audio_Support) *
* Return value:
*
*
*------=------=------------------------------------------------*
*
* TRUE: No allocation
* FALSE: Allocation successful
*
*
***************************************************************/
ISO
ABACUS
period
(frequency) and volume are also set. You can also do this for each
period with the help of an audio command.
OpenDevice () . When the ADIOF _PERVOL flag is set, the
4.11.2
(Audio Support) *
*
*--------------------------------------------------------------*
* Input - Parameter:
*
***************************************************************/
BYTE Audio Pervol (Audio Device Block, Period, Volume)
struct IOAudio
*Audio_Device_Block;
UWORD
Period;
UWORD
Volume;
{
Audio_Device_Block->ioa_Request.io_Flags
ADIOF SYNCCYCLE;
Audio Device Block->ioa Period
Audio-Device-Block->ioa-Volume
(OOYTE)
=
=
Period;
Volume;
This routine can tell whether the volume should be set before or after
OpenDevice () The io_Device pointer as well as all unset
variables should equal zero before calling OpenDevice () , because
the allocation of the audio device block (GetDeviceBlock () ) has
been executed through AllocMem () with the MEMF PUBLIC and
MEMF_CLEAR parameters.
151
4. DEVICES
Three options exist for setting the volume and period. The
ADIOF_PERVOL flag. used in conjunction with CMD_WRITE (sound
output) has the same function as when used in conjunction with
OpenDevice () . Before we get to the sound output itself. let's take a
closer look at the period and the volume.
We mentioned that the word period refers to the frequency of the sound
The period measurement requires a few simple calculations. For
example, a period value of 20000 means more than just an output of
20000 bytes per second. You can calculate the period from two items:
1.)
2.)
Period
= _ _ _ _. .:;1_ _ __
40 * 440 * 28 * 10- 8
202.922 .. 203
*
*
Audio_Period()
(Audio_Support) *
*
*
152
*
*
ABACUS
*
*
* Calculated period
*~**************************************************** *********1
Assuming that our waveform only consists of one byte, this is then
given as the highest frequency:
Hz
10000000L/(1*124*28) = 28800
s~-1;
We need a little more arithmetic to set the volume. The volume can
range from zero (soft) to 64 (loud). The volume curve is linear.
Note:
Set the period and volume to zero before using CMD_WRITE for the
fust time. If you don't do this, data displayed through CMD_ WRI TE
may also play over the sound channels as blips.
4.11.3
Play it
Now we come to the frequently mentioned CMD_WRITE command We
have also included this in a short routine:
1***************************************************** **********
Audio_Write()
(Audio_Support) *
*
*
*
153
4.
DEVICES
* Cycles:
* ComeBack:
*
*
*--------------------------------------------------------------*
* Return value:
*
*
= WaveForm;
Wavelength;
Cycles;
(UBYTE) 0;
= (OWORD)
=
=
CMD_WRlTE;
if (ComeBack) SendIO
else
0010
We must provide the device block with which the device was opened, as
with all of the audio_support routines.
WaveForm and WaveLength designate the waveform to be
displayed. WaveForm contains the starting address of the byte array in
which the wavefonn is located. WaveLength contains the number of
bytes needed to describe the wavefonn, rather than the wave length of
the resulting sound
Cycles designates the repetition rate of a wavefonn. For example, if
you want the given wavefonn to play only once, you must state the
value 1 for Cycles. The higher the value for Cycles, the more
times the wavefonn repeats.
When you want unlimited repetitions, enter the value zero for
Cycles. Then your wavefonn plays for eternity, assuming that your
channels aren't stolen. A change in the wavefonn can occur when the
indicated location is displayed Please remember that the sound data in
the chip memory must be released As you know, the address bus of the
custom chips (Blitter, Paula, Agnus, Denise, Copper) contains only 19
address connections. This addresses the bottom section of memory (or
the bottom 512K).
154
ABACUS
4.11.4
*
Audio Lock()
* Function: Protect channel before new access
(Audio_Support) *
*
*--------------------------------------------------------------*
* Input - Parameter:
*
* Audio Device Block: Device-Block of the channels that
*
should be protected.
* Return value:
* Addess of the Lock
*
*
*
*--------------------------------------------------------------*
****************************************************** *********1
AUdio_Channel_StolenO
(Audio_Support) *
*
*
*--------------------------------------------------------------*
ISS
4.
DEVICES
*
*
* Lock: Device-Block of the Lock, that should be tested.
*
*--------------------------------------------------------------*
* Return value:
* Input - Parameter:
*
*
*
*
*
if (CheckIO (Lock) != 0)
return (TRUE);
else
return (FALSE);
This short routine tests if the LOCK command has ended (CheckIO ()
!... 0) or if the access right consists of the allocated channels. You
may be wondering how you can OU!put the data if you locked the audio
channels. The ADCMD_LOCK command ends these channels when the
channels are stolen. Processing the two device commands with the
device block cannot be done at the same time.
A second device block must come into play. This is configured the
same as other device blocks, using GetDeviceBlock () Then it
must ensure that you can also use the new device block. For this we
have developed a copy function that also copies the AllocKey that is
necessary for identifying the user of the audio device:
1***************************************************** **********
*
Audio Copy ()
* Function: Device-Block copy-
(Audio Support) *
*
*--------------------------------------------------------------*
* Input - Parameter:
*
*
* Old Audio Block: Original
*
* New-Audia-Block: Copy
****************************************************** *********1
VOID Audio Copy (Old Audio Block, New Audio Block)
struct IOAudio *old-Audio-Block, *New-Audio-Block;
{
--
Old_Audio_Block->Ioa_Request~io_Device;
When you want to leave the program. you cannot simply exit and leave
the locked channels locked. In certain cases this would hinder every
other sound output. because only channel applications with a lower
156
4.11
ABACUS
*
*
*--------------------------------------------------------------*
* Input - Parameter:
*
* Lock:
*
*
***************************************************************/
(UWORD)ADCMD_FREE;
FreeDeviceBlock(Lock);
This routine frees the channels from your exclusive access and frees the
previously allocated device block. Another, less elegant option exists
for protecting channels from outside access: Set the precedence at 127.
You can do this during allocation, or using the ADCMD_SETPREC
command:
/***************************************************************
*
Audio SetPrecedence ()
(Audio Support) *
* Function: Chaneg precedence
*
*--------------------------------------------------------------*
* Input - Parameter:
*
157
4.
DEVICES
You now have the software means of writing your own sound
programs. The following example is an example sound program.
Combine the Audio_Support routines to form the Audio_Support.c
fIle, don't forget the proper include fIles. Be careful of the order of the
routines since Audio_Lock calls Audio_Copy.
1***************************************************** **********
*
*
SoundEdi tor. c
(c) Bruno Jennrich
August 1988
*
*
***************************************************************1
1***************************************************** **********
* Compile-Info:
* cc SoundEditor
* In SoundEditor.o Audio_Support.o Devs_Support.o -lc
*
*
*
***************************************************************1
ilinclude "exec/types.h"
'include "exec/memory.h n
'include "exec/devices.h"
ilinclude "intuition/intuition.h"
tinclude "intuition/intuitionbase.h"
tinclude "graphics/gfxbase.h"
tinclude "graphics/gfxmacros.h"
'include "devices/audio.h"
'define ScreenHeight 200L
/* Editor-Screen */
'define ScreenWidth 3120L
'define ScreenDepth 2L
'define ScreenMiode
OL
'define ERROR
100
'define AUDIO LEN
(ULONG) (sizeof (struct IOAudio))
VOID *OpenLibrary();
VOID *OpenScreen();
VOID *OpenWindow();
VOID *AllocMem();
VOID *GetDeviceBlock()
VOID *Audio Lock();
struct Screen *Screen=Ol;
struct Window *Window=Ol;
struct NewScreen NewScreen;
struct NewWindow NewWindow;
struct GfxBase
*GfxBase=Ol;
struct IntuitionBase *IntuitionBase=Ol;
/* Audio-Device relevant structures */
'define Left Channel 0 1
'define Right Channel 1 2
'define Right-Channel-2 4
'define Left Channel 3 8
'define SoundPrecedence (BYTE) -40
struct IOAudio *Left Side
=01,
*Right Side
=01,
*Left Lock
=01,
*Right Lock
=01;
BYTE *WaveLeft = 01;/* Wave form definition (signed) */
BYTE *WaveRight = 01;
UBYTE
Left_Channels[]
{Left_Channel_O, Left_Channel_3};
UBYTE
Right_Channels[]
(Right Channel I, Right Channel 2);
/*-Channel-Map */
/* allocat; right and left */
/* channels
*/
'define CHANNELS LEFT
(ULONG) sizeof ( Left_Channels)
158
ABACUS
'define CHANNELS_RIGHT
1***************************************************** **********
*
Closelt ()
* Function: Close and free everything
(User) *
*
*--------------------------------------------------------------*
* Input - Parameter:
* String: Error-String
*
*
****************************************************** *********1
InstallScreenWindow ()
Function: Editor Window and Screen initialization
(User) *
***************************************************************/
VOID Insta11ScreenWindow ()
{
NewScreen.LeftEdge
NewScreen.TopEdge
NewScreen.Width
NewScreen.Height
NewScreen.Depth
NewScreen.DetailPen
NewScreen.B1ockPen
NewScreen.ViewModes
NewScreen.Type
NewScreen.Font
NewScreen.Defau1tTit1e
NewScreen.Gadgets
NewScreen.CustomBitMap
NewWindow.LeftEdge
NewWindow.TopEdge
NewWindow.Width
NewWindow.Height
NewWindow.DetailPen
NewWindow.BlockPen
NewWindow.IDCMPF1ags
NewWindow.Flags
NOCAREREFRESH;
NewWindow.FirstGadget =
0;
0;
ScreenWidth;
ScreenHeight;
ScreenDepth;
1;
0;
ScreenMode;
CUSTOMSCREEN;
(struct TextAttr *) 01;
(UBYTE *) " (c) Bruno Jennrich";
(struct Gadget *) 01:
(struct BitMap *) 01;
0;
0;
ScreenWidth;
ScreenHeight;
1;
0;
0;
BORDERLESS I ACTIVATE I RMBTRAP I
(struct Gadget *) 01;
159
4.
DEVICES
NewWindow.CheckMark
NewWindow.Title
NewWindow.Screen
NewWindow.BitMap
NewWindow.MinWidth
NewWindow.MaxWidth
NewWindow.MinHeight
NewWindow.MaxHeight
NewWindow.Type
0;
0;
0;
0;
CUSTOMSCREEN;
/***************************************************************
OpenScreenWindow ()
(User) *
***************************************************************/
VOID OpenScreenWindow ()
{
InstallScreenWindow();
Screen = (struct Screen *) OpenScreen (&NewScreen);
if (Screen == 01) Closelt ("Couldn4t get Screen !n);
NewWindow.Screen = Screen;
Window = (struct Window *) OpenWindow(&NewWindow);
if (Window == 01) Closelt ("Couldn4t get Window !n);
1***************************************************** **********
CloseScreenWindow ()
(User) *
***************************************************************/
VOID CloseScreenWindow()
{
CloseWindow (Window);
CloseScreen (Screen);
1***************************************************** **********
OpenLibs ()
Function: Open libraries
(User) *
***************************************************************/
VOID OpenLibs ()
{
*
CloseLibs ()
* Function: Libraries close
(User) *
****************************************************** *********1
VOID CloseLibs ()
{
CloseLibrary (GfxBase);
CloseLibrary (IntuitionBase);
1***************************************************** **********
(User) *
*
The Audio Device ()
* Function: Use Audio-Device
-
****************************************************** *********1
160
AIACUS
The_Audio_Device()
{
UWORD i,j;
*
Close Audio Device ()
* Function: Free channels and-close-Audio-Device
(User) *
*
***************************************************************/
*
* Function: Wave form editor
Edit()
(User) *
***************************************************************/
Edit ()
{
WORD
ULONG
i;
x,y;
WaveLeft [i] = 0;
161
4.
DEVICES
WaveRight[i] = 0;
}
x = Screen->MouseX;
y = Screen->MouseY;
if (WaveLeft~x] != (ScreenHeight/2-y
(
Move (Window->RPort,x,ScreenHeight/2);
Draw (Window->RPort,x,ScreenHeight/2-WaveLeft[x]);
WaveLeft[x] = (ScreenHeight/2-y);
WaveRight[x] = WaveLeft[x];
Move (Window->RPort,x,ScreenHeight/2);
Draw (Window->RPort,x,ScreenHeight/2-WaveLeft[x]);
1***************************************************************
main()
(User) *
*
***************************************************************/
main 0
{
Double
buffering
162
ABACUS
This has a disadvantage: You can hear blips between the end of the
previous sound and the start of the next sound. This is because the
audio DMA channels pause long enough to look for the next ftle. This
can be heard in the form of noise between the end of the old
CMD_ WRI TE and the beginning of the new one.
You can create a double buffer for holding data. Double buffers are most
often used in graphic programming. When you employ the technique of
double buffering, these disturbing noises are no longer heard. The sound
output results in the following scheme:
Play start sound
Loop:
calculate new sound
(or load this from diskette)
send write command for the new sound
wait until the end of the old sound
(here the new sound is played)
calculate another sound
send write command for another sound
wait for the old sound
repeat loop
Write commands and copies from the device blocks are listed internally
and processed according to the order. For this reason the CMD_WRITE
command does not break out for the same channels. Here's the double
buffer program:
/***************************************************************
*
*
*
*
*
Double.c
(c) Bruno Jennrich
August 1988
* Compile-Info:
* cc Double
* In Double.o Audio Support.o Devs Support.o -lc
*
*
***************************************************************/
!tinclude "exec/types.h"
!tinclude "exec/memory.h"
!tinclude "exec/devices.h"
!tinclude "devices/audio.h"
IIdefine AUDIO_LEN
(ULONG) (sizeof (struct IOAudio
VOID *OpenLibrary();
VOID *AllocMem();
VOID *GetDeviceBlock();
VOID *Audio Lock();
/* Audia-Device relevant structures */
IIdefine Left Channel 0 1
idefine Right Channel 1 2
idefine Right=Channel=2 4
!tdefine Left Channel 3 8
IIdefine SoundPrecedence (BYTE) -40
Ide fine WaveLength1 3201
IIdefine WaveLength2 6001
struct IOAudio *FirstPlay
=01,
*SecondPlay
=01,
*FirstLock
=01,
*secondLock
=01;
char *FirstWave = 01;
/* Wave form definition (signed) */
163
4.
DEVICES
*
CloseIt ()
* Function: Close and free everything
(User) *
*
*--------------------------------------------------------------*
* Input - Parameter:
* String: Error-String
*
*
***************************************************************/
UWORD i;
UWORD *dff180 = (UWORD *)Oxdff180;
UWORD Error;
if (strlen (String) > 0)
for (i=O;i<Oxffff;i++) *dff180 = i;
puts (String);
if (FirstLock != 0)
Audio Free (FirstLock);
Audio-Free (SecondLock);
i f (SecondLock ! = 0)
if (SecondPlay != OL)
FreeDeviceBlock (SecondPlay);
if (FirstPlay != OL)
Close A Device (FirstPlay);
if (FirstWave != 0)
FreeMem-(FirstWave,WaveLengthl);
FreeMem (SecondWave,WaveLength2);
if (SecondWave != 0)
exit (10);
1***************************************************** **********
*
The_Audio_Device!)
(User) *
*
*
***************************************************************/
The_Audio_Device()
{
UWORD i, j;
UBYTE *bfeOOl = (UBYTE*) OxbfeOOl;
FirstPlay = (struct IOAudio *) GetDeviceBlock (AUDIO_LEN);
SecondPlay = (struct IOAudio *) GetDeviceBlock (AUDIO_LEN);
FirstPlay->ioa Data
= (UBYTE *)Channels;
FirstPlay->ioa-Length = CHANNEL SIZE;
FirstPlay->ioa-Request.io Message.mn Node.ln Pri =
SoundPrecedence; Open_A_Device ("audio.device",OL,&FirstPlay,Ol,Ol);
Audio Copy (FirstPlay,SecondPlay);
FirstLock = Audio Lock (FirstPlay);
SecondLock = Audio-Lock (SecondPlay);
/* No sound output-*/
Audio Pervol (FirstPlay, (UWORD) 0, (UWORD) 0);
for (i=O;i<WaveLengthl;i++)
FirstWave[il
= 0;
for (i=0;i<WaveLength2;i++)
SecondWave[il
= 0;
Audio Pervol (FirstPlay, (UWORD) 1500, (UWORD)64);
for (i=0;i<WaveLengthl;i+=2) FirstWave[il = 128;
for (i=0;i<WaveLength2;i+=4) SecondWave[il = 128;
/* Calculate FirstWave (already done ) */
Audio_Write (FirstPlay,FirstWave, (ULONG) 320,
(OWORD) 1, (BOOL) TRUE);
164
ABACUS
== Ox40)
WaitIO (FirstPlay);
/* FirstWave new calculation (not already done here!) */
Audio Write (FirstPlay,FirstWave, (ULONG) WaveLength1,
(UWORD) 1, (BOOL) TRUE);
WaitIO (SecondPlay);
Audio Free (FirstLock);
Audio:=Free (SecondLock);
FreeDeviceBlock (SecondPlay);
Close_A_Device (FirstPlay);
1***************************************************************
*
main 0
(User) *
***************************************************************/
main()
I
FirstWave = (BYTE *) AllocMem
(WaveLength1, (ULONG)MEMF CHIPIMEMF CLEAR);
SecondWave = (BYTE *) -AllocMem (WaveLength2, (ULONG)MEMF CHIP IMEMF CLEAR);
if (FirstWave == 0) CloseIt ("No Memory for Wave 1 ! ");
if (SecondWave == 0) Closelt ("No Memory for Wave 2 !");
The Audio Device();
FreeMem (FirstWave,WaveLength1);
FreeMem (SecondWave,WaveLength2);
The audio device uses commands other than those described above.
These are not especially important. and you may never need them.
We1llist the rest for the sake of completeness. though:
1***************************************************************
*
Audio Read()
* Function: Find out actual Write-Device-Block
(Audio Support)*
*
*--------------------------------------------------------------*
* Input - Parameter:
*
*
* ReadRequest: Device-Block
* Channel:
Channel (0,1,2,3) whose Write-Block should
*
be found
* Return value:
* Addressof the Device-Block, for the output of the given
* channel or -1 if no CMD WRITE is in operation
*
*
*--------------------------------------------------------------**
***************************************************************1
UBYTE *Audio Read (Read Request,Channel)
struct IOAudio
*Read:=Request;
ULONG
Channel;
I
Read Request->ioa Request.io Unit
(struct Unit *)
Channel;
printf (nio Unit %ld\n",Read Request->ioa Request.io Unit);
Read_Request->ioa_Request.io:=Flags
(uBYTE)
ADIOF SYNCCYCLE;
Read Request->ioa Request.io Command = (UWORD) CMD_READ;
DOIO-(Read Request);
if (Read_Request->ioa_Request.io_Error != 0)
165
4.
DEVICES
return UBYTE*)Oxffffffff);
return(Read_Request->ioa_Data);
This function gives you the address of the audio device block. The
device block is necessary for sound output on a specific channel. The
bit belonging to the channel is given in the channel and passed to the
unit element of the audio device block. After CMD_READ. either the
address of the audio device block that propels a CMD_ WRI TE command
to the given channel or the value zero is in i oa_ Da t a when the given
channel is not currently described.
The CMD_READ function determines the sound precedence of another
audio device user. This helps improve your odds of getting a channel.
ADCND WAITCYCLE
The above routine syncronized the execution of the command with the
end of the sound output using the SYNCCYCLE flag. We can also
perform this synchronization through an audio device command:
This command first returns to the program when the played cycle ends.
ADCND RESET
This command resets the audio device to exit status:
CND FLUSH
This command stops all current write requests and all of the listed
(double buffering) write requests:
(Audio_Support) *
*--------------------------------------------------------------*
* Input - Parameter:
* AudiO_Device_Block: Device-Block, whose sound should be
*
stopped
* Sync:
Is end of sound schronized with end of
cycle
*
*
*
*
*
*
***************************************************************/
VOID Audio Finish (Audio Device Block,Sync)
struct IOA~dio
*Audio=Device=Block;
166
ABACUS
Sync;
BOOL
{
If you want to synchronize the interruption of the actual sound with the
end of the sound output, you must give the value TRUE as the Sync
parameter in Audio_Finish (). Now the SYNCCYCLE flag is seL
This flag is responsible for the synchronization. ADCMD_FINISH
ensures that the listed write requests are acquired for execution. That is
the difference between this command and CMD FLUSH.
am
START
and
CMD STOP
4.11.5
ADCMD PERVOL
ADCMD SETPREC
ADCMD WAITCYCLE
CMD FLUSH
CMD RESET
CMD START
CMD STOP
CMD WRITE
167
4.
DEVICES
4.12
If enough memory exists for the phoneme, Error contains the value
zero. If E r ro r is unequal to zero, the absolute value of the error
(Error is given with a minus sign) gives the location in the input
168
4.12
ABACUS
You can then output the phoneme string that was created from
Translate through the narrator device. For this you must open the
narrator device:
ide fine NARRAT RB LEN sizeof(struct narrator_rb)
struct narrator_rb *WriteRequest = OL;
Open_A_Device("narrator.device", OL, &WriteRequest, OL,
NARRAT_ RB_LEN) ;
Structure
struct narrator rb
!/* defined in "devices/narrator.h" */
0
14
16
18
20
22
26
28
30
32
33
OxOO
OxOe
OxlO
Ox12
Ox14
Ox16
Oxla
Oxlc
Oxle
Ox20
Ox21
34 Ox22
35 Ox23
36 Ox24
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
The narrator device uses the above device block mainly for output. For
reading it uses another block:
Offset
Structure
-------{f*
0
36
37
38
39
40
OxOO
Ox24
Ox25
Ox26
Ox27
Ox28
struct mouth rb
defined in "devices/narrator.h" */
narrator_rb voice;
struct
UBYTE
width;
/* Mouth width */
UBYTE
height;
/* Mouth height */
shape;
/* internal ! */
UBYTE
pad;
/* even address */
UBYTE
As you can see from the name of this structure (mouth) and the
comments, this structure reads the mouth form created through the
spoken word.
169
4. DEVICES
1*
*1
1* Function:
Narrator-Output
*1
1*--------------------------------------------------------*1
1* WriteRequest: IO-Block, through twhich the speech
*1
1*
output should be directed
*1
1* string:
string to be output
*1
1* rate:
Words per minute (40-400)
*1
1* pitch:
Basic tone pitch (65-320)
*1
1* mode:
robot (1) or natural (0)
*1
1* sex:
Sex (0 manl11 female)
*I
1* Channels:
Channel-Map
*1
/* Size:
sizeof (Channel-Map)
*/
/* vol:
Vlourre (0-64)
*/
/* freq:
Output frequency (5000-28000)
*I
1* mouths:
Generate mouth form (1)
*1
1***************************************************** *****/
VOID Narrator Write
(WriteRequest,string, rate, pitch, mode, sex,Channels,Size,vol,freq,
mouths)
struct narrator rb
*WriteRequest;
char
*string;
UWORD
rate, pitch, mode, sex;
UBY'l'E
*Channels;
UWORD
Size,vol,freq,mouths;
(
*1
*/
*1
*1
sex;
Channels;
Size;
vol;
freq;
= mouths;
170
(APTR) SpokenString;
(ULONG) strlen
(UWORD) CMD_WRITE;
4.11
ABACUS
- (UBYTE) 0;
= (UBYTE) 0;
= (UWORD) CMD READ;
0:
U );
--
DolO (ReadRequest):
Mouth Routine (ReadRequest->width, ReadRequest>height,Mouth Rout Count);
-1* as long as it can be read, it is read *1
1* and Mouth Routine() is called
*1
Mouth_Rout_Count++;
FreeDeviceBlock (ReadRequest);
Mouth_Expunge();
1* End Mouth_Routine *1
else DolO (WriteRequest):
Rate represents the number of words per minute output. The larger
rate is. the faster the words are spoken. Values for rate can range
from 40 to 400.
The pi tch parameter represents the pitch at which the Amiga should
speak. Values for pi tch range from 65 to 320.
A natural voice deviates from its standard pitch (Le. the voice's pitch
,raises and lowers). The mode parameter controls this deviation. If you
want the Amiga voice to speak in a monotone fashion. set the mode
171
4.
DEVICES
...
172
4.12 THE
ABACUS
NARRATOR DEVICE
/*
/*
/*
The-Narrator-Device
(c) Bruno Jennrich
*/
*/
*/
/************************************************/
1************************************************/
/* Compile
info:
*/
/*----------------------------------------------*/
/* cc Say.c
*/
/* In Narrat Support.o Say.o Devs Support.o -lc */
/************************************************/
#include "exec/types.h"
#include "exec/types.h"
#include "exec/memory.h"
ilinclude "exec/devices.h"
hnclude "intuition/intuition.h"
hnclude "intuition/intuitionbase .h"
hnclude "graphics/gfxbase.h"
#include "graphics/gfxmacros.h"
#include "libraries/translator. h"
#include "Narrat_Support.h"
#include "devices/narrator.h"
#define WIDTH 150
/* size of the mouth window */
ildefine HEIGHT 75
/* functions used */
VOID *OpenLibrary();
VOID *OpenWindow();
OL; /* Libraries*/
struct Library
*TranslatorBase
struct IntuitionBase *IntuitionBase
OL;
OL;
*GfxBase
struct GfxBase
/* Window Defs */
NewWindow;
struct NewWindow
OL;
struct Window
*Window
173
4. DEVICES
*WriteRequest
UWORD Error = 0, i;
UWORD *dff180
(UWORD *)Oxdff180; /* background color
register */
if (strlen(String) > 0)
{
/*
Mouth Init ()
(User) * /
/* Function: Mouth initialization routine
*/
1**********************************************************1
VOID Mouth_Init()
{
174
ABACUS
NeWWindow.MaxHeight
= 0;
NeWWindow.Type
= WBENCHSCREEN;
if Window = (struct Window
OpenWindow(&NewWindow
Closelt (IfNo Window !!! If);
SetAPen(Window->RPort, 2);
SetDrMd(Window->RPort, (ULONG) (COMPLEMENTIJAM1;
*)
0)
1***************************************************** *****/
/*
Mouth Expunge ()
/*
(User) * /
/* Function:
*/
*/
1**********************************************************1
/*
/*
/* Function:
Mouth Routine ()
Mouth Routine
/* width:
/* height:
(User) * /
*/
*/
/*--------------------------------------------------------*/
*/
*/
/**********************************************************/
(WIDTH/2),
(ULONG) (HEIGHT/2-
(WIDTH/2),
(WIDTH/2-width),
(WIDTH/2+width),
(WIDTH/2),
(ULONG) (HEIGHT/2-
(WIDTH/2),
(WIDTH/2-width),
(WIDTH/2+width),
1*****************************************************/
/*
The Narrator Device ()
(User) * /
/*
*/
/* Function: use narrator device
*/
/*---------------------------------------------------*/
175
4.
DEVICES
1*
1*
1*
1*
1*
1*
1*
1*
1*
1*
*1
*1
*1
*1
*1
*1
*1
*1
*1
*1
Input Parameters:
string:
rate:
pitch;
mode:
sex:
vol:
freq:
mouths:
output string
Words per minute
basic frequency
robotic or human
sex
volume
Sampling frequency
generate mouth form?
1*****************************************************/
TranslatorBase
OpenLibrary(ntranslator.library", OL);
if (TranslatorBase == OL) Closelt ("NoTranslatorBase n );
Open_A_Device(nnarrator.device n , OL, &WriteRequest, OL,
MOUTH RB LEN);
Narrator Write
~rlteRequest, string, rate, pitch, mode, sex, Channels,
(UWQRD)sizeof (Channels), vol, freq, mouths);
Close A Device(WriteRequest);
CloseLibrary(TranslatorBase);
/*****************************************************/
1*
AtoUWORD ()
(User) * 1
1*
*1
1* Function: change number string (ASCII) after UWORD*I
1*---------------------------------------------------*1
1* Input Parameters:
*1
1*
*1
1* Bufpointer: number string to change
*1
1*---------------------------------------------------*1
1* Return value: value of the numeral string
*1
/*****************************************************/
UNORD AtoUNORD(BufPointer)
char
*BufPointer;
{
UWOlID Result;
Result = 0;
while (*BufPointer
, ') BufPointer++;
*1
while (*BufPQinter != '\000')
{
Result *= 10;
Result += * (BufPointer++) - '0';
return (Resul t) ;
/*****************************************************/
1*
main()
*1
/*****************************************************/
UWORD Param[7];
ULONG i;
Param[O]
Param[l]
176
DEFRATE;
DEFPITCH;
1* rate
1* piteh
*1 1* Defaults *1
*1
ABACUS
Pararn[2]
DEFMODE;
1* mode
*1
Pararn[3]
DEFSEX;
1* sex
*1
Pararn[4]
DEFVOL;
1* volume
*1
Pararn[S] = DEFFREQ;
1* frequency *1
Pararn[6]
1;
1* mouths
*1
if ((arge < 2) II (arge > 9
printf ("Usage: SAY \ "string" U [rate] [pitch] [mode] [sex]
[volume] [sampfreq] [mouths]\n");
else
{
for (i z O;iargc-2);i++)
Param[i] = AtoUWORD (argv[i+2]);
The Narrator Device
(argv[l],-Param[O], Param[l], Param[2], Param[3],
Pararn[4], Param[S], Param[6]);
}
}
The f-ollowing routine lists still more narrator iupport routines. From
these yoo can see which col'l!UB8Dds t.hI narrator device supports:
/**********************************************************/
1*
Narrator Copy ()
(Na.rrat Support) * I
1*
*1
1* Function: Narrator-Device-BlocK copy
*1
1*--------------------------------------------------------*1
1* Old_Request: Original IG-BlocK
*1
1* New Request: CGPY of the IO-JUocka
*I
'***************************************************** *****1
/**********************************************************/
1*
1*
Narrator stop ()
/* Function:
(lliarrat Support) * /
*1
*/
1*--------------------------------------------------------*1
1* WriteRequest: IO-BlocK, whose output should IDe stoppea *1
/*********** ***************************************.*****/
/***************************************************** *****1
Narrator start ()
(lIIarra.t Support) *1
1*
1*
*1
177
4.
DEVICES
/* Function:
*/
/*---------------------------------------------------- ----*/
/* WriteRequest: IO-Block, whose output should be started */
/*
(after Narrator Stop () )
*/
1***************************************************** *****/
WriteRequest->message.io Command
DoIO (WriteRequest);
-
(UWORD) CMD_START;
/**********************************************************/
/*
/*
/* Function:
Narrator Flush ()
End Narrator output
(Narrat Support) * /
*/
*/
/*---------------------------------------------------- ----*/
/* WriteRequest: la-Block, whose outpur should be ended
*/
1**********************************************************1
(UWORD) CMD_FLUSH;
1***************************************************** *****/
/*
/*
/* Function:
Narrator Reset ()
(Narrat Support) */
*/
Narrator-Device rest to known condition */
/*---------------------------------------------------- ----*/
/* WriteRequest: la-Block, through which the Narrator
*/
/*
Device is reset
*/
1***************************************************** *****/
(UWORD) CMD_RESET;
178
Narrator_Copy();
Narrator_Stop();
Narrator Start();
Narrator=Flush();
Narrator_Reset();
Narrator_Write();
ABACUS
4.13
Ox2a
-Ox30
-Ox36
*
Wait Time ()
(Timer Support) *
* Function: Wait for a predetermined amount of time
*
*--------------------------------------------------------------*
* Input - Parameter:
*
* TimeRequest: Timer-Device-Block
*
*
* Secs,Micro: Wait for how many seconds and microseconds?
***************************************************************/
179
4.
DEVICES
Sees;
Micro;
The seconds and microseconds are given to the timer device block as
parameters. and the TR ADDREQUEST command is called. This
routine flfSt returns when-the given time elapses. Remember that with
UBIT_ VB LANK the exact statement of microseconds is meaningless.
Enter the value zero here.
Let's take a closer look at the timer request structure:
Offset
Structure
struct timerequest
D DxDO
32 Dx2D
40 Dx2B
Structure
struct timeval
o OxOD
4 Ox04
B Ox08
ULONG tv_secs;
ULONG tv micro;
/* defined in "devices/timer.h" */
This structure contains all of the times to be set or read. For example.
if you want to read the system time, it is transferred to these variables:
1***************************************************** **********
GetSysTime()
* Function: Find out system time
(Timer_Support) *
*
*--------------------------------------------------------------*
* Input - Parameter:
* TimeRequest: Timer-Device-Block
* Return value:
* Pointer to Timeval structure of the Timer-Device-Block
*
*--------------------------------------------------------------*
***************************************************************/
180
4.12
ABACUS
You get the timeval Structure of the device block with the actual
system time with Timel
(struct
timeval
*)
Get SysTime
(timeRequest) . The system time returns the
current system time and the current date.
There's no problem calculating the system time with the realtime
clock. What does the user do if he doesn't have such a clock? He must
always set the time and date by hand. When writing to disk, the time of
this disk change is saved to the boot block, which is read with every
boot and declares the current system time. Naturally many
inconsistencies are encountered which you should be able to fix with
the help of eLI commands.
Now we come to how the system is decoded. The internal clock counts
in seconds, starting from January 1, 1978. When you want to display
the system (given in seconds and microseconds) in a format that the
user can understand, some calculations must be made:
ULONG Days_of_Months[]
char *Days_of_Week[]
{311,
281,
311,
301,
311,
301,
311,
311,
301,
311,
301,
311
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
Jan
Feb
Mdr
Apr
Mai
Jun
Jul
Aug
Sep
Okt
Nov
Dez
{"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday ",
"Friday",
"Saturday "};
1***************************************************** **********
*
LeapYear ()
* Function: Is year a LeapYear?
(TimerSupport) *
*
*--------------------------------------------------------------*
* Input - Parameter:
*
* Year: Year to select
*
*--------------------------------------------------------------*
* Return value:
* TRUE: Year IS LeapYear
* FALSE: Year is NOT LeapYear
*
*
*
***************************************************************/
181
4.
DEVICES
1***************************************************** **********
HakeMonthTable ()
(TimerSupport) *
*
* Function: Update month day table (29 or 28. February?)
*--------------------------------------------------------------*
* Input - Parameter:
*
*
* Year: Year to select
* Table: Address of th Month day table (i.e. Days of Month)
*
****************************************************** *********1
VOID HakeMonthTable (Year, Table)
ULONG
Year;
ULONG
*Table;
{
if (LeapYear (Year
Table [1]
29;
else
Table [1]
28;
1* If year u sleapyear, set February to
1* instead of 28
29 days *1
*1
1***************************************************** **********
*
SysTime to TimeDate ()
(TimerSupport) *
*
* Function: Transfer system time to Timedate structure
*--------------------------------------------------------------*
*
*
*
* Input - Parameter:
* TimeRequest: Timer-Device-Block
* TimeDate:
TimeDate structure to fill
***************************************************************/
*1
0*1
182
ABACUS
SysTimeSecs -= SecondsPerLeapYear;
TimeDate->Year++;
all_Days += 3661;
/* a LeapYear */
SysTimeSecs -= SecondsPerYear:
TimeDate->Year++;
all_Days += 3651;
Structure
struct TimeDate
o
4
8
12
16
20
24
28
OxOO
Ox04
Ox08
OxOc
Ox10
Ox14
Ox18
Ox2c
ULONG
ULONG
ULONG
ULONG
ULONG
ULONG
ULONG
ULONG
Year;
Month;
Day;
Week;
Week Day;
Hour;
Mins;
Secs;
1*
1*
1*
1*
/*
/*
1*
1*
year *1
Month */
day of the month */
week of the year */
Week day (O==Sonntag etc.) *1
hour *1
Minute *1
Seconds *1
183
4. DEVICES
Program description
After the system time loads and the program is instructed to read
seconds instead of microseconds, the routine checks for a current system
date earlier than 1980. Because 1980 is a leap year, a loop searches
through proceeding years.
To find out the number of years that have elapsed, the program
subtracts the number of seconds that have elapsed in a year from the
current system time until the result of this subtraction is less than a
year. Leap years are determined using the Leapyear () function.
Once you determine the correct year, you can calculate the month.
Because the 12 months in a year have different number of days, the
subtraction from the current system time becomes more complicated. If
a year is a leap year, the MakeMonth () routine sets the number of
days in February to 29 rather than 28.
Dividing the remaining number of seconds by the number of seconds in
a day gives us the day of the month. This method is adapted to find the
hours, minutes and seconds. When subtracting seconds you subtract the
calculated number of days/hours/minutes/etc. The remaining seconds
give the seconds within the current minute.
Adding the number of elapsed days gives us the weekday. Next the
program divides the number of days elapsed since January I, 1978 by
seven; the remainder gives the current weekday. You can display the
corresponding weekday with printf ("%s\n", Days_of_Week
[TimeDate->WeekDay] ) ;.
SecondsPerMinute
SecondsPerHour
SecondsPerSay
SecondsPerYear
SecondsPerLeapYear
(ULONG)
(ULONG)
(ULONG)
(ULONG)
(ULONG)
(60L)
(60L*60L)
(60L*60L*24L)
(60L*60L*24L*365L)
(60L*60L*24L*366L) 1* leap
year *1
(ULONG) (2L*SecondsPerYear)
1* Seconds from *1
1* 1.1 1978 up *1
1* to 1.1 1980 *1
184
4.12 THE
ABACUS
* TimeDate:
NARRATOR DEVICE
***************************************************************/
ULONG i;
ULONG SysTimeSecs=Ol;
if (TimeDate->Hour > 24) return (TDERR HOUR OUT OF RANGE);
if (TimeDate->Mins > 59) return (TDERR-MINS-OUT-OF-RANGE);
if (TimeDate->Secs> 59) return (TDERR=SECS=OUr::~OF=RANGE);
i f TimeDate->Year < 19781) "
(TimeDate->Year > 21141
return (TDERR_YEAR_OUT_OF_RANGE);
1* TimeDate test *1
if (TimeDate->Month > 12)
return (TDERR MDNTH OUT OF RANGE);
if TimeDate->D~y > D~ys of Months[TimeDate->Month-1) I I
(TimeDate->Day == 0- return (TDERR DAY OUT OF RANGE);
SysTimeSecs = TimeDate->Hour*SecondsPerHour+
TimeDate->Mins*SecondsPerMinute+
TimeDate->Secs+
(TimeDate->Day-1)*SecondsPerDay;
1* hours, minutes, seconds and *1
1* days change after seconds *1
MakeKonthTable (TimeDate->Year,Days of Months);
1* February 28 or 29 days? *1
for (i=01;iTimeDate->Month-11);i++)
SysTimeSecs += Days of Months[ij*SecondsPerDay;
- 1* Month after seconds *1
for (i=19781;i<TimeDate->Year;i++)
if (LeapYear (i SysTimeSecs += SecondsPerLeapYear;
else
SysTimeSecs += SecondsPerYear;
1* Year after seconds *1
SetSysTime(TimeRequest,SysTimeSecs,Ol);
1* Set new system time *1
*--------------------------------------------------------------*
* Input - Parameter:
* TimeRequest: Timer-Device-Block
* Secs,Micro: New system time in seconds and microseconds
*
*
*
***************************************************************/
185
4.
DEVICES
You've now seen the most common timer device commands. Let's look
at the remaining three device commands (SubTime (), AddTime ()
and CmpTime (. These commands always supply two timeval
structures which contain two times (for example, Sub Time
(timevall, timeva12);). The names of these commands contain
these results. SubTime () subtracts the time of the second timeval
structure from the frrst, and saves the result in the first timeval
structure.
AddTime () adds the two timeval structures and places the result in
the frrst timeval structure. CmpTime () compares the two given
timeval structures. The result of this function is zero for equality,
>0 when timevall > timeva12, and <0 when timevall <
timeva12. You must frrst open TimerBase before this function
can be called:
struct Device *TimerBase;
TimerBase = TimerRequest->tr_node.io_Device;
*
*
*
*
Timer-Device
(c) Bruno Jennrich
Juni 1988
Compile-Info: (TimerComp)
cc Timer
ln Timer.o Timer Support.o Devs Support.o -lc
*
*
*
*
*
*
***************************************************************1
tinclude "exec/types.h n
'include "exec/nodes.h"
'include nexec/lists.h"
'include nexec/memory.h"
'include "exec/ports.h n
'include "exec/libraries.h n
'include nexec/io.h"
'include nexec/devices.h n
'include "devices/timer.h"
'include nTimer_Support.h n
VOID *GetSysTime();
extern ULONG Days of Month[];
extern char *Days-of-Week[];
struct TimeDate TimeDate;
struct timerequest *TimeRequest=Ol;
struct timeval
*SystemTime=Ol,
OneDay = {(ULONG)SecondsPerDay,Ol);
struct Device *TimerBase;
1***************************************************** **********
*
CloseIt()
* Function: Display erro rand close everything
(User) *
*
*--------------------------------------------------------------*
186
4.12 THE
ABACUS
NARRATOR DEVICE
* Input - Parameter:
*
*
* String: Error-String
***************************************************************/
VOID CloseIt (String)
char
*String;
{
UWORD i;
UWORD *dffl80 = (UWORD *)OxdffI80;
UWORD Error
= 0;
if (strlen (String) > 0)
{
for (i=O;i<Oxffff;i++)
puts (String);
,
Error = 100;
if (TimeRequest != 01)
exit (Error);
*dffl80 = i;
/***************************************************************
*
TimePrintout()
(User) *
* Function: Display TimeDate-Structure (Time)
*
*--------------------------------------------------------------*
* Input - Parameter:
*
* TimeDate: TimeDate structure to dislpay
*
****************************************************** *********1
VOID TimePrintout (TimeDate)
struct TimeDate
*TimeDate;
{
***************************************************************/
187
4. DEVICES
WaitTime (TimeRequest,151,01);
printf (nThis is Northern-System-Time:\nn);
SysTime_to_TimeDate (TimeRequest,&TimeDate);
TimePrintout (&TimeDate);
C1ose_A_Device (TimeRequest);
1***************************************************** **********
main()
***************************************************************/
main()
(
*.*** *********/
'define
'define
'define
'define
'define
'define
SecondsPerMinute
(601)
SecondsPerHour
(601*601)
SecondsPerDay
(601*601*241)
SecondsPerYear
(601*601*241*3651)
/* Year */
SecondsPerLeapYear
(601*601*241*3661)
/* Leapyear */
Secs_1980
(21*SecondsPerYear) /* Seconds from */
/* 1.1 1978 to */
/* 1.1 1980 */
'define TDERR_HOUR_OUT_OF_RANGE -2 /* Timer-Device Errors */
'define TDERR MINS OUT OF RANGE -3
'define TDERR_SECS_OUT_OF_RANGE -4
'define TDERR YEAR OUT OF RANGE -5
'define TDERR=MONTH_OUT_OF_RANGE -6
'define TDERR DAY OUT OF RANGE
-7
'define TIME LEN (ULONG)-sizeof (struct timerequest)
/* Size of Device-Block */
struct TimeDate
/* Structure * /
ULONG Year;
/* Yearr */
ULONG Month;
/* Monht */
ULONG Day;
/* Month day */
ULONG Week;
/* Week of year */
ULONG Week_Day;
/* Weekday (O=Sunday etc) */
ULONG Hour;
/* hours */
ULONG Mins;
/* minutes */
ULONG Secs;
/* seconds */
};
188
ABACUS
4.14
Structure
struct IOExtTD
OxOO
48 Ox30
52 Ox34
56 Ox38
(2)
(3)
(4)
(5)
(9)
(10)
(11)
(12)
(13)
(14)
(15)
(16)
(17)
(18)
(19)
(20)
(21)
(22)
read sector
write sector in TrackBuffer
write TrackBuffer to disk
declare TrackBuffer invalid
turn motor on/off
position read/write head
fonnat ttack
install media change interrupt
detennine disk change number
check for inserted disk
test write protect
read tr.K:k (raw data)
write ttack (raw data)
detennine drive type (3-1/2" or 5-1/4 ")
detennine number of tracks
add media change interrupt
remove media change interrupt
detennine last command executed (not
currently implemented)
READ
WRITE
UPDATE
CLEAR
(32770)
(32771)
(32772)
(32773)
read sector
4. DEVICES
ETD
ETD
ETD
ETD
ETD
MOTOR
SEEK
FORMAT
RAWREAD
RAWWRITE
(32777)
(32778)
(32779)
(32784)
(32785)
Remember that you must specify which drive you want to address when
you open the device. The Uni t parameter accepts the values 0 (for
OFO:), 1 (for OFl:), 2 (for OF2:) or 3 (for OF3:). You can always
open only one drive with Open_A_Device (). If you want to access
multiple drives, you must call Open_A_Device () twice with two
different device blocks and different values for Uni t.
4.14.1
(Track_Support) *
*
*--------------------------------------------------------------*
Input - Parameter:
* DiskExtIO:
* SectorBuffer:
* LabelBuffer:
* offset:
Device-Block
Sector-Data
Label-Area data
Sector number
*
*
*
*
*
***************************************************************/
VOID TrackDisk ReadSector
(DiskExtIO,SectorBuffer,LabelBuffer,Offset)
struct IOExtTD
*DiskExtIO;
APTR
SectorBuffer;
APTR
LabelBuffer;
ULONG
Offset;
{
190
ABACUS
OiskExtIO->iotd Count
= TrackOisk_GetOiskChangeCount
(OiskExtIO) ;
DiskExtID->iotd Req.io Offset = Offset*5121;
DiskExtIO->iotd-Req.io-Oata
= (APTR) SectorBuffer;
DiskExtIO->iotd-Req.io-Length = (ULONG) TO SECTOR;
DiskExtIO->iotd-SecLabel
= (ULONG) LabelBuffer;
Do_Command (OiskExtIO, (UWORD) ETD_READ);
This routine uses the ETD READ command to read a sector from the
disk. The number of disk swaps is saved in iotd_Count using
TrackDisk_GetDiskChangeCount () . If the disk is swapped
before the E TO_READ command, when the E TO_READ command is
executed it determines that the value in iotd Count is less than the
value of the disk swap, and ETD_READ is not executed. Along with
ETD_ READ all of the EID commands function after being checked by
iotd Count.
You can bypass this by saving the value Oxffffffffin iotd_Count.
Here iotd_Count is always greater than or equal to the number of
disk swaps. Use the CMD READ command instead of ETD READ,
since CMD_READ does notdisturb the iotd_Count.
To inform the trackdisk device which sector should be read, the offset of
the sector to be read is given in iotd_Req. io_Offset. Notice that
the trackdisk device numbers all of the sectors by byte. To read sector
0, the trackdisk device must be given the value O. To read sector I, the
trackdisk device must be given the value 512 (a sector contains 512
bytes). To read sector 2, the trackdisk device must be given the value
1024, and so on. The device block performs the offset assignments, so
you don't have to constantly multiply the sector number you want read
by 512. All you need to do is specify the number of the sector to be
read (0-1759).
Perhaps you want to read the lower portion of sector 0, or the top
portion of sector 1. You can't read just parts of a sector-the offset
must always be a factor of 512. The buffer in which you want to read
the data of the sector should be a minimum size of 512 bytes, and
should be in Chip memory. If you want to read more than one sector
you must allocate more memory. The above routine reads only one
sector. SectorBuffer contains the starting address of the data
memory that must contain the 512 bytes.
If you enter a number for SectorBuffer less than 512 bytes, only
the first 200 bytes are read. The other bytes stay protected from access.
A sector on a disk also contains another data region beside the sector
data-the label buffer. This 16-byte label buffer is placed before the
actual buffer. Usually 0 bytes precede the actual buffer. You can use
191
4. DEVICES
*--------------------------------------------------------------*
*
Input - Parameter:
* DiskExtIO:
Device-Block
* SectorBuffer: Sector-Data (Ox397c Bytes)
* offset:
Sector number
*
*
*
*
***************************************************************/
= TrackDisk_GetDiskChangeCount
DiskExtI0->iotd Count
(DiskExtIO) ;
DiskExtI0->iotd Req.io Offset = Offset*512l;
DiskExtIO->iotd-Req.io-Data
= (APTR) SectorBuffer;
(ULONG) TD_SECTOR;
DiskExtIO->iotd=Req.io=Length
DiskExtIO->iotd SecLabel
(ULONG) LabelBuffer;
192
ABACUS
Problems occur when you write a sector in the internal buffer by means
OfETD_WRITE or CMD_WRITE, and then try to exit the program. The
new data may not be written to the disk under certain conditions. This
is why the UPDATE command executes after the WRITE command.
This ensures that the internal buffer is written to the disk.
Knowing the current number of disk swaps is vital to the use of the
extended commands. The following routine shows how the
TD CHANGENUM command finds this number:
1***************************************************** **********
*
TrackDisk GetDiskChangeCount ()
(Track Support)*
* Function: Get number of disk changes
*
*--------------------------------------------------------------*
* Input - Parameter:
* DiskExtIO: Device-Block
*
*
*--------------------------------------------------------------*
* Retrun value:
*
*
* Number of disk changes
****************************************************** *********1
ULONG TrackDisk GetDiskChangeCount(DiskExtIO)
struct IOExtTD *DiskExtIO;
{
io Actual.
We should also have control over the disk drive motor (on or off). The
following routine controls the motor:
1***************************************************** **********
*
TrackDisk_Motor()
(Track_Support) *
* Function: Motor on/off
*
*--------------------------------------------------------------*
* Input - Parameter:
*
* DiskExtIO: Device-Block
*
* Flag: TRUE => Motor on
*
*
FALSE => Motor off
*
***************************************************************/
VOID TrackDisk Motor (DiskExtIO,Flag)
struct IOExtTD
*DiskExtIO;
BOOL
Flag;
if (Flag)
else
11; /* Motor on */
01; /* Motor off*/
This command is important because the read and write commands turn
the motor on but not off: The user must tum off the motor. The
command TrackDisk Motor (DiskExtIO, FALSE) writes a 0
193
4. DEVICES
4.14.2
*
*
TrackDisk_RawReadSector()
(Track_Support) *
*
*
*--------------------------------------------------------------*
* Input - Parameter:
*
*
*
* DiskExtIO: Device-Block
*
* TrackBuffer: Track-Data (Ox397c Bytes)
*
Offset:
Track number
***************************************************************/
DiskExtIO->iotd Count
TrackDisk_GetDiskChangeCount (DiskExtIO);
DiskExtIO->iotd Req.io Offset = Offset;
DiskExtIO->iotd-Req.io-Data
= (APTR) TrackBuffer;
DiskExtIO->iotd-Req.io-Length = RAW TRACK LEN;
DiskExtIO->iotd=Req.io=Flags
= (BYTE) IOTDF_INDEXSYNC;
194
4.14
ABACUS
DiskExtID->iotd_Req.io_Actual = 01;
Do_Command (DiskExtIO, (OWORD) ETD_RAWREAD);
1***************************************************************
TrackDisk_ RawWriteSector ( )
(Track_Support) *
*
*
*--------------------------------------------------------------*
Input - Parameter:
*
*
*
* DiskExtIO: Device-Block
* TrackBuffer: Track-Data
* Offset:
Track number
***************************************************************/
VOID TrackDisk_RawWriteSector (DiskExtIO, TrackBuffer, Offset)
struct IOExtTD
*DiskExtIO;
APTR
TrackBuffer;
ULONG
Offset;
{
195
4. DEVICES
4.14.3
Formatting a disk
You've seen the most frequently used trackdisk commands. However,
you can still do more with this device. For example, you have the
option of formatting individual tracks. This is useful, for example,
when the boot block on a disk was destroyed for some reason and so
ooS cannot access the disk. Assuming that there is no important data
on track 0 (sectors 0 through 10), you can format track 0 and copy the
boot block of an intact disk to the disk whose boot block you
reformatted, by means of READ and WRITE. Then you can rescue the
most important files to the new disk, assuming the rest of the disk is
in order. The following routine shows how a single track can be
formatted:
'define MEMTYFE (ULONG) MEMF_CLEAR I MEMF_CHIP
/***************************************************************
TrackDisk_Format ()
(Track_Support) *
*
*
*--------------------------------------------------------------*
* Function: Format track
* Input - Parameter:
* DiskExtIO: Device-Block
* Offset:
Track number
***************************************************************/
BYTE *FormatData=Ol;
UWORD i;
FormatData = (BYTE *) AllocMem (NUMSECS*TD SECTOR, MEMTYFE);
if (FormatData == 01)
Closelt(nNo FormatData Buffer!! !");
for (i=O; i<NUMSECS*TD SECTOR; i+= 4)
FormatData [i 1
FormatData [i+ 11
FormatData[i+2]
FormatData [i+31
';
'd t ;
'b';
':
1* data *1
1* becker *1
DiskExtIo->iotd Count
= TrackDisk_GetDiskChangeCount
(DiskExtIO) ;
DiskExtIO->iotd Req.io Data
= (APTR) FormatData:
DiskExtIO->iotd-Req.io-Length = (ULONG) (NUMSECS*TD_SECTOR):
DiskExtIO->iotd-Req.io-Offset = Offset:
Do_Command (DiskExtIO,(UWORD)ETD_FORMAT);
FreeMem (FormatData,NUMSECS*TD_SECTOR);
196
4.14
ABACUS
Unlike READ and WRITE, the number of the tracks to be formatted (0160) is given in io_Offset. Also, a multiplication by 512 is
unnecessary. Memory for an entire track is reserved for this command
and it is written with db. Then the format buffer is given in the
i 0_Oa t a pointer. Be aware that you can only format one or more
complete tracks with TO_FORMAT and ETO_FORMAT. with one of the
tracks to format the size of the fonnat buffer NUMSECS *TO SECTOR
is (11*512). The memory size adjusts accordingly with multiple tracks
to be fonnatted.
Tracks and sectors are described according to a certain pattern when
formatting. Whoever has the time and the inclination can look at a
newly formatted disk with the disk monitor listed in this chapter and
analyze the fonnatting pattern.
4.14.4
Status commands
A number of ttackdisk commands indicate the status of the disk and
disk drive. The following routine demonsttates this command set:
1***************************************************** **********
*
TrackDisk GetProtStatus() (Track Support)*
* Function: Write-Protect on/off ?
*
*--------------------------------------------------------------*
* Input - Parameter:
*
* DiskExtIO: Device-Block
*
*--------------------------------------------------------------*
* Return value:
*
<>0: write protected
*
* 0: not write protected
***************************************************************/
ULONG TrackDisk GetProtStatus (DiskExtIO)
struct IOExtTD *DiskExtIO;
{
/***************************************************************
TrackDisk GetChangeState ()
* Function: Is disk inserted?
(Track_Support) *
*--------------------------------------------------------------*
* Input - Parameter:
* DiskExtIO: Device-Block
*--------------------------------------------------------------*
* Return value:
*
* 0: Diskette inserted
<>0: Diskette removed
*
***************************************************************/
ULONG TrackDisk GetChangeState (DiskExtIO)
struct IOExtTD *DiskExtIO;
{
197
4. DEVICES
equals zero following this command, there is no disk in the disk drive.
The following commands also place return values in io_Act ual :
TD_GETDRIVJ:TYPB
This command helps you determine what disk drive should be accessed.
If iO_Actual equals I, a 3-1/2" drive is connected. If iO_Actual
equals 2, a 5-1/2" drive is connected.
TD_GBTNUMTRACKS
This command returns the number of tracks that the connected disk
drive can handle. The standard 3-1/2" Amiga disk drives manage 160
tracks.
This command lets you set and test the read/write head on the given
track to see if it is positioned at a certain track. You supply the number
of the fIrst sector of the given track (factor of 11). If the track was
incorrect. this quits with an error (ioyrror !=O):
1***************************************************************
*
*
TrackDisk_SeekSector()
Function: Position read head
(Track_Support) *
*--------------------------------------------------------------*
* Input - Parameter:
* DiskExtIO: Device-Block
* Offset:
Sector number
*
*
***************************************************************/
VOID TrackDisk SeekSector (DiskExtIO, Offset)
struct IOExtTD*DiskExtIO;
ULONG
Offset;
{
Should this command return an error, this may mean that your disk
drive is damaged.
198
ABACUS
4.14.5
Disk interrupts
Another interesting feature of the trackdisk device is the possibility of
installing an interrupt that executes with each disk swap. The
TD_REMOVE command performs this task.
struct Interrupt *Interrupt = 01;
1***************************************************** **********
*
TrackDisk_InterruptOnO
(Track_support) *
* Input - Parameter:
*--------------------------------------------------------------*
* DiskExtIO:
Device-Block
* TrackDisk DiskRemove: Interrupt-Routine
***************************************************************/
VOID TrackDisk_InterruptOn (DiskExtIO,TrackDisk_DiskRemoved)
struct IOExtTD
*DiskExtIO;
VOID
(*TrackDisk DiskRemoved) ();
*
*
TrackDisk InterruptOff ()
Function: Remove Disk-Interrupt
(Track Support) *
*
*--------------------------------------------------------------*
* Input - Parameter:
* DiskExtIO: Device-Block
*
*
***************************************************************/
199
4. DEVICES
*------------------------=-------------------------------------*
* Input - Parameter:
* DiskExtIO:
Device-Block
* TrackDIsk DiskRemoved: Interrupt-Routine
*
*
***************************************************************/
(*TrackDisk_DiskRemoved) ();
{
200
ABACUS
1***************************************************** **********
*
TrackDisk_Copy()
(Track_Support) *
*
*
*--------------------------------------------------------------*
* Input - Parameter:
*
*
* OldExtIO: Original
*
* NewExtIO: Copy
*
***************************************************************/
VOID TrackDisk Copy (OldExtIO, NewExtIO)
struct lOExtTD*OldExtIO,*NewExtIO;
(
NewExtIO->iotd Count =
OldExtIo->iotd_Count;
4.14.6
Error handling
Many inexperienced trackdisk programmers encounter program errors.
We recommend that you use our track support routines to minimize
problems. In addition to the normal device errors. the trackdisk device
has device specific errors:
'IDERR_NotSpecified
'IDERR NoSecHdr
'IDERR BadSecPmarrble
'IDERR BadSecID
'IDERR BadHdrSlIml
'IDERR BadSecSt:m
'IDERR TooFewSecs
'IDERR BadSecHdr
'IDERR WriteProt
'IDERR_DisJcChan3ed
'IDERR SeekError
(20)
(21)
(22)
(23)
(24)
(25)
(26)
(27)
(28)
(29)
(30)
201
4. DEVICES
'IDERR NcMam
'IDERR BadUnitNum
'IDERR_ BacDriveType
'IDERR DriveInUse
'IDERR PostReset
The following routine returns either the error number (for a device
unspecified error), or the error in text format
struct StrPack
{
BYTE *String;
ULONG Len;
};
HTab [1 = {' 0' , '1' , , 2' , '3', '4' , 'S' , '6' , '7' ,
BYTE
'S','9','A','B','C','D','E','F'};
TrackDisk ProcessError ()
(Track Support) *
*
*
***************************************************************/
StrPack->String
StrPack->Len
else
202
ErrorStrings[(Error-(BYTE)20)1;
(ULONG) str1en (StrPack->String);
4.14 THE
ABACUS
TRACKDlSK DEVICE
ErrStr
= n\012\015Error. \012\015";
ErrStr[9] = HTab[(Error4)&15];
ErrStr[lO] = HTab[Error&15];
StrPack->String = ErrStr;
StrPack->Len
= 131;
When you call this routine you must give the address of a string packet
as a parameter. Either the text of the error or a string in the format
Error tnn is given in this packet. You can then display ti"tis string.
This routine must be called directly after executing READ or WRITE
(TD_MOTOR is usually executed without an error). There is no problem
with the routine TrackDisk_WriteSector () because the
UPDATE command executes after WRITE. Here, as the user, you must
either call UP D ATE after Pro c e sSE r r 0 r () or integrate
ProcessError () into WriteSector ().
Combine the listed Track_Support fIles to form the Track_Supportc
file. The file header appears as follows:
1***************************************************** **********
*
Track Support. c
*
AugUst 1988
*
(c) Bruno Jennrich
* Compile-Info:
* cc Track Support.c
*
*
*
~include "exec/types.h n
'include nexec/memory.h n
iinclude Rexec/devices.h"
iinc1ude Rexec/interrupts.h"
~include "devices/trackdisk.h"
203
4. DEVICES
4.14.7
DiskEd.c
(c) Bruno Jennrich
* Compile-Info:
*
* cc DiskEd.c
*
* In DiskEd.o Track Support.o Con Support.o Devs Support.o -lc *
*** *** *** *********1
'include "exec/types.h"
'include "exec/memory.h"
'include "exec/devices.h"
'include "exec/interrupts.h"
'include "graphics/gfxbase.h"
'include "libraries/dos.h"
Unclude "devices/trackdisk. h"
'include "devices/console.h"
'include "devices/keymap.h"
'include "intuition/intuitionbase.h"
'include "intuition/intuition.h"
'define HEMTYPE
(HEME' CHIP I HEME' CLEAR)
'define CON LEN (ULONG)-(sizeof (struct IOStdReq
.define TD LEN (ULONG) (sizeof (struct IOExtTD))
'define RAW TRACK LEN
Ox397cl
VOID *CreatePort (f;
VOID *CreateExtIO();
VOID *Open () ;
VOID *AllocMem();
VOID *GetDeviceBlock();
VOID *OpenLibrary();
VOID *OpenScreen();
VOID *OpenWindow();
extern VOID TrackDisk DiskRemoved();
struct IntuitionBase *IntuitionBase
01;
struct Screen
*Screen
01;
struct Window
*Window
01;
struct NewScreen
NewScreen
0,0,640,200,4,
0,1,
HIRES,
CUSTOMSCREEN,
01,
(UBYTE*) "No Name",
01,
01
struct NewWindow
NewWindow
};
{
0,0,
640,200,
0,1,
01,
(ULONG) ACTIVATE,
204
4.14
ABACUS
01,
01,
(UBYTE*) "TrackDisk-Editor (c) Bruno Jennri ch " ,
01,
01,
0,0,
0,0,
CUSTOMSCREEN
);
extern
extern
struct
struct
BYTE *String;
ULONG Len;
);
struct Offset
{
ULONG Track;
ULONG Sector;
ULONG Side;
};
/***************************************************************
*
CloseIt ()
(User) *
* Function: In case of erro close everything
*
* Input - Parameter:
*
* String: Error-Message
*
***************************************************************/
VOID Closelt (String)
char
*String;
{
awORD i;
awORD *dff180 = (awORD *)Oxdff180;
awORD Error = 0;
if (strlen (String) > 01)
{
for (i=O;i<Oxffff;i++)
puts (String);
Error = 10;
*dff180
i;
if (Window != 01)
CloseWindow (Window);
if (Screen != 01)
CloseScreen (Screen);
if (IntuitionBase != 01) CloseLibrary (IntuitionBase);
if (Interrupt != 01)
TrackDisk InterruptOff(DiskExtIO);
if (DiskExtIO->iotd Req.io Device != -11) Close A Device
(DiskExtIO) ;
-else FreeDeviceBlock (DiskExtIO);
if (SectorBuffer != 01)
FreeMem (SectorBuffer,TD SECTOR);
if (TrackBuffer != 01)
FreeMem (TrackBuffer, RAW_TRACK_LEN);
205
4. DEVICES
if (LabelBuffer != 01)
FreeMern (LabelBuffer,
if (ConsoleRead != 0)
if (ConsoleWrite != 0)
i f (File ! = 01)
exit (Error);
(ULONG) (NUMSECS;
Close A Device (ConsoleRead);
FreeD~viceBlock (ConsoleWrite);
Close (File);
1***************************************************** **********
*
TrackDisk DiskRemoved()
* Function: Interrupt-Routine ~alled by disk change
(User) *
*
****************************************************** *********1
'asrn
public
TrackDisk DiskRernoved
TrackDisk DiskRemoved:
move.w '$ffff,dO
loopa:
move.w
dO, $dffl80
dbra
dO,loopa
rts
ilendasm
1***************************************************** **********
*
*
*
*
*
ReadCornmand ()
Function: Read keyboard input (Console-Device)
Input - Parameter:
Buffer: Go to where with the input?
MaxLength: Maximum number of key presses
(User) *
*
*
*
*
***************************************************************/
BYTE *BufPointer;
BYTE Character;
ULONG Length;
Character = (BYTE) 0;
Length = (ULONG) 0;
BufPointer = Buffer;
while (Character != (BYTE) 13)
{
/* <RETURN> */
Console Read (ConsoleRead, &Character,ll);
if (Character == (BYTE) 8)
/* Backspace */
{
i f (Length> 01)
{
if (Character ==
(ConsoleWri te, "\012",11) ;
i f (Character I
(Character I
*BufPointer++
206
4.14
ABACUS
else
*BufPointer++ = Character;
Length++;
Console_Write (ConsoleWrite,&Character,ll):
*BufPointer = (BYTE)D;
1***************************************************** **********
*
HEXAtoULONG()
(User) *
* Function: Convert Hex-String to ULONG
*
* Input - Parameter:
*
* BufPointer: Addess of the Hex-String
*
* Return value:
*
* Valuse of the Hex-Strings (RABe" = Dxabc)
*
****************************************************** *********1
ULONG HEXAtoULONG (BufPointer)
BYTE
*BufPointer:
(
UWORD i;
ULONG Val = 01;
OWORD Len;
Len = strlen (BufPointer);
for (i=O;i<Len;i++)
(
Val *= 161;
Val += *BufPointer && (Oxff-Dx20-'A'+(BYTE)10);
else
if *BufPointer>= '0') && (*BufPointer <= '9'
{
Val *= 161;
Val += (ULONG) (*BufPointer-'O');
BufPointer++:
return (Val);
1***************************************************** **********
*
*
*
*
*
*
DEZAtoULONG ()
Function: Convert Decimal-String to ULONG
Input - Parameter:
BufPointer: Address of the Decimal-Strings
Return value:
Value of the Decimal-Strings (R123" = 123)
(User) *
*
*
*
*
*
***************************************************************1
UWORD i;
ULONG Val = 01;
UWORD Len:
Len = strlen (BufPointer):
for (i=O:i<Len;i++)
{
Val *= 101;
Val += (ULONG) (*BufPointer-'O');
207
4.
DEVICES
Bufpointer++ ;
return (Val);
1***************************************************** **********
*
LONGtoA()
* Function: Convert LONG value to ASCII and display
* Input - Parameter:
* Val: LONG value
(User)*
*
****************************************************** *********1
Ascii[i] = '0';
while (Val >= Start)
{
Val -= Start;
Ascii[i]++;
i++;
Start /= 101;
while (Start != 01);
Console_Write (ConsoleWrite,Ascii,101);
1***************************************************** **********
*
UWORDtoHex()
(User) *
*
* Function: Convert UWORD value to Hex-String
*
* Input - Parameter:
*
* Val: UWORD value
* Buffer: where with Hex-Strings
*
***************************************************************/
UWORD Hex;
Hex
Hex
Buffer[O]
Hex
Hex
Buffer[l]
Hex
Hex
Buffer[2]
Hex
Buffer [3]
*Val , OxfOOO;
Hex 12;
HexTab[Hex] ;
*Val , OxOfOO;
Hex 8;
HexTab[Hex] ;
*Val , OxOOfO;
Hex 4;
HexTab[Hex] ;
*Val & OxOOOf;
HexTab[Hex] ;
1***************************************************** **********
Display ()
* Function: Display sector contents
* Input - Parameter:
* Offset: Sector number
(User) *
*
*
***************************************************************1
208
ABACUS
UWORD i, j;
UWORD BufPos = 0;
BYTE Strinq[20];
BYTE HexBuffer[72*16];
BYTE AsciiBuffer[72*8];
BYTE LabelBuff[8*SJ;
BYTE LabelAscii[17];
BYTE OffsetBuffer[14];
UNORD Offs;
OffsetBuffer[ 0]
'B':
OffsetBuffer[ I] - 'I';
OffsetBuffer[ 2]
'0':
OffsetBuffer[ 3]
'c':
OffsetBuffer[ 4J e 'k':
OffsetBuffer[ SJ = ':':
OffsetBuffer [ 6]
OffsetBuffer[ 7] = '$';
OffsetBuffer[ 8]
";
OffsetBuffer[ 9] = , ':
OffsetBuffer[10]
":
OffsetBuffer[11] - , ';
OffsetBuffer[12]
'\012';
OffsetBuffer[13] - '\015':
Offs - (tJWORD) Offset; 1* convert to tJWORD for UWORDtoHex () *1
UWORDtoHex (&Offs,&OffsetBuffer[8J):
Console Write (ConsoleWrite,OffsetBuffer,14l):
Console-Write (ConsoleWrite,"Labelbuffer:\012\01S",-1l):
for (i-0:i<8:i++)
2
':
HexBuffer[i*72] - , ';
tJWORDtoHex(&BufPos,&HexBuffer[i*72+1]);
HexBuffer[i*72+S] - , ':
for (j=0;j<16:j++)/* 32 Bytes (16 UWORDS}=64 chAracters *1
{
UNORDtoHex
(&SectorBuffer[BufPos],&HexBuffer[l*72+6+j*4]}:
BufPos += 2;
}
HexBuffer[i*72+70) - '\012';
HexBuffer[i*72+71] - '\015':
Console Write (ConsoleWrite,HexBuffer,16l*72l):
209
4.
DEVICES
BufPos = 0;
for (i=0;i<8;i++)
(
AsciiBuffer[i*72+6+j)
ConversionTable[(UBYTE)SectorBuffer[i*64+j));
BufPos ++;
)
AsciiBuffer[i*72+70] - '\012';
AsciiBuffer[i*72+71I
'\015';
Console Write (ConsoleWrite,AsciiBuffer,8l*72l);
i f (File ! = 0)
{
HexBuffer[i*72+70)
HexBuffer[i*72+71)
';
'\012' ;
for (i=0;i<8;i++)
{
AsciiBuffer[i*72+70)
AsciiBuffer[i*72+71)
';
'\012';
*
GetOffset ()
(User) *
*
* Function: Get offset for READ/WRITE from input string
*
* Input - Parameter:
*
* BufPointer: Addesseof the Input - Strings (HEX or DEC)
* Return value:
*
* Offset recieved
*
***************************************************************/
ULONG GetOffset (BufPointer)
BYTE
*BufPointer;
{
BYTE *SecBuf;
SecBuf = BufPointer;
while *BufPointer != (BYTE) 0) && (*BufPointer != '$') &&
(*BufPointer != "' BufPointer++;
if (*BufPointer
(BYTE) 0) return (-11);
else
if (*BufPointer
'$') return (HEXAtoULONG (BufPointer+1) ) ;
else
if (*BufPointer
',') return (DEZAtoULONG (BufPointer+1) );
else
if *BufPointer >= '0') ,& (*BufPointer <= , 9'
210
4.14
ABACUS
return(DEZAtoULONG (SecBuf;
1***************************************************** **********
HandleCorrrnands ()
(User) *
* Function: Process commands entered
*
***************************************************************/
VOID HandleCommands ()
BYTE *Bufpointer;
BYTE
Command;
BOOL
QuitFlag;
struct StrPack StrPack;
ULONG Count;
ULONG Offset = 01;
QuitFlag = FALSE;
while (!QuitFlag)
{
ReadCommand (ReadBuffer,2561);
Bufpointer = ReadBuffer;
while (*Bufpointer == , ') BufPointer++;
/* skip spaces */
Command = *BufPointer;
/* the first character after ' , is the commnand */
switch (Corrrnand) /* Which command? */
{
211
4.
DEVICES
console Write
(ConsoleWrite,StrPack.String,StrPack.Len);
break;
case (BYTE)' f':
Offset = GetOffset (BufPointer);
TrackDisk Motor(DiskExtIO,TRUE);
TrackDisk-Format (DiskExtIO,Offset);
TrackDisk-ProcessError (DiskExtIO,&StrPack);
TrackDisk=Motor(DiskExtIO,FALSE);
Console Write
(ConsoleWrite,Strpack.String,StrPack.Len);
break;
case (BYTE)' s' :
Console Write (ConsoleWrite,"\012\01SDiskChangeCount
",-II);
DiskExtIO->iotd Count =
TrackDisk_GetDiskChangeCount(DiskExtIO);
LONGtoA (DiskExtIO->iotd Count);
Console Write (ConsoleWr"ite,"\012\01S",-11);
if (TrackDisk GetProtStatus(DiskExtIO) != 01)
Console Write (ConsoleWrite,"Disk
protected\012\01S", -ll);
else
Console Write (ConsoleWrite,"Disk not
protected\012\01S", -11);
if (TrackDisk GetChangeState(DiskExtIO)
01)
Console Write (ConsoleWrite,"Disk
inserted\012\01S",-11)~
else
Console Write (ConsoleWrite,"Disk
removed\012\01S",-11);
/* Status */
break;
case (BYTE)' d' :
/* Display */
Display (SectorBuffer,LabelBuffer,Offset);
break;
case (BYTE) 'q':
QuitFlag = (BOOL)TRUE;
break;
case (BYTE) 13:
/* Intercept Return */
break;
default:
Console Write (ConsoleWrite,"\012\OlS\Bad
Command! ! ! \012\OlS"~-11);
break;
1***************************************************** **********
Input - Parameter:
* Unit: Which disk drive?
(User) *
*
*
*
***************************************************************/
ULONG Offset;
Open_A_Device ("trackdisk.device",Unit,&DiskExtIO,Ol,TD LEN);
TrackDisk_InterruptOn(DiskExtIO,TrackDisk_DiskRemoved);
212
4.14
ABACUS
HandleComnands ();
TrackDisk InterruptOff(DiskExtIO);
Close_A_Device (DiskExtIO);
1***************************************************** **********
*
Open Screen and Window ()
(User) *
* Function: Editor Screen and Window open
*
****************************************************** *********1
VOID Open_Screen_and_Window()
{
*
Open Screen and Window ()
* Function: Editor Screen and Window ~lose
(User) *
*
***************************************************************/
--
CloseWindow (Window);
CloseScreen (Screen);
CloseLibrary (IntuitionBase);
1***************************************************** **********
main ()
(User) *
*--------------------------------------------------------------*
* Input - Parameter:
* argv[l]: Disk drive (dfO:, df1: etc.)
* argv[2]: Output_file
*
*
***************************************************************/
main (argc,argv)
UWORD argc;
BYTE
*argv[];
{
UWORD i;
ULONG Unit=Ol;
BYTE *InputString;
UWORD Len;
InputString = argv[l];
i f (argc >= 2)
(
Len = strlen(InputString);
for (i=O;i<Len;i++)
{
else
i f (strcmp ("dfl:", argv [1] )
else
i f (strcmp ("df2:",argv[1] )
else
i f (strcmp ("df3:", argv [1] )
01) Unit
0;
01) Unit
1;
01) Unit
2;
01) Unit
3;
213
4. DEVICES
i f (argc == 3)
(
i f (argc > 3)
{
printf ("USAGE: b
[[DF?:] [ListFile]]!\n",argv[O]);
exit (0);
214
5.1
ABACUS
5.
IFF
5.1
IFF
Most commercial software developers used their own file fonnats. It
was easier to implement file systems in house, rather than try
confonning to a standard. On one hand, this costs money because the
buyer must finance each development. On the other hand, independent
file formats make it impossible to exchange data between two different
programs if they are incompatible. A universal file fonnat would make
applications more marketable for their flexibility.
guaranteed.
This chapter splits IFF into many different forms. All are IFF, but all
have their own qualities. We divided the chapter to keep parameters and
IFF factors consistent with each format category.
215
5.
Header
A header always exists at the beginning of each file. The header retains
all the infonnation that informs the program of data found in this file,
as well as the type of data in the file (i.e., graphic data, sound data or
text data).
Chunks
Chunks comprise the remainder of the file. Chunks are blocks of data
that contain groups of data. For example, an IFF me containing music
data has a chunk outlining the parameters of each musical voice's sound
capabilities. A graphic IFF me has a color chunk in which it stores all
the cob data needed for the graphic. Chunks provide the developer with
a system of data building blocks which, like a set of toy building
blocks, can be expanded as much as possible. This open format ensures
that IFF will be around for a long time, since it is so open to
expansion.
Each of the chunks discussed here is identified in the header by four
characters. The data follows the chunk (we'll spend most of this chapter
looking at chunk data).
5.1.1
Next comes the labeling of the ILBM format. The four letters "ILBM"
indicate this particular format. The individual chunks of our data file
follow. Let's look at them one at a time.
BHHD
(BitHapHeaDer)
'define ID_BMHD MakeID('B', 'M', 'H','O')
lU
5.1
ABACUS
IFF
This chunk contains the data that cover the fonnal attributes of our
graphic. It is handled as a structure that is important later for opening
the screen, because it acts as a storage space for measurements, depth
and other values. Take a closer look at this structure:
typedef struct
(
UWORD w, h;
WORD x, y;
UBYTE nPlanes;
Masking masking;
Compression compression;
UBYTE padl;
UWORD transparentColor;
UBYTE xAspect, yAspect;
WORD pageWidth, pageHeight;
*/
*/
*/
*/
*/
*/
*/
*/
*/
BitMapHeader;
UBYTE Masking;
mskNone OL
mskHasMask lL
mskHasTransparentColor 2L
mskLasso 3L
217
s.
The Padl variable contains a fill byte, ensuring that the structure
contains an even number of bytes. This byte is currently unused, so it
contains zero. In every case this should be watched because later
versions may make other use of this, and a value other than zero may
cause problems.
The xAspect and yAspect variables contain the ratio between the X
side and Y side of the graphic. This information is important for
programs that transport graphics from one resolution to another, or
transport graphics from one brand of computer to another brand
altogether.
ide fine
'define
'define
'define
'define
'define
'define
'define
x320x200Aspect
y320x200Aspect
x320x400Aspect
y320x400Aspect
x640x200Aspect
y640x200Aspect
x640x400Aspect
y640x400Aspect
10L
llL
20L
llL
SL
llL
10L
llL
(Col.orHAP)
'define ID_CMAP MakeID('C', 'M', 'A', 'P')
218
5.1
ABACUS
IFF
typedef struct
{
ColorRegister;
Please bear in mind that creating and reading an IFF file may give the
colormap an odd number of bytes. Then the list must be completed
with a null byte.
CRHG
(ColorRaKG)
'define ID_CRNG MakeID('C', 'R', 'N', 'G')
WORD padl;
WORD rate;
WORD active;
CCR'l'
(Color
Cycling
Range
and
'l'iming)
The CCRT chunk also controls color cycling. Both chunks are treated
by independent tasks, depending on the manufacturer. CommodoreAmiga's GraphiCraft uses the CCRT chunk, while DeluxePaint uses
the CRNG chunk.
We must read both chunks into our program and process them to make
them completely compatible with colorcycling. Because both chunks
are somewhat different, there is another structure:
typedef struct {
{
WORD direction;
219
s.
The direction variable gives the direction in which the color should
be cycled. 0 no movement, 1 forward and -1 reverse. Start and
end give the starting and ending number of both color registers
between which color change occurs.
The CCRT chunk handles time differently from the CRNG chunk.
Commodore-Amiga gives the seconds and microseconds
variables. This is the same as the other functions in the Amiga library.
Then this division also takes place there (look at the Preferences
structure and the Intuition library).
Pad acts as the fill byte to keep the structure set at an even number of
bytes.
Before we examine the most important of all of the chunks (the BODY
chunk), we must address some lesser used chunks.
GRAB
(GRAB
position)
jdefine ID_GRAB MakeID ('G', 'R', 'A', 'B')
The GRAB chunk indicates the relative position of the cursor. This is
useful for placing brushes, which can be placed at any point on the
screen.
typedef struct
(
WORD x, y;
)
Point2D;
The x and y coordinates specify the upper left comer of the graphic.
The entire GRAB chunk consists only of this point2D structure.
DEST
(DESTination
bitp~anes)
220
5.1
ABACUS
IFF
typedef struct
{
UBYTE
UBYTE
UWORD
UWORD
UWORD
depth;
padl;
planePick;
planeOnOff;
planeMask;
DestMerge;
The depth variable designates the depth of the screen in which the
data should be entered.
The padl variable represents a ftll byte (currendy unused here).
The planePick variable examines the set bits. Each set bit is named:
packs the next bit-plane from the file in the bit-plane of the screen with
the number oflhe set bit. When a bit is not set, the same bit is
considered under planeOnOff. When this is set the entire bit-plane is
filled with I, otherwise you clear it.
planeMask has the task of suppressing writing to a bit-plane. The
corresponding bit for a bit-plane is set if it should be written in this
variable. In the opposite case, this bit is cleared and the bit-plane
remains undisturbed. The planePick and planeMask variables
contain the default value 2"nPlanes - 1. This ensures all set bits
for each plane, as well as the use of all available bit-planes.
SPRT
(SPRiTe)
'define ID_SPRT MakeID('S', 'P', 'R','T')
Sprites can also be saved in ILBM files with the help of this chunk.
The chunk's single value designates the precedence of the sprite. The
value 0 represents highest precedence. The higher the value, the lower
the sprite precedence. The sprite with the highest precedence is
graphically placed ahead of all others.
typedef UWORD SpritePrecedence;
CANG
(Commodore
AMiGa
computer)
Unlike the other computers that have IFF file systems, the Amiga
includes a set of ViewModes. These display modes include HAM and
interlace mode. A new chunk (the CAMG chunk) compensates for the
support not given by normal IFF ILBM chunks. The CAMG chunk
contains only the ViewMode register:
221
5.
typedef struct
(
ULONG ViewHodes;
)
CarrqChunk;
BODY
Optional
mask,
222
*DosBase;
(0,1,2,4,8,16,32,32);
/* color number */
5.1
ABACUS
IFF
w/h;
x,y:
BitPlanes;
Masking;
Compression;
PadByte;
TransCol;
XAspect,YAspect;
Width, Height;
};
typedef struct ColorRegister
UBYTE red;
UBYTE green;
UBYTE blue;
typedef struct CommodoreAmiga
};
{
UWORD PadWord;
UWORD ViewModes;
};
struct BitMapHeader BMHD;
struct ColorRegister Colors [32];
struct CommodoreAmiga CAMG;
struct Screen *Screen;
struct NewScreen NewScreen;
LONG FileHandle;
LONG Len;
ULONG ChunkLen;
BOOL BMHDFlag;
BOOL CMAPFlag;
BOOL CAMGFlag;
BOOL BODYFlag;
BOOL FoundChunk;
BOOL ShowFlag = FALSE;
UBYTE Buffer [300];
/* General Counter */
LONG i;
LONG x;
/* Column Counter */
LONG y;
/* Line Counter */
/* BitPlane Counter */
LONG b;
UBYTE ByteCount;
UBYTE BytesPerRow;
/* BitPlane Address */
char *WhereIsIt;
char *MouseButton
(char *) OxBFEOOl;
CloseIt (s)
char *s;
{
printf ("%s\n",s);
if (FileHandle != 0) Close (FileHandle);
if (Screen != 0) CloseScreen (Screen);
if (DosBase != 0) CloseLibrary (DosBase);
if (IntuitionBase != 0) CloseLibrary (IntuitionBase);
if (GfxBase != 0) CloseLibrary (GfxBase);
exit (0);
Lread (Buffer,Num,Flag)
LONG Buffer;
WORD Num;
BOOL Flag;
{
223
5.
1* Argument Counter *1
1* Argument Value *1
int argc;
char **argv;
i f (argc ! = 2)
(
printf (" End by clicking in the upper left hand corner. \n");
DosBase= (LONG *) OpenLibrary("dos.library",O);
GfxBase= (struct GfxBase *) OpenLibrary ("graphics.library", 0);
IntuitionBase=(struct IntuitionBase *)
OpenLibrary("intuition.library",O);
if DosBase == 0) I I (GfxBase == 0) I I (IntuitionBase
0
CloseIt ("Librarys ?!?!?!?!?!?!?!?!?!?!?\n");
FileHandle = Open (argv[1],1005);
if (FileHandle == 0) CloseIt ("File OPEN Error ! \n");
Lread (Buffer,12,TRUE);
if (strncmp(&Buffer[0],"FORM",4) != 0) CloseIt ("Not
IFF-File !!! \n");
if (strncmp(&Buffer[8] ,"ILBM",4) != 0) CloseIt ("Not
ILBM-File !!! \n");
BMHDFlag = FALSE;
CMAPFlag = FALSE;
CAMGFlag = FALSE;
BODYFlag = FALSE;
Loop:
FoundChunk = FALSE;
Lread (Buffer,8,FALSE);
i f (Len <= 0)
i f BMHDFlag == TRUE) && (BODYFlag
TRUE) &&
(CMAPFlag == TRUE
(
else
if BMHDFlag != TRUE) I I (BODYFlag != TRUE) I I
(CMAPFlag ! = TRUE
(
Chunk Len
Buffer[4]*16777216+Buffer[5]*65536+Buffer[6]*256+Buffer[7];
224
S.l
ABACUS
IFF
0)
NewScreen.ViewModes = 0;
if (NewScreen.Width > 320)
NewScreen.ViewModes 1= HIRES;
if (NewScreen.Height > 200)
NewScreen.ViewModes 1= LACE;
NewScreen.Type = CUSTOMSCREEN;
NewScreen.Font = NULL;
NewScreen.DefaultTitle = (UBYTE *) argv[I);
NewScreen.Gadgets = NULL;
NewScreen.CUstomBitMap = NULL;
Screen = (struct Screen*) OpenScreen (&NewScreen);
if (Screen == 0) CloseIt (" No Screen !!! \n");
BytesPerRow = BMHD.Width/B;
ShowTitle (Screen,FALSE);
BMHDFlag = TRUE;
FoundChunk = TRUE;
if (strncmp (Buffer, "CMAPR,4) == 0)
{
before CMAP
0)
Bytecount = 0;
WhereIsIt =
(char *) Screen->RastPort.BitMap>Planes[b)+y*BytesPerRow;
if (BMHD.Compression == 0)
{
Lread (WhereIslt,BytesPerRow,TRUE);
}
if (BMHD.Compression == 1)
225
S.
while (ByteCount<BytesPerRow)
{
Lread (&Buffer[0],1,TRUE);
if (Buffer [0] < 128)
{
Lread (WhereIslt+ByteCount,Buffer[0]+1,TRUE);
ByteCount += Buffer[0]+1;
}
/* Buffer[O]
Lread (&Buffer[1],1,TRUE);
for (i=ByteCount;iByteCount+257-Buffer[0]);i++)
* (Wherelslt+!) = Buffer[1];
ByteCount += 257-Buffer[0];
}
BODYFlag = TRUE;
FoundChunk = TRUE;
if (strncmp (Buffer, "CAMG",4)
== 0)
if (FoundChunk == FALSE)
{
Lread (Buffer,ChunkLen,FALSE);
if ChunkLen & 1) == 1) Lread
(Buffer,1,FALSE);
}
goto Loop;
Program description
The program uses two universally supported routines. The
CloseIt () function closes the program in case of an error or the end
of the program. It checks what was opened and closes open files to
prevent system errors. The Readlt () function reads a certain quantity
of data.
The main program begins by opening the libraries and files, then
reading the data. First a test is performed for the existence of an IFF
ILBM , then the fIrst chunk in the main loop is selected. If recognized
by the program, its data is read in according to the rules described
above. Unknown chunks or those not supported by the program are
simply ignored.
226
5.1
ABACUS
IFF
When the necessary data is present, the BMHD reader opens a screen in
which the bit-map data with the BODY chunk: is entered. The program
waits for a mouse click in the upper left corner to close everything and
create its work. Next we see the ILBM format of an arrangement of all
of the chunks that can be encountered when you read an ILBM FORM.
Remember when writing that all of the chunks that are read, including
those that your program does not process, are written back to disk.
iHndef
'define
'define
'define
'define
'define
'define
'define
1LBM H
1LBM H
1D AN:FR
1D-MAHD
1D=MFHD
1D CMI6
ID-ILBM
ID=ILBM
'define
idefine
'define
'define
'define
ID_ANIM
ID_BMHD
ID_ANHD
ID CHAP
ID=GRAB
'define ID_DEST
'define ID_SPRT
'define ID_CAMG
'define
'define
'define
'define
ID BODY
1D-ATXT
ID-PTXT
ID=DLTA
'define ID_CRNG
Make1D('A','N",'F','R')
Make1D('M', 'A', 'H','D')
Make1D('M', 'F', 'H','D')
Make1D('C', 'M', '1','6')
MakeID('I', 'L','B','M') 1* Interleaved BitMap *1
MakeID('S', 'H', 'A', 'K') 1* Shakespeare-Chunk,
that contain the
ILBMs *1
MakeID('A', 'N', 'I','M') 1* Animation format *1
MakeID('B', 'M', 'H','D') 1* BitMap Header *1
MakeID('A','N','H','D') 1* Animations Header *1
MakeID('C','M', 'A','P') 1* Color Map *1
MakeID('G', 'R', 'A', 'B') 1* Hot Spot of the
BitMap *1
MakeID('D', 'E','S', 'T') 1* Bitplane
distribution *1
MakeID('S', 'P','R','T') 1* Sprite recognition *1
MakeID('C', 'A', 'M', 'G'l 1* Commodore Amiga
View *1
MakeID('B', 'O','D', 'Y') 1* BitMap Data *1
Make1D('A','T','X','T') 1* are used *1
MakeID ('P', 'T', 'X', 'T') 1*
h time *1
MakeID('D', 'L','T','A') 1* Anim Delta
movement *1
MakeID('C', 'R','N','G') 1* Color Cycling
Chunk *1
Well conclude this part by mentioning a few problems with IFF, and
possible solutions.
1.) Display screen size
Usually the size of the graphic and the size of the screen are found in
the bit-map header, on which the graphic is constructed. The value in w
and h always correspond to the number of pixels in the x and y
directions of the graphic. The values in p age wid t h and
pageHeight comprise the number of pixels of the screen in the x
and y directions. The values from DPaintII are also written in the
structure. This makes sense, because you can save a picture that is
much larger than the screen and display on a 320 x 200 pixel screen
using them.
Many programs that also support the OverScan mode, enter larger
values in the pageWidth and pageHeight than can be selected
because of the OverScan. This causes some problems because
227
s.
CYCLING=ON.
4.) The number of colors of a CMAP chunk
Other colormap problems occur when using HAM pictures. This
should contain all of the colors needed for the picture. But although six
bit-planes are used, this graphic type only uses 16 colors. There is
some disagreement about this because many programs save 16 colors,
some save 32 and still others save 64, because an IFF rule calculates
the number of colors based on I bitmap depth. and that results in 64.
A CMAP chunk never has the complete number of colors that can be
given through the BMHD chunk. Read the byte statement at the
beginning of the chunk, and never place the number of the color
register after the entry in the CMAP.
228
5.1
ABACUS
5.1.2
IFF
The FTXT string indicates that this file is a fonnatted text me (FTX1).
The two chunks supported by the FTXT fonnat are CHRS and FONS.
The FONS chunk consists of a font specifier structure that determines
which font should be used:
offset
Structure
FontSpeci fie r
{
OxOO
1 OxOl
2 Ox02
3 Ox03
4 Ox04
UBYTE id;
/* Font number /* 0 - 9 */
UBYTE padl;
UBYTE proportional; /* Proportional font ? */
/* 0 ~ unknown, 1 ~ yes, 2 ~ no */
UBYTE serif;
1* Serifs ? * /
1* 0 ~ unknown, 1 ~ yes, 2 ~ no */
char name[];
/* Font name (e.g. "topaz/S") */
)
229
5.1.3
SHDR SSeoreHeader
[NAME] fll/U" "
UUI" .. "
[AUTH] HU" .. "
[IRev] HU????
[(e)
ANNOUfII/" "
INSlllltRevlnstrument
TRAKltl'SEvents . <End>
The chunks
SMUS indicates that this IFF file is an SMUS (Simple MUsic Score)
ftle.
The SHDR chunk contains a ScoreHeader structure:
Offset
Structure
struet SSeoreHeader
(
o
2
3
4
OxOO
Ox02
Ox03
Ox04
UWORD tempo;
UBYTE volume; 1* volume (0-127) *1
UBYTE ctTraek; 1* number of voices *1
The (c) chunk contains the copyright notice (e.g., "(c) Helmut
Beethoven 1988").
The AUTH chunk contains the name of the author/composer (e.g.,
"Michael Sting").
The I Rev chunk can be used for storing other information pertaining
to the composition (e.g., revision).
230
5.1
ABACUS
IFF
Structure
struct Ref Instrument
1
2
3
OxOO
OxOl
Ox02
Ox03
Ox04
UBYTE register;
UBYTE type;
UBYTE datal,
data2;
char name[];
Structure
struct SEvent /* Simple Musical Event */
{
o OxOO
1 OxOl
2 Ox02
UBYTE SID;
UBYTE data;
0-127 (note)
These values specify the pitch of the tone to be played. The data byte
designates the length of the tone:
Bit 7
If this byte is set, the current note and the following note are
played as a chord.
Bit 6
If this bit is set, the current note and the following note are
played without interruption.
231
5.
Bits 4 and 5
These bits test for unusual note rhythms:
lictl: :!I:illl.ll:
Triplet
Quintuplet
Septuplet
"Normal" note
Bit 3
j3lcila
01
10
11
00
Dl::;!;illlill
1
2
3
Bits 0-2
These bits indicate note length:
lic:t s;: lla Jus;:
Whole
Half
Quarter
Eighth
Sixteenth
Thirty-second
Sixty-fourth
12Bth
128 (rest)
BjcaIl!
000
001
010
all
100
101
110
111
j&!;lIIlilJ
a
1
2
3
4
5
6
7
If SID contains the value 128, a rest is played. The duration of the rest
length is specified in the da t a byte.
129 (instrument)
This SEvent changes the instrument for this particular voice. The
data byte contains the number of the instrument
130 (time)
232
This SEvent states the time. The quotient of the top 5 and bottom 3
bits give the time. The top 5 bits are given in beats per second (1-32),
while the bottom 3 bits are given in SID = note. To create 4/4 time,
the value 3 must be given in the top 5 bits and the value 2 (quarter
note) in the bottom 3 bits. A value of 0 in the top 5 bits specifies one
beat per second.
S.l
ABACUS
131 (pitch)
llim
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
132 (volume)
IFF
C
G
D
A
E
B
FI
CI
F
Bb
Eb
Ab
Db
Gb
Cb
This SEvent assigns a new volume to this voice. Values can range
from 0 to 127.
5.1.4
VHDRIlliVoiee8Header
[NAME]UU" .. "
[Ie) ] UU" .. "
[AUTH]UU" . "
ANNOnU" "
ATAKUUEGPoint
RLSEUUEGPOINT
BODYilliSamples ... <End>
The 8 Svx chunk is the identification string for 8-bit sampled voice
meso
233
Structure
struct Voice8Header
{
OxOO
4 Ox04
8 OxOO
12 OxOc
14 OxOxe
15 OxOf
16 OxlO
20 Ox14
ULONG oneShotHiSamples,
repeatHiSamples,
samplesPerHiCycle;
UWORD samplesPerSec;
1* Sampling Frequency
UB'lTE ctOctave,
1* number of octaves
sCompression;
1* Data compression?
LONG volume;
1* see EGPoint.dest
*1
*1
*1
*1
(c)
The AUTH chunk contains the names of the author (e.g., "Jim
Cottonfield fi").
The ANNO chunk contains comments (annotations) about the sound.
This chunk must be nominally present but can consist of 0 bytes.
The ATAK chunk contains the EGPoint structure which allows you to
control the attack of the sound (start at a certain volume and reach a
certain volume in a certain amount of time). The EGPoint structure
looks like this:
offset
Structure
struct EGPoint
{
o OxOO
2 Ox02
6 Ox06
The duration variable specifies the time the volume has to reach the
new value. The dest variable specifies the factor by which the volume
should be increased. This latter variable is a fixed-point variable: The
top 16 bits indicate the amount to the left of the decimal point, while
the bottom 16 bits indicate the amount to the right of the decimal
point. A value of OxOOO15000 means a factor of 1.5.
The RLSE chunk contains an EGPoint structure used for controlling
the decay (volume fade).
The BODY chunk contains the sample itself.
234
ABACUS
6.
Library:
Functions:
Description:
Structures:
Listing of all of the important structures that are used by the functions
of this library. The name of the include file which contains the
definition follows the structure, enclosed in <>. A hexadecimal and
decimal offset of the start of the structure elements in bytes precedes
each structure element, so that you can find the elements with your
debugger. Rember structures can change, so do not depend on addresses
of system structures.
Each function is described as follows:
Name:
Short descriptioo.
Syntax:
Syntax of the function, the assembly language registers, the offset and
the parameter types.
Description:
Parameter:
Result:
Explanation:
Warning:
You must remembct this information when you call the function. Read
this if you read nothing else in the function description.
Comments:
Example:
See Also:
235
6.1
Special functions
InitCode
InitStruct
FindResident
InitResident
Alert
Debug
6.1.2
241
241
241
242
Interrupt functions
Disable
Fnable
Forbid
Permit
SetSR
SuperState
UserState
SetIntVector
AddIntServer
RemIntServer
Cause
236
240
240
242
242
243
243
243
243
244
244
245
245
245
6.1
ABACUS
6.1.3
Memory functions
Allocate
DeaJlocate
AllocMem
AllocAbs
FreeMem
AvailMem
AllocEntry
FreeEntry
6.1.4
F.nJ.ueue
FindName
250
251
251
252
252
252
252
253
Task functions
AddTask
RemTask
FindTask
SetTaskPri
SetSignal
SetExcept
Wait
Signal
AllocSignal
FreeSignal
AllocTrap
FreeTrap
6.1.6
246
246
247
247
248
248
248
249
6.1.5
253
255
255
255
256
256
256
257
257
257
258
258
Message functions
AddPort
RemPort
PutMsg
GetMsg
ReplyMsg
WaitPort
FindPort
258
259
259
260
260
260
261
237
6.
TB AMiGA LIBRARIES
6.1. 7
Library functions
AddLi1nry
CloseLibrary
MakeFunctions
MakeUbrary
RemUbrary
OldOpenUbrary
OpenLibrary
SetFunction
SumLibrary
6.1.8
261
262
262
263
263
264
264
264
265
Device functions
AddI:levre
RemDevice
0penDevice
CloseDevice
DolO
SeOO.IO
CheckIO
WaitIO
AbortIO
265
266
266
266
267
268
268
269
269
Resource functions
6.1.10
AddResource
269
RernResource
OpenResource
270
270
ReleaseSemaphore
AttemptSemaphore
ObtainSemaphoreList
ReleaseSemaphaeList
FindSemaphore
AddSemaph<re
RemSemaphore
6.1.11
272
273
273
273
274
238
270
271
271
272
274
274
275
275
6.1
ABACUS
6.1.12
Additional functions
RawDoFmt
GetCC
TypeOtMem
27S
276
276
Oxoo
0x22
Ox24
Ox26
Ox2A
Ox2E
Ox32
Ox36
Ox3A
Ox3E
Ox42
Ox46
Ox4A
Ox4E
Ox52
Ox54
Ox1l4
Ox1l8
Oxllc
Ox120
Ox122
Ox124
Ox126
Ox127
Ox128
Ox12A
Ox12C
Ox130
Ox134
Ox138
Ox13C
Ox140
Ox142
Ox146
Ox15E
Oxl6C
Ox17A
Ox188
Ox196
Ox1A4
OxIB2
Ox202
Ox2l2
Ox213
Ox2l4
Ox222
Ox226
00
34
36
239
Ox22A
Ox22C
Ox238
Ox24C
};
6.1.1
Special functions
bnitCode
Syntax:
InitCode(StartClass, Version);
-72
DO
D1
ULONG StartC1ass;
ULONG Version;
Description:
This function initializes all of the modules with the given features, and
a version number greater than or equal to the one given.
Parameters:
StartClass:
Version:
InitStruct
Syntax:
Description:
240
InitTable:
Memory:
Size:
6.1 THE
ABACUS
FindResident
EXEC LIBRARY
Syntax:
Description:
This function searches through the system list for a resident module
with the given name.
Parameters:
Name:
Result:
Resident
was found.
IInitResident
Syntax:
InitResident(Resident, SegList);
-102
Al
01
ULONG *Resident;
struct List *SegList;
Description:
Parameters:
Resident
SegList:
OxOO
Ox02
Ox06
OxOA
OxOB
OxOC
OxOO
OxOE
Ox12
Ox16
OxlA
00
02
06
10
11
12
13
14
18
22
26
UWORD rt_MatchWord;
struct Resident *rt_MatchTag;
APTR rt_EndSkip;
UBYTE rt_Flags;
UBYTE rt_Version;
UBYTE rt_Type;
BYTE rt _P ri;
char *rt Name;
char *rt=IdString;
APTR rt_Init;
};
RTW-NEVER OL
RTW COLDSTART 1L
IAlert
Syntax:
A1ert(AlertNum, Parameters);
-108
07
A5
ULONG A1ertNum;
ULONG *Parameters;
241
Description:
Parameters:
AlertNum:
Parameters:
IDebug
Syntax:
Debug();
-114
Description:
This function starts the system debugger. If the address was changed
through SetFunction () , then another debugger can be used.
6.1.2
Interrupt functions
IDisable
Syntax:
-120
Description:
Result:
Comments:
See Also:
Enable (),Forbid(),Perrnit()
IEnable
Syntax:
-126
Description:
Result:
Comments:
See Also:
242
ABACUS
IForbid
Syntax:
Forbid 0 ;
-132
Description:
Explanation:
Other tasks also receive execution time if the called tasks are set in the
Wait status.
See Also:
Permit (),Disable(),Enable()
IPermit
Syntax:
Permit 0
-138
Description:
See Also:
Forbid(),Disable(),Enable()
ISetSR
Syntax:
Description:
This function allows changes to the value of the CPUs status register.
Parameters:
NewSR:
Mask:
transmitted.
The value of the status register before the call.
Result:
OldSR:
Example:
ISuperState
Syntax:
OldSysStack = SuperState()
DO
-150
Description:
Result:
243
6.
Explanation:
The function does not work when you are already in the supervisor
status. Then the value of OldSysStack is zero.
See Also:
UserS tate ()
luserState
Syntax:
UserState(SysStack)
-156
DO
Description:
Parameter:
SysStack:
See Also:
SuperState ()
ISetlntVector
Syntax:
Description:
Parameters:
IntNumber:
Interrupt:
Result:
Oidinterrupt:
OxOO
OxOE
Ox12
00
14
18
Ox16
22
};
OxOO
Ox04
OxOB
OxOC
00
04
08
12
);
OxOO
244
00
ABACUS
OxOE
Ox10
14
16
UWORD sh Pad;
-
};
AddInitServer
Syntax:
Description:
This function adds another interrupt to the interrupt server list. The
priority of the interrupt is tested when it is executed.
Parameters:
IntNwnber:
Interrupt:
See Also:
RemIntServer
Interrupt nwnber.
Pointer to the interrupt node structure.
Syntax:
Description:
This function removes the given interrupt structure from the interrupt
server list.
Parameters:
IntNwnber:
Interrupt:
See Also:
AddlntServer(),Cause(),SetlntHandler()
Interrupt nwnber.
Pointer to the interrupt node structure.
Icause
Syntax:
Cause (Interrupt)
-180
A1
struct Node *Interrupt;
Description:
Parameters:
Interrupt:
See Also:
AddlntServer(),RemIntServer(),SetlntHandler()
245
6.1.3
Memory functions
Allocates memory blockl
IAlIocate
Syntax:
Description:
Parameters:
FreeList:
ByteSize:
Result:
MemoryBlocJc:
Deallocate(),
AllocAbs(),
AllocEntry(), AllocRememher()
AllocMem() ,
Oxoo
OxOE
OxlO
00
14
16
Ox14
20
Ox1S
OxlC
24
Ox20
32
28
);
OxOO
00
Ox04
04
Ox08
08
};
IDeallocate
Syntax:
246
ABACUS
Description:
Parameters:
FreeList
Pointer to a memory free list.
MemoryBlock:
Pointer to the memory block.
ByteSize:
Size of the memory block.
See Also:
Allocate ()
IAllocMem
Syntax:
Description:
This function allocates memory from the system memory list. This
memory must meet the given requirements and have the desired size.
Parameters:
ByteSize:
Size of the requested memory block in bytes.
Requirements: Flags value that specifies memory attributes.
Result:
MemoryBlock:
Pointer to the allocated memory block. This parameter
contains zero if an error occurs.
See Also:
FreeMem(),Allocate(),AllocEntry(),AllocAbs(),
AllocRemember ()
IAlioCAbs
Syntax:
Description:
Parameters:
ByteSize:
Location:
Result:
MemoryBlock:
247
See Also:
FreeMem(),AllocMem(),AllocEntry(),Allocate(),
AllocRemember ()
IFreeMem
Syntax:
FreeMem(MemoryB1ock, ByteSize);
-210
Al
DO
ULONG *MemoryBlock;
ULONG ByteSize;
Description:
Parameters:
MemoryBlock:
ByteSize:
See Also:
AllocMem(),FreeEntry(),FreeRemember(),
Deallocate ()
IAvaiIMem
Syntax:
Size = Avai1Mem(Requirements);
DO
-216
D1
ULONG Size;
ULONG Requirements;
Description:
This function searches the system list for the largest memory range that
has the necessary requirements.
Parameter:
Result:
Size:
Allocates
Syntax:
MemList = A11ocEntry(Entry);
DO
-222
AO
struct MemList *MemList;
struct MemList Entry;
Description:
Parameter:
Entry:
Result:
MemList:
248
6.1
ABACUS
See Also:
FreeEntry(),AllocMem(),AlloCAbs(),Allocate(),
AllocRernember ()
struct MemList <exec/memory.h>
{
OxOO
00
OxOE
14
OxlO
Ox18
16
24
};
mlmemlHE
Memory_Types:
HEMF PUBLIC (lLO)
HEMF=CHIP (lLl)
union
ULONG meu Reqs; /* Type of the memory * /
APTR meu_Addr; /* Address of the memory region */
}
OxOO
Ox04
Ox08
me Un;
04- ULONG me_Length;
08
};
Defmition:
me un me Un
me Reqs me Un. meu Reqs
me-Addr me-Un.meu-Addr
IFreeEntry
Syntax:
FreeEntry(Entry);
-228
AD
struct MemList *Entry;
Description:
Parameter:
Entry:
See Also:
AllocEntry(),FreeMern(),Deallocate(),
FreeRernember ()
249
6.1.4
IInsert
Syntax:
Description:
This function inserts a new node in the list. following the specified
node.
Parameters:
List:
Node:
Predecessor:
See Also:
OxOO
00
Ox04
04
Ox08
08
OxOC
OxOD
OxOE
12
13
14
);
Ox08
Ox DC
12
OxOO
Ox04
00
OxOO
Ox04
Ox08
Ox09
OxOA
OxOE
);
250
00
04
08
09
10
14
6.1
ABACUS
OxOO
Ox04
Ox08
00
04
08
/* following Node */
/* previous Node */
};
Node_Type:
NT UNKNOWN OL
NT-TASK 1L
NT INTERRUPT 2L
NT-DEVICE 3L
NT- MSGPORT 4L
NT-MESSAGE SL
NT FREEMSG 6L
NT- REPLYMSG 7L
NT RESOURCE 8L
NT-LIBRARY 9L
NT MEK>RY 10L
NT-SOFTINT llL
NT FONT 12L
NT-PROCESS 13L
NT SEMAPHORE 14L
NT-SIGNALSEM 1SL
IAddHead
Syntax:
AddHead(List, Node);
-240
AO
A1
struct List *List;
struct Node *Node;
Description:
Parameters:
List:
Node:
See Also:
IAddTail
Syntax:
AddTai1(List, Node);
-246
AO
A1
struct List *List;
struct Node *Node;
Description:
Parameters:
List:
Node:
See Also:
251
IRemove
Syntax:
Remove{Node);
-252
A1
struct Node *Node;
Description:
Parameter:
Node:
See Also:
IRemHead
Syntax:
Node = RemHead(List);
DO
-258
AO
struct List *List;
Description:
Parameter:
List:
See Also:
Insert(),Remove(),AddHead(),AddTail(),RemTail()
IRemTail
Syntax:
Node = RemTail(List);
DO
-264
AO
struct List *List;
Description:
Parameter:
List:
See Also:
En ueue
Syntax:
Enqueue(List, Node);
-270
AO
Al
struct List *List;
struct Node *Node;
Description:
This function inserts the given node in the list. The priority of the node
determines the position of insertion. The higher the priority. the closer
to the head of the list the node is inserted.
151
6.1
ABACUS
Parameters:
List:
Node:
FindName
Syntax:
Description:
This function searches the specified list for a node of the same name. A
pointer to the found node structure is returned.
Parameters:
List:
Name:
Result:
Node:
6.1.5
Task functions
IAddTask
Syntax:
Description:
Parameters:
Task:
InitPC:
FinalPC:
See Also:
RemTask(),FindTask()
extern struct Task <exec/tasks.h>
{
OxOO
00
OxOE
OxOF
Oxl0
Oxll
Ox12
Ox16
OxlA
14
15
16
17
18
22
26
253
Ox1E
Ox22
Ox24
Ox26
30
34
36
38
Ox2A
42
Ox2E
46
Ox32
50
Ox36
54
Ox3A
58
Ox3E
62
Ox42
66
Ox46
70
Ox4A
74
Ox58
88
Ox5c
92
/*
/*
/*
/*
};
Task_Bytes:
TB PROCTlME OL
TB STACKCHK 4L
TB EXCEPT 5L
TB SWITCH 6L
TB LAUNCH 7L
Task_Flags:
TF ]ROCTlME (1LO) /* See above */
TF_ STACKCHK (lL4)
TF EXCEPT (lL5)
TF_SWITCH (lL6)
TF_LAUNCH (1L7)
Task State:
TS INVALID OL
/* invalid task */
TS ADDED 1L
/* the task is inserted in the list */
TS RUN 2L
/* the task is running at the moment */
TS-READY 3L
/*the task is ready to run with the processor */
TS WAIT 4L
/* the task waits for a signal */
TS EXCEPT 5L
/* the task is disengaged from the processor */
TS REMOVED 6L
/*the task is removed */
Signal_Byte:
SIGB ABORT OL
SIGB CHILD 1L
SIGB BLIT 4L
SIGB SINGLE 4L
SIGB DOS 8L
Signal_Flag:
SIGF_ABORT (lLO)
SIGF_CHILD (lLl)
SIGF_BLIT (lL4)
SIGF_SINGLE (lL4)
SIGF DOS (1L8)
254
6.1
ABACUS
IRemTask
Syntax:
RemTask(Task);
-288
Al
struct Task *Task;
Description:
This function removes the given task from the system. All previous
accesses to resources must be returned as well.
Parameter:
Task:
See Also:
AddTask(),FindTask()
IFindTask
Syntax:
Task = FindTask(Name);
DO
294
A1
struct Task *Task;
char *Name;
Description:
This function searches the system list for the task of the same name.
The separate task is searched with a null pointer.
Parameter:
Name:
Result:
Task:
See Also:
AddTask(),RemTask()
ISetTaskPri
Syntax:
Description:
This function assigns the given task a new priority. The system then
re-calculates the times assigned to each task. The task with the highest
priority is assigned to the processor.
Parameters:
Task:
Result:
Priority:
OldPriority:
255
!SetSignal
Syntax:
-306
DO
01
ULONG OldSignals;
ULONG NewSignals;
ULONG SignalSet:
Description:
Parameters:
NewSignal:
SignaiSet:
Result:
OldSignal:
See Also:
AllocSignal(),FreeSignal()
!SetExcept
Syntax:
-312
DO
01
ULONG OldSignals:
ULONG NewSignals:
ULONG SignalSet:
Description:
Parameters:
NewSignals:
SignaiSet:
Result:
OldSignals:
!Wait
Syntax:
-318
DO
ULONG Signals:
ULONG SignalSet;
Description:
This function waits until one or more signals occur. The task is set in
the Wai t status, thus requiring no processor time.
Parameter:
SignalSet:
Result:
Signals:
See Also:
Signal ()
256
ABACUS
ISignal
Syntax:
Signal(Task, SignalSet);
-324
Al
DO
struct Task *Task;
ULONG SignalSet;
Description:
This function sends a signal to another task. This can be taken from the
wai t status, thus requiring no processor time.
Parameters:
Task:
SignalSet:
See Also:
Wait ()
IAIIocSignal
Syntax:
SignalNum = AllocSignal(SignalNum);
DO
-330
DO
LONG SignalNum;
LONG SignalNum;
Description:
Parameter:
Signa1Num:
Signal number.
Result:
SignalNum:
See Also:
FreeSignal ()
IFreeSignal
Syntax:
FreeSignal(SignalNum);
-336
DO
LONG SignalNum;
Description:
Parameter:
Signa1Num:
See Also:
AllocSignal ()
257
IAllocTrap
Syntax:
TrapNum = AllocTrap(TrapNum);
DO
-342
DO
LONG TrapNum;
LONG TrapNum;
Description:
Parameter:
TrapNum:
Result:
TrapNum:
See Also:
FreeTrap ()
IFreeTrap
Syntax:
FreeTrap(TrapNum);
DO
-348
LONG TrapNum;
Description:
Parameter:
TrapNum:
See Also:
AllocTrap ( )
6.1.6
Message functions
IAddPort
Syntax:
AddPort (Port);
-354
Al
struct MsgPort *Port;
Description:
This function inserts a new message port in the system list. The name
and the priority of the structure are initialized so the port can sort
correctly, and so all of the other tasks can search for the port in which
the name is used.
Parameter:
Port:
See Also:
RemPort(),FindPort()
258
ABACUS
OxOO
00
OxOE
14
OxOF
15
OxlO
16
Ox14
20
Ox22
34
};
mp_Softlnt mp_SigTask
mp_Flags:
PF ACTION 3L
PA-SIGNAL OL
PA SOFTINT lL
PA IGNORE 2L
IRemPort
Syntax:
RemPort (Port)
-360
A1
struct MsgPort *Port;
Description:
This function removes a port from the system list. This port is no
longer accessible through a pointer, and the FindPort () function no
longer finds this port. After calling this function the memory should be
freed again.
Parameter:
Port:
See Also:
AddPort(),FindPort()
IPutMsg
Syntax:
PutMsg(Port, Message);
-366
AO
A1
struct MsgPort *Port;
struct Message *Message;
Description:
Parameters:
Port:
Message:
See Also:
GetMsg () ReplyMsg ()
259
OxOO
00
OxOE
14
OxI2
OxI4
18
20
Messages */
struct MsgPort *mn ReplyPort; /* pointer to the port
in which the report
is sent when the
answer follows */
UWORD mn_Length; /* Byte number of the report */
};
IGetMsg
Syntax:
Message = GetMsg(Port)
DO
-372
AD
struct Message *Message;
struct MsgPort *Port;
Description:
This function gets the fIrst available message from the message port
list. If no message currently exists in the port, the function returns a
value of zero.
Parameter:
Port:
Result:
Message:
See Also:
PutMsg(),ReplyMsg(),WaitPort()
IReplyMsg
Syntax:
RepIyMsg(Message);
-378
Al
struct Message *Message;
Description:
Parameter:
Message:
See Also:
PutMsg(),GetMsg(),WaitPort()
WaitPort
Waits
Syntax:
Message = WaitPort(Port);
DO
-384
AO
struct Message *Message;
struct Port *Port;
Description:
260
ABACUS
Parameter:
Port:
Result:
Message:
See Also:
IFindPort
Syntax:
Port = FindPort(Name)
DO
-390
A1
struct MsgPort *Port;
char *Name;
Description:
This function searches the system list for the port of the same name. If
the name is found, a pointer is returned. A zero is returned if the name
is not found.
Parameter:
Name:
Result:
Port:
6.1.7
Library functions
IAddLibrary
Syntax:
AddLibrary(Library);
-396
A1
struct Library *Library;
Description:
This function inserts a new library in the system list. The library can
then be accessed by any task. The function calculates the checksum of
the library entries.
Parameter:
Library:
See Also:
MakeLibrary(),RemLibrary(),OpenLibrary(),
CloseLibrary ()
OxOO
00
OxOE
Ox OF
Ox10
14
15
16
UBYTE lib_Flags;
UBYTE libyad;
UWORD lib_NegSize;
Ox12
18
UWORD lib_PosSize;
Ox14
20
UWORD lib_Version;
the system */
/* Flags s.u. */
/* unused fill byte */
/* size of the vector table in
bytes */
/* size of the data (also in
bytes) */
/* Version number of library */
261
Oxl6
Oxl8
22
24
OxlC
Ox20
28
32
Ox22
34
};
Lib_Flags:
LIBF SUMMING (lLO)
LIBF CHANGED (lLl)
LIBF SUMUSED (lL2)
LIBF DELEXP (lL3)
Definition:
lh Node lib Node
Ih:=Flags lib_Flagslh~d lib-pad
Ih_NegSize lib_NegSize
lh PosSize lib PosSize
lh Version lib Version
lh-Revision lib Revision
lh:=IdString lib:=IdString
lh Sum lib Sum
Ih-OpenCnt-lib OpenCnt
LIB VECTSIZE 61:
LIB RESERVED 4L
LIB BASE (-LIB VECTSIZE)
LIB:=USERDEF (LIB_BASE-(LIB_RESERVED*LIB_VECTSIZE)}
LIB NONSTD (LIB USERDEF)
lib-Vectors:
LIB OPEN (-6L)
LIB:=CLOSE (-12L)
LIB EXPUNGE (-l8L)
LIB-EXTFUNC (-24L)
ICloseLibrary
Closes libraryl
Syntax:
CloseLibrary (Library);
-414
A1
struct Library *Library;
Description:
Parameter:
Library:
See Also:
OpenLibrary ()
IMakeFunctions
Syntax:
262
ABACUS
Description:
Parameters:
Target
Function jump table address.
FunctionArray:
Pointer to table containing the addresses.
FuncDispBase:
Pointer to basis address to which all of the addresses
should be relatively calculated, or zero.
Result:
TableSize:
IMakeLibrary
Syntax:
Creates library
-84
AO
Al
A2
DataSize, CodeSize);
DO
Dl
ULONG
ULONG
ULONG
ULONG
ULONG
ULONG
*Library;
*Funclnit;
*Structlnit;
*Liblnit;
DataSize;
*CodeSize;
Description:
This function makes an entire library. For this the vector table and a
data list are combined. In addition, the routine allocates enough
memory, and starts an existing initialization routine.
Parameters:
Funclnt:
StructInt:
LibInt:
DataSize:
CodeSize:
Result:
Library:
Pointer to a library.
See Also:
Ini tStruct ()
IRemLibrary
Removes Iibraryl
Syntax:
Description:
This routine removes a library from the system list. Once removed,
this library can no longer be opened through OpenLibrary () .
263
Parameter:
Library:
Result:
Error:
See Also:
AddLibrary(),MakeLibrary()
IOldOpen Library
Syntax:
absolute OpenLibraryl
Library = OldOpenLibrary(LibName);
DO
-408
Al
Description:
Parameter:
LibName:
Result:
Library:
See Also:
OpenLibrary () ,CloseLibrary ()
IOpenLibrary
Syntax:
Opens Iibraryl
Library = OpenLibrary (LibNarne, Version);
DO
-552
A1
DO
Description:
Parameters:
LibName:
Version:
Result:
Library:
See AlSO:
OldOpenLibrary(),CloseLibrary()
SetFunction
Syntax:
Sets Iibrar
-420
LONG OldFunct;
struct Library *Library;
LONG Offset;
ULONG FunctEntry;
264
function vector
Al
AD
DO
6.1
ABACUS
Description:
Parameters:
Library:
Result:
Offset:
FunctEntry:
OldFunct:
ISumLibrary
Syntax:
SumLibrary(Library);
-426
Al
struct Library *Library;
Description:
This function calculates the checksum of the library. This can verify
whether the library has been illegally tampered with.
Parameter:
Library:
Explanation:
6.1.8
Device functions
IAddDevice
Syntax:
AddDevice(Device);
-432
Al
struct Device *Device;
Description:
This function adds a new device to the system. Any program can use
this device.
Parameter:
Device:
See Also:
RemDevice(),OpenDevice(),CloseDevice()
OxOO
00
1* Device Structure
Library Structure *1
Ox22
34
};
265
6.
IRemDevice
Syntax:
Error = RemDevice(Device);
DO
-438
Al
LONG Error;
struct Device *Device;
Description:
This function removes a device from the system. The device cannot be
accessed or opened by name.
Parameter:
Device:
Result:
Error:
See Also:
AddDevice(),OpenDevice(),CloseDevice()
IOpenDevice
Opens devicel
Syntax:
Description:
This function opens the specified device and initializes the given I/O
request block.
Parameters:
DevName:
Unit:
IORequest
Flags:
Result:
Error:
See Also:
IcloseDevice
Closes devicel
Syntax:
CloseDevice (IORequest) ;
-450
Al
struct IORequest *IORequest;
Description:
This function closes an open device. Access ends and the IORequest
structure is freed for further use.
Parameter:
IORequest
See Also:
AddDevice(),RemDevice(),OpenDevice()
266
6.1
ABACUS
IDolo
Syntax:
Error = DoIO(IORequest);
DO
-456
AI
LONG Error;
struct IORequest *IORequest;
Description:
This function assigns a device that executes the given command in the
IORequest structure. The command accesses the task as long as
necessary.
Parameter:
IORequest
Resule
Error:
See Also:
SendIO(),WaitIO()
struct IORequest <exec/io.h>
(
Oxoo
OxOE
00
14
Ox12
18
Ox16
Ox18
Ox19
22
24
25
Ox1A
26
};
Unit_Flags:
UNITF ACTIVE (lLO)
UNITF INTASK (lLl)
struct Unit <exec/devices.h>
/* Unit is addressable */
/* Unit is working */
OxOO
00
Ox04
Ox05
Ox06
04
05
06
UBYTE unit_flags;
UBYTE unit~d;
UWORD unit_OpenCnt;
Ox08 08
l;
I/O-Errors:
IOERR OPENFAIL -lL
1*
IOERR-ABORTED -2L
/*
IOERR NOCMD -3L
1*
IOERR BADLENGTH -4L
/*
struct IOStdReq <exec/io.h>
/* pointer to the
message port of the
Unit */
/* Message Structure */
OxOO
OxOE
00
14
Ox12
18
267
Ox16
Ox18
Ox19
22
24
25
UWORD io_Command;
UBYTE io_Flags;
BYTE io_Error;
OxlA
26
ULONG iO_Actual;
OxlE
Ox22
Ox26
30
34
38
ULONG iO_Length;
APTR io Data;
ULONG ie_Offset;
Ox2A
42
/* Device command */
/* Device dependent flags */
/* Device dependent error
IT'essage */
/* number of the data bytes sent
up to now */
/* number of bytes to transfer */
/* pointer to the data buffer */
/* Variable for the block
structured devices */
};
io COllllland:
DEV BEGINIO (-30Ll
DEV ABORTIO (-36Ll
io_Fags:
lOB_QUICK OL
IOF_QUICK (lLO)
io Command:
CMD INVALID OL
CMD RESET lL
CMD READ 2L
CMD-WRITE 3L
CMD UPDATE 4L
CMD CLEAR 5L
CMD STOP 6L
CMD START 7L
CMD FLUSH 8L
CMD-NONSTD 9L
ISendIO
Syntax:
SendIO(IORequest);
-462
Al
struct IORequest *IORequest;
Description:
Parameter:
IORequest
See Also:
ICbecklO
Syntax:
Result = CheckIO(IORequestl;
DO
-468
Al
struct IORequest *Result
struct IORequest *IORequest;
Description:
Parameter:
10Request
268
ABACUS
Result:
Result:
IWaitlO
Syntax:
Error = WaitIO(IORequest);
DO
-474
Al
LONG Error;
struct IORequest *IORequest;
Description:
Parameter:
IORequest:
Result:
Error:
Warning:
See Also:
SendIO () .0010 ()
IAbortlO
Syntax:
Error = AbortIO(IORequest)
DO
-480
A1
LONG Error;
struct IORequest *IORequest;
Description:
Parameter:
IORequest:
Result:
Error:
See Also:
6.1.9
Resource functions
IAddResource
Syntax:
AddResource (Resource);
-486
Al
struct Node *Resource;
Description:
This function inserts a new resource in the system list. Then it can be
accessed by all of the other tasks. The resource should already be
addressable before addition to the list.
269
Parameter:
Resource:
See Also:
RemResource () , OpenResource ()
RemResource
Syntax:
Removes
RemResource (Resource);
-492
Al
Description:
Parameter:
Resource:
See Also:
AddResource () , OpenResource ()
IOpenResource
Syntax:
-498
Al
DO
Description:
This function opens a resource to access. The call returns the pointer to
the desired resource. The function fast searches to see if a resource with
the given name is present. Then the version number of the found
resource is compared to the Version parameter. If the present resource
has an older version number, the resource is not opened.
Parameters:
ResName:
Version:
Result:
Resource:
6.1.10
Initializes
Syntax:
Description:
270
6.1
ABACUS
Parameter:
SignalSemaphore:
See Also:
OxOO
OxOe
OxlO
OxIC
Ox28
Ox2C
Ox2E
00
14
16
28
40
44
46
);
OxOO
Ox22
Ox24
00
34
36
};
OxOO
Ox08
OxOC
00
08
12
);
IObtainSemaphore
Syntax:
ObtainSemaphore(SignalSemaphore);
-564
AO
struct SignalSemaphore *SignalSemaphore;
Description:
Parameter:
Signal Semaphore:
Pointer to the initialized SignalSemaphore
structure.
See Also:
ObtainSemaphoreList(),InitSemaphore(),
ReleaseSemaphore(),TransferSemaphore(),
AttemptSemaphore(),Procure()
ReleaseSema hore
Releases si
Syntax:
ReleaseSemaphore(SignalSemaphore);
-570
AO
struct SignalSemaphore *SignalSemaphore;
Description:
271
Parameter.
SignalSemaphore:
Pointer to the initialized SignalSemaphore
structure.
Warning:
See Also:
ObtainSemaphore(),ObtainSemaphoreList(),
Procure ()
lAttemptSemaphore
Syntax:
Success = AttemptSemaphore(SignalSemaphore);
DO
-576
AD
BOLL Success;
struct SignalSemaphore *SignalSemaphore;
Description:
Parameter:
SignalSemaphore:
Pointer to an initialized SignalSemaphore
structure.
Returns TRUE if the semaphore can be accessed, and
FALSE if another task has locked it
Result:
Success:
See Also:
ObtainSemaphore(),ObtainSemaphoreList(),
ReleaseSemaphore(),Procure()
IObtainSemaphoreList
Syntax:
ObtainSemaphoreList(List);
-582
AD
struct Signal Semaphore List;
Description:
Parameter:
List:
See Also:
ObtainSemaphore(),ReleaseSemaphore(),
ReleaseSemaphoreList(),Procure()
272
ABACUS
ReleaseSema horeList
Syntax:
ReleaseSemaphoreList(List);
-588
AO
Description:
Parameter:
List:
See Also:
IFindSemaphore
Syntax:
Finds SilnalSemaphore!
SignalSemaphore = FindSemaphore (Name);
DO
-594
AO
Description:
Parameter:
Name:
Result:
SignalSemaphore:
Pointer to the Signal Semaphore if found, or zero if
the signal semaphore could not be found.
!AddSemaphore
Syntax:
Adds signalsemaphore!
AddSemaphore (SignalSemaphore);
-600
AD
Description:
This function inserts a new semaphore in the system list. The name
and the priority should be initialized to ensw-e proper processing.
Parameter:
Signal Semaphore:
Pointer to an initialized SignalSemaphore
structure.
See Also:
RemSemaphore(),InitSemaphore(),FindSemaphore()
273
Removes signalsemaphorel
IRemSemaphore
Syntax:
RemSemaphore(SignalSemaphore);
-606
AO
struct SignalSemaphore *SignalSemaphore;
Description:
This function removes a semaphore that was inserted in the system list
by AddSemaphore () .
Parameter:
SignalSemaphore:
Pointer to existing semaphore in the system list.
See Also:
AddSemaphore ( ) FindSemaphore ( )
6.1.11
ISumKickData
Syntax:
SumKickData ()
-612
Description:
See Also:
IAddMemList
Syntax:
Description:
This function defines a new memory range that is added to the list of
free memory.
Parameters:
Size:
Attributes:
Pri:
Base:
Name:
274
6.1
ABACUS
Error number.
Result:
See Also:
Allocate(),AllocMem(),AllocEntry(),
AllocRemember ( )
lcOpyMem
Copies memoryl
Syntax:
Description:
This function copies the given memory range to a new position by the
fastest means.
Parameters:
Source:
Dest:
Size:
See Also:
CopyMemQuick ()
ICopyMemQuick
Syntax:
Description:
Parameters:
Source:
Dest:
Size:
Warning:
See Also:
CopyMem()
275
6.1.12
Additional Functions
Formats character string datal
IRawDoFmt
Syntax:
Description:
Parameters:
FormatString:
DataStream:
PutChProc:
PutChData:
IGetCC
Syntax:
Conditions = GetCC();
DO
-528
ULONG Conditions;
Description:
Result:
Condition codes
ITypeOfMem
Syntax:
Attributes = TypeOfMem(Address);
DO
-534
Al
ULONG Attributes;
ULONG Address;
Description:
Parameter:
Address:
Result:
Attributes:
ABACUS
6.2
This list includes the DOSBase structure, in which you'll see different
devices. Through that you can determine which drives are connected to
the Amiga, because a drive is also a device (DFO:, DFl:, ...).
6.2.2
278
279
279
Seek
Write
280
281
File management
CreateDir
CurrentDir
DeleteFile
Examine
ExNext
Info
ParentDir
Rename
SetComment
SetProtection
282
282
283
283
283
284
285
285
285
286
277
6.2.3
22,7
22,8
22,8
22,9
22,9
DupLock
Input
IoErr
IsInteroctive
Lock
Output
UnLock
6.2.4
290
290
Process management
291
292
CreateProc
DateStamp
Delay
DeviceProc
Exit
WaitForChar
6.2.5
292
293
293
293
Loading programs
295
295
296
Execute
LoadSeg
UnLoadSeg
6.2.6
6.2.1
296
297
!close
Closes filel
Syntax:
Close (File)
-36
01
struct FileHandle *File;
Description:
Parameter:
File:
Comments:
You must close any open files before ending a program. Unclosed files
stay open until the next reset
278
File specifier.
ABACUS
Warning:
See Also:
Open
lopen
Syntax:
Opens filel
File = Open(Name,Mode)
00
-30
01
02
struct FileHandle *File;
UBYTE *Name;
LONG Mode;
Description:
Parameters:
Name:
Mode:
Result:
File:
Exception:
Warning:
Do not confuse the DOS Open function with the C functions open ()
or fopen () . The three functions use three different file specifiers.
Comments:
See Also:
Close, IoErr
File specifier.
IRead
Syntax:
Number = Read(File,Buffer,Length)
00
-42
01
02
03
LONG Number;
struct FileHandle *File;
UBYTE *Buffer;
LONG Length;
Description:
279
6.
Parameters:
File:
Length:
File specifier.
Pointer to the data buffer.
Number of bytes to be read.
Result:
Number:
Exceptions:
Comments:
The value that IoErr returns is changed every time by Read. When
no error is encountered, IoErr indicates whether data can still be
inserted in the file.
See Also:
Open,Close,Write
Buffer.
ISeek
Syntax:
Seek(File,Position,Mode)
-66
Dl
D2
D3
LONG oldPosition;
struct FileHandle *File;
LONG Position, Mode;
Description:
This function sets the file pointer at posi tion. The file pointer can
be set based on three mode options:
OFFSET BEGINNING
Sets the file pointer to po sit ion bytes after the
beginning of the file. po sit i on must be a positive
value.
OFFSET END
Sets the file pointer to posi tion bytes before the end
of the file. position must be a negative value.
OFFSET CURRENT
Sets the file pointer to po sit ion bytes from the
current file position. posi tion can be a positive or
negative value.
Parameters:
File:
Position:
Mode:
File specifier.
The number of bytes the file pointer should be moved.
Movement mode.
Result:
oldPosition:
Exceptions:
If oldPosition
error message.
Comments:
280
6.2
ABACUS
THE
DOS
LIBRARY
pos = Seek(file,OL,OFFSET_CURRENT);
You can easily set the file pointer to the beginning or the end of the
file by calling Seek with position equal to zero and calling
Ot'FSET BEGINNING and OFFSET END as mode.
IWrite
Syntax:
Description:
Parameters:
File:
Buffer:
Length:
File specifier.
Pointer to the data buffer.
Number of bytes that should be written.
Result:
Number:
Exceptions:
See Also:
Structures:
MODE READWRITE
MODE OLDFILE
MODE NEWFILE
OFFSET BEGINNING
OFFSET CURRENT
OFFSET END
1004
1005
1006
-1
0
1
OxOO
Ox04
Ox08
OxOC
Ox10
Ox14
Ox18
Oxlc
Ox20
Ox24
Ox28
Ox2C
};
281
6.
6.2.2
File management
Creates new subdirectoryl
ICreateDir
Syntax:
Lock = CreateDir(Name)
DO
-120
D1
Description:
Parameter:
Name:
Result:
Lock:
Exceptions:
See Also:
IoErr,Lock,UnLock
CurrentDir
Syntax:
-126
D1
Description:
This function sets the current directory. All of the relative path names
(path names that have either a device name ["DFO:s/StartUp-Sequence
or a colon (It :c/dir") at the beginning) can be the current directory. The
CLI command cd directory specifies the current directory.
lt
Parameter:
Lock:
Result:
oldLock:
See Also:
Lock, UnLock
181
ABACUS
IDeleteFile
Syntax:
ok = DeleteFile(Name)
DO
-72
D1
BOOL OK;
UBYTE *Name;
Description:
Parameter:
Name:
Result:
OK:
See Also:
IoErr
Examine
Reads file/director
information
Syntax:
ok = Examine(Lock,infoBlock)
DO
-102
D1
D2
BOOL ok;
struct FileLock *Lock;
struct FilelnfoBlock *infoBlock;
Description:
Parameters:
Lock:
infoBlock:
Result:
OK:
Warning:
See Also:
ExNext
IExNext
Syntax:
ok = ExNext(Lock,infoBlock)
DO
-108
D1
D2
BOOL OK;
struct FileLock *Lock;
struct FilelnfoBlock *infoBlock;
283
Description:
Parameters:
Lock:
infoBlock:
Result:
OK:
Warning:
Warning:
Comments:
If you don't know exactly what you're searching for (e.g., filename
from an external source), the type array of the FilelnfoBlock
structure can be selected.
See Also:
Examine
hnfo
Syntax:
Description:
This function supplies information about the disk on which the file or
directory lies, represented by Lock. This information includes the size
of the diskette and the number of free and used blocks.
Parameters:
Lock:
Result:
OK:
284
ABACUS
Warning:
IParentDir
Syntax:
Description:
This function returns the lock of the next directory up in the directory
structure.
Parameter:
Lock:
Result:
newLock:
Comments:
See Also:
CurrentDir
IRename
Syntax:
DO
78
D1
D2
BOOL OK;
UBYTE *oldName,*newName;
Description:
Parameters:
oldName:
newName:
Result:
OK:
Comments:
You can move a file from one directory to another very easily by
renaming paths but retaining the original filename.
Warning:
ISetComment
Syntax:
DO
-180
D1
D2
BOOL OK;
UBYTE *Name,Comments;
285
Description:
Parameters:
Name:
Comments:
Result:
OK:
ISetProtection
Syntax:
OK = SetProtection(Name,Mask)
DO
-186
D1
D2
BOOL ok;
UBYTE *Narne;
LONG Mask;
Description:
This function sets the protection bits of a file or a directory. The bits
have the following meanings:
Bit 0:
Bit 1:
Bit 2:
Bit 3:
Bit 4:
access.
Only bits 0 and 4 are currently supported by AmigaOOS.
Parameters:
Name:
Mask:
Result:
OK:
Comments:
Bit 4 can be used to determine if a file has been changed since the last
(read) access, provided that the archive bit can be set after the read
access.
Structure:
Oxoo
Ox04
Ox08
OxOC
Ox10
Ox14
OBPTR
fl Link;
4 LONG
fl::)ey;
8 LONG
fl Access;
12 struct MsgPort *fl::::Task;
16 BPTR
fl_Volume;
20
/* Linked list */
/* Disk block no */
/* Access mode */
/* in device list */
};
Access modes
ACCESS READ
ACCESS WRITE
286
(fl~ccess):
-2
-1
/* Read access * /
/* Write access */
ABACUS
OxOO
Ox04
o LONG
4 LONG
fib DiskKey;
fib-DirEntryType; 1* If < 0 => file *1
1* If > 0 => directory *1
fib FileName[108];
fib-Protection;
fib-EntryType;
fib-Size; 1* Size in bytes *1
fib-NumBlocks; 1* no. blocks *1
DateStamp fib Date;
fib_Comment [16];
Ox08
8 char
Ox74 116 LONG
Ox78 120 LONG
Ox7C 124 LONG
Ox80 128 LONG
Ox84 132 struct
Ox90 144 char
Ox104 260
I;
Protection-Flags (fib Protection):
FIBF ARCHIVE
16
FIBF-READ
8
FIBF-WRlTE
4
2
FIBF-EXECUTE
FIBF-DELETE
1
struct InfoData ,libraries/dos.h>
{
OxOO
id NumSoftErrors; 1* Number of errors *1
o LONG
id-UnitNumber;
Ox04
4 LONG
id-DiskState;
Ox08
8 LONG
Oxoc
12 LONG
id::::NumBlocks;
Ox10
16 LONG
id NumBlocksUsed;
id-BytesPerBlock;
Ox14
20 LONG
id-DiskType;
Ox18
24 LONG
id-VOlumeNode;
Ox1c
28 BPTR
Ox20
id::::lnUse 1* 0 if not used *1
32 LONG
36
Ox24
I;
Disk-Status (id_DiskState):
ID_WRITE]ROTECTED 80
ID VALIDATING
81
ID VALIDATED
82
Disk-Type (id_DiskType) :
ID- NO- DISK- PRESENT
-1
ID- UNREADABLE- DISK
'BAD'
ID DOS DISK
' 005 '
ID-NOT-REALLY DOS
'NOOS'
ID- KICKS TART- DISK
'KICK'
6.2.3
IDupLock
Syntax:
287
Description:
Parameter:
Lock:
Result:
newLock:
See Also:
Lock, UnLock
!Input
Syntax:
file = Input ()
DO
-54
struct FileHandle *file;
Description:
Result:
File:
Comments:
The standard input appears in a CLI window. You can redirect this
using <Filename. If you want to get input from the standard input
device of your program, you must identify the file specifier from the
Input function. If you use the C standard functions (e.g., scan f),
the C compiler performs this task for you.
See Also:
Output
IoErr
Syntax:
Error = IoErr ()
DO
-132
LONG Error;
Description:
This function returns an error message based on the most recent DOS
error. Most of the DOS functions return zero when an error is
encountered; IoErr gives the user a text message.
Result:
Error:
Comments:
See Also:
288
ABACUS
IsInteractive
Syntax:
-216
Dl
BOOL Status;
struct FileHandle *File;
Description:
Parameter:
File:
File specifier.
Result:
Status:
ILock
Syntax:
-84
Dl
D2
Description:
This function identifies the lock of a file or directory. The DOS library
accesses many ftles through locks because of the Amiga's multitasking
operating system. If you want to work with a ftle or a directory, a lock
ensures that no other task will delete or change the file/directory during
your access.
There are two types of locks: locks for reading and locks for writing. A
ftle can have any number of read locks at one time. Only one write lock
can exist at a time, provided the ftle has no read lock attached.
Parameters:
Name:
AccessMode:
Result:
Lock:
Exceptions:
If the lock cannot be used (e.g., trying to place a write lock on a ftle on
which a read lock already exists), a zero is returned.
Comments:
289
Warning:
Release a lock when you're finished with the ftle. Locked ftles remain
locked until unlocked or until the next reset, and locked ftles cannot be
deleted or edited.
See Also:
UnLock. DupLock
IOutput
Syntax:
File = Output ()
DO
-60
struct FileHandle *File;
Description:
Result:
File:
Comments:
The standard output appears in a CLI window. You can redirect this
using >Filename. If you want to send output from the standard
output device of your program, you must identify the file specifier from
the output function. If you use the C standard functions (e.g .
print f), the C compiler performs this task for you.
See Also:
Input
IUnLock
Syntax:
-90
Description:
This function frees the lock on a ftle or a directory placed there by the
Lock or DupLock function.
Parameter:
Lock:
Warning:
Release a lock when you're finished with the ftle. Locked files remain
locked until unlocked or until the next reset, and locked files cannot be
deleted or edited.
See Also:
Lock, DupLock
Structure:
OxOO
0 BPTR
Ox04
fl Link;
LONG
fl-Key;
OxOS S LONG
fl:)ccess;
Oxoc 12 struct MsgPort *fl Task;
OxlO 16 BPTR
fl:':'Volume;
Ox14 20
};
290
/* Linked list */
/* Disk block no. */
/* Access mode */
/* in device list */
ABACUS
6.2.4
ICreateProc
Process management
Creates new processl
Syntax:
process = CreateProc(Name,Pri,Segment,StackSize)
DO
-138
D1
D2
D3
D4
struct Process *process;
UBYTE *Name;
LONG Pri;
BPTR *Segment;
LONG StackSize;
Description:
291
Segment
StackSize:
Result:
Process:
Exceptions:
See Also:
LoadSeg,UnLoadSeg
Parameters:
Name:
Pri:
LoadSeg.
IDateStamp
Syntax:
OateStamp (ptr)
-192
01
LONG *Ptr;
Description:
This function fills three long words with the current time.
Parameter:
Ptr:
See Also:
IDelay
Syntax:
Delay (Ticks)
-198
01
LONG Ticks;
Description:
Parameter:
Ticks:
292
ABACUS
Comments:
If you want a program to wait for a certain time span for any reason,
use the Delay function instead of a wait loop: The Delay function is
more reliable.
DeviceProc
Tests
Syntax:
Process = DeviceProc(Name)
DO
-174
D1
struct Process *Process;
UBYTE *Name;
Description:
This function tests the device driver that belongs to the specified device.
Parameter:
Name:
Result:
Process:
Exceptions:
If the function returns a zero, the device driver cannot be tested. IoErr
returns the exact error message.
Comments:
Ends program I
Syntax:
Exit (errorCode)
-144
D1
LONG errorCode;
Description:
This function ends the currently running program, and returns the error
code if the program was started from the CLI.
Parameter:
emxCode:
Warning:
Errortype (0 = no error).
IWaitForChar
Syntax:
293
6.
Description:
Parameters:
File:
Time:
Result:
OK:
See Also:
IsInteractive
Structure:
Oxoo 0
Ox04 4
Ox08 8
OxOC 12
LONG
LONG
LONG
ds Days;
/* days since 1.1.78 */
ds-Minute; /* Minutes since midnight */
ds=Tick;
/* number of ticks */
};
OxOO
Ox5c
Ox7E
Ox80
Ox84
OxB8
Ox8C
Ox90
Ox94
Ox98
Ox9C
OxAO
OxA4
OxA8
OxAC
OxBO
OxB4
OxB8
OxBC
0
92
126
128
132
136
140
144
148
152
156
160
164
168
172
176
180
184
188
};
struct
struct
WORD
BPTR
LONG
APTR
LONG
BPTR
LONG
BPTR
BPTR
BPTR
APTR
APTR
BPTR
APTR
APTR
APTR
Task
pr_Task;
MsgPort pr_MsgPort; /* CreateProc and
/* DeviceProc supply a
/* BCPL pointer to this
/* Message Port.
pr Pad;
pr::::SegList;
pr StackSize;
pr-GlobVec;
pr-TaskNum; /* =0, if not from the CLI*/
pr=StackBase;
pr Result2;
pr::::CurrentDir;
pr_CIS;
/* input channel */
pr_COS;
/* output channel */
pr ConsoleTask;
pr::::FilesystemTask;
pr_CLI;
pr_ReturnAddr;
pr PktWait;
pr=WindowPtr;
*/
*/
*/
*/
/)
LONG
BPTR
4 Code
Segment length + 8;
Next segment (0 if none);
294
ABACUS
6.2.5
Loading programs
\Execute
Syntax:
-222
Dl
D2
D3
BOOL OK;
UBYTE *Command;
struct FileHandle *Input,*Output;
Description:
Parameters.
Command:
Input:
Output:
Result:
OK:
\LoadSeg
Loads a program
Syntax:
Segment = LoadSeg(name)
DO
-150
Dl
BPTR Segment;
UBYTE *Name;
Description:
This function loads the specified program into memory. The program
can be started using CreateProc.
Parameter:
Name:
Result:
Segment:
Exceptions:
See Also:
UnLoadSeg,CreateProc
295
Removes programl
IUDLoadSeg
Syntax:
OK = UnLoadSeg(Segment)
DO
-156
01
BOOL OK;
BPTR Segrrent;
Description:
Parameter:
Segment:
Result:
OK:
Comments:
If you started the program with CreateProc, you won't have to free
the segment because C re ate Pro c automatically removes the
segment when the program ends.
See Also:
LoadSeg
StructureS:
LONG
BPTR
4 Code
You always get a pointer to the element with the index of 0 from
LoadSeg. The actual code begins 4 bytes later.
6.2.6
IGetPacket
Syntax:
OK = GetPacket(WaitForIt)
DO
-162
01
BOOL OK;
BOOL WaitForIt;
Description:
Parameter:
WaitForIt:
Result:
OK:
296
ABACUS
IQueuePacket
Syntax:
Error = QueuePacket(Packet)
DO
-168
D1
LONG Error;
struct DosPacket *Packet;
Description:
Parameter:
Packet:
Result:
Structures:
OxOO
Ox04
OxOS
OxOC
Ox10
Ox14
Ox1S
Ox1C
Ox20
Ox24
Ox2S
Ox2C
Ox30
0
4
8
12
16
20
24
28
32
36
40
44
48
};
OxOO 0
Ox14 20
Ox44 68
struct Message
sp_Msg;
struct DosPacket sp~kt;
);
Packet-type (dp_Type) :
ACTION NIL
ACTION GET BLOCK
ACTION SET MAP
ACTION DIE
ACTION EVENT
ACTION- CURRENT- VOLUME
ACTION- LOCATE- OBJECT
ACTION RENAME DISK
ACTION WRITE
ACTION READ
ACTION FREE LOCK
ACTION DELETE OBJECT
ACTION- RENAME- OBJECT
ACTION COPY DIR
ACTION WAIT CHAR
ACTION SET PROTECT
ACTION CREATE DIR
ACTION- EXAMINE- OBJECT
ACTION EXAMINE NEXT
ACTION DISK INFO
~CTION INFO
0
2
4
5
6
7
8
9
'WI
'R'
15
16
17
19
20
21
22
23
24
25
26
297
6.
ACTION
ACTION
ACTION
ACTION
ACTION
ACTION
SET COMMENT
PARENT
TIMER
INHIBIT
DISK TYPE
DISK CHANGE
28
29
30
31
32
33
6.2.7
DosBase
Structures:
OxOO
Ox22
Ox26
Ox2A
Ox2E
Ox32
Ox36
0
34
38
42
46
50
54
struct
APTR
APTR
LONG
LONG
LONG
Library dl lib;
dl Root; dl-GV;
dl=A2;
dl AS;
dl=A6;
);
OxOO
Ox04
OxOS
Ox14
Ox18
Ox1C
Ox20
*1
*1
*1
*1
};
OxOO 0
Ox04 4
Ox08 8
OxOC 12
Ox10 16
Ox14 20
BPTR di McName;
BPTR di-Devlnfo; 1* pointer to list of all devices *1
BPTR di -Devices;
BPTR di-Handlers;
APTR di=NetHand;
);
OxOO
Ox04
Ox08
OxOC
Ox10
Ox1C
Ox20
Ox24
Ox28
Ox2C
0 BPTR
dl Next;
1* BPTR to next device
4 LONG
dl=Type;
8 struct MsgPort *dl Task;
dl-Lock;
12 BPTR
1* Not for disks
16 struct DateStamp dl=VolumeDate;
28 BPTR
dl_LockList; 1* List of all locks
32 LONG
dl_DiskType; 1* e.g . "DOS"
36 LONG
dl_unused;
40 BSTR
*dl_Name;
1* BPTR to BCPL string
44
);
298
*1
*1
*1
*1
*1
6.3
ABACUS
6.3
IIlruet OosLibrary:
Blruet
d,-Ub
APTA
d,-Rool
APTA
cI_GV
LaG
dl_A2
Library
BPTR
rn_ TaskArray
r-
IIIrucl OevlceLlIII:
lllruct DOIIlnfo:
r-
8PTR
cI_McName
8PTR
d'-Devlnfo
BFTA
m_ConaoleSegmenl
8PTR
dl_Devlc811
slruet DaleStamp
rn_Tlme
r'I"'"
BFTA
dl_Nexl
LaG
dl_Type
IItruet MsgPort
dl_Task
BPTR
dLHandlera
LaG
BPTR
rn_AeslartSeg
BFTA
dl_Lock
cI_NetHand
LaG
dl_AS
BFTA
rn_lnfo
LaG
dl_AS
BFTA
m_FUeHandlerSeg.
slruet DaleStamp
dLVoIumeDale
BFTA
d'-LockLlst
LaG
d,-OlskType
LaG
d,-unused
BSTA
dl_Name
.,
The Intuition library operates in conjunction with the Graphics and the
Layers libraries. Intuition uses the Layers library to represent the
gadgets and window overlapping. It also uses the Graphics library for
graphic output and formatting, fonts, the bit-map, ViewPort
management and everything else that has a task.
299
Window functions
ActivateWindow
CloseWindow
ModifyIDCMP
MoveWindow
OpenWindow
RefreshWindowFrame
SetWindowTitles
SizeWindow
WindowLimits
WindowToBock
WindowToFront
6.3.2
309
310
313
314
314
315
315
316
316
317
317
318
318
319
319
319
300
306
307
307
308
308
309
Menu functions
ClearMenuStrip
ltemAddress
OffMenu
OnMenu
SetMenuStrip
6.3.4
303
303
304
Gadget functions
ActivateGadget
AdlGOOget
AddGList
ModifyProp
NewModifyProp
OftGadget
OnGadget
RefreshGadgets
RefreshGList
RemoveGadget
RemoveGList
6.3.3
302
302
321
322
322
323
323
324
324
6.3
ABACUS
Request
SetDMRequesl
6.3.5
335
336
Refresh functions
BeginRefresh
EndRefresh
RemakeDisplay
RethinkDisplay
6.3.9
332
332
333
333
334
334
Memory functions
AllocRemember
FreeRemember
6.3.8
326
326
327
327
327
328
328
330
330
330
331
331
331
Graphic functions
ClearPointer
DtawBonler
DrawImage
IntuiTextLength
PrintIText
SetPointer
6.3.7
325
325
Screen functions
OoseScreen
CloseWorkBench
DisplayBeep
GetScreenData
MakeScreen
MoveScreen
OpenScreen
OpenWorkBench
ScreenToBack
ScreenToFront
ShowTitle
WBenchToBack
WBenchToFront
6.3.6
336
336
337
337
Other functions
CurrentTime
DoubleClick
GetDefPrefs
GetPrefs
LockIBase
ReportMouse
337
338
338
338
342
343
301
6.3.1.
SetPrefs
UnlockIBase
343
343
ViewAddress
ViewPortAddress
344
344
Window fu nctions
Activates Intuition window
ActivateWindow
Syntax:
ActivateWindow(Window);
-450
AO
struct Window *Window;
Description:
Parameter:
Window:
Warning:
See Also:
\closeWindow
Syntax:
CloseWindow(Window);
-72
AO
struct Window *Window;
Description:
302
6.3
ABACUS
THE
INTUITION
LIBRARY
You should also know that a previously added menu strip must be
removed before you may close a window. This Intuition function
blocks all other functions until it has ended the task.
Parameter:
Window:
See also:
OpenWindow () , CloseScreen ( )
IMOdiryIDCMP
Syntax:
ModifyIDCMP(Window, IDCMPFlags);
-150
AD
DO
Description:
Parameters:
Window:
Pointer to an Intuition window structure.
IDMCPFlags: Flag bits describing the status of the IDCMP.
See Also:
Openwindow () , Closewindow ( )
MoveWindow
Syntax:
AD
DO
D1
Description:
Parameters:
Window:
DeltaX:
DeltaY:
Warning:
This functions does not check the movement values for accuracy. Make
sure that your coding doesn't try moving the window to a nonexistent
location, or a system error may result.
See Also:
Sizewindow ()
303
IOpenWindow
Syntax:
Window = OpenWindow(NewWindow);
DO
-204
AO
struct NewWindow NewWindow;
Description:
Parameter:
Result:
Window:
See Also:
CloseWindow(),MOdifyIDCMP(),OpenScreen(),
CloseScreen(),WindowTitles()
Structures:
struct NewWindow <intuition/intuition.h>
{
Oxoo
00
Ox02
Ox04
Ox06
Ox08
Ox09
02
04
06
08
09
OxOA
OxOE
Ox12
10
14
18
Ox16
22
Ox1A
Ox1E
Ox22
26
30
34
Ox26
Ox28
Ox2A
Ox2C
Ox2E
Ox30
38
40
42
44
46
48
};
304
ABACUS
struc~
Window <intuition/intuition.h>
OxOO
00
Ox04
04
Ox06
Ox08
06
08
OxOA 10
Oxoc 12
OxOE
Ox10
Ox12
Ox14
Ox16
Ox18
Ox1C
16
18
20
22
24
28
Ox20
32
Ox24
36
Ox28
40
Ox2C
44
Ox2E
Ox32
46
50
Ox36
Ox37
Ox38
Ox39
Ox3A
54
55
56
57
58
Ox3E
62
Ox42
66
Ox46
70
Ox4A
74
Ox4E
Ox4F
Ox50
Ox51
Ox52
Ox56
Ox5A
78
79
80
81
82
86
90
Ox5E
94
14
Ox62 98
Ox63 99
Ox64 100
Ox68 104
305
Ox6C 108
SHORT GZZMouseX;
Ox6E
Ox70
Ox72
Ox74
SHORT
SHORT
SHORT
UBYTE
llO
ll2
ll4
ll6
Ox78 120
Ox7C 124
Ox80 128
GZZMouseY;
GZZWidth;
GZZHeight;
*ExtData;
text */
/* Mouse position in the GZZ
Window */
Ox84 132
);
Window_Flags:
WINDOWSIZING
WINDOWDRAG
WINDOWDEPTH
WINDOWCLOSE
SIZEBRIGHT
SIZEBBOTTOM
REFRESHBITS
SMART REFRESH
SIMPLE REFRESH
SUPER BITMAP
OTHER REFRESH
BACKDROP
REPORTMOUSE
GIMMEZEROZERO
BORDERLESS
ACTIVATE
WINDOWACTIVE
INREQUEST
MENUSTATE
RMBTRAP
NOCAREREFRESH
WINDOWREFRESH
WBENCHWINDOW
WINDOWTICKED
SUPER UNUSED
IRefreshWindowFrame
Redraws windowl
Syntax:
RefreshWindowFrame(Window);
-456
AO
struct Window *Window;
Description:
This function redraws the border, tide and gadgets of a window, keeping
graphic distortion to a minimum.
Pammeter:
Window:
See Also:
RefreshGadgets(),RefreshGList()
306
ABACUS
SetWindowTities
Syntax:
Description:
Parameters:
Window:
Pointer to an Intuition window structure.
WindowTitle: Pointer to a string that ends with zero that represents
the text. This string can also contain a value of -1 for
original text or a value of 0 for no text
ScreenTitle:
Pointer to a string representing the text, that ends with
zero. This string can also contain a value of -1 for the
original text or a value of 0 for no text
See Also:
OpenWindow(),RefreshWindowFrame(),OpenScreen()
ISizeWindow
Syntax:
Description:
This function changes an Intuition window's size in the Del taX and
Del taY directions. The new size does not execute immediately. When
Intuition receives an input event (which it does at a rate of 10 times per
second), the function executes.
Parameters:
Window:
DeltaX:
DeltaY:
Warning:
This function does not check the sizing values for accuracy. Make sure
that your coding doesn't try resizing thl'! window in a nonexistent
location, or a system error may result.
See Also:
MoveWindow(),OpenWindow()*
307
WindowLimits
Syntax:
-318
AO
00
Dl
02
MaxHeight);
03
BOOL Settings;
struct Window *Window;
USHORT MinWidth, MinHeight;
USHORT MaxWidth, MaxHeight;
Description:
If you don't want to change these values, set them to zero. The function
then ignores further entries and maintains the original settings.
Entering -1 changes the window to maximum (screen) size.
Parameters:
Window:
MinWidth:
MinHeight:
MaxWidth:
MaxHeight:
Result:
Comments:
When the function is called during resizing of the window, the new
values take effect after this operation.
See Also:
GetScreenData ()
IWindowToBack
Syntax:
WindowToBack (Window);
-306
AO
struct Window *Window;
Description:
This function moves the specified window behind all others on the
screen.
The function does not execute immediately. When Intuition receives an
input event (input events occur 10 times per second), the function
executes.
Parameler:
308
Window:
6.3
ABACUS
Comments:
See Also:
WindowToFront(),MoveWindow(),Sizewindow()
IWindowToFront
Syntax:
WindowToFront(Window);
-312
AO
struct Window *Window;
Description:
This function moves the specified window in front of all others on the
screen.
The function does not execute immediately. When Intuition receives an
input event (input events occur 10 times per second), the function
executes.
Pointer to an Intuition window structure.
Parameter:
Window:
Comments:
See Also:
6.3.2
Gadget functions
IActivateGadget
Syntax:
Description:
Parameters:
Gadget
Window:
Requester:
Result:
309
Comments:
IAddGadget
Syntax:
Description:
This function adds the specified gadget to the active window's list of
gadgets.
If you use system gadgets, these are placed at the beginning of the
gadget list so that they are always checked first
Intuition does not support user-inserted screen gadgets. Instead you can
open a BACKDROP window, which looks similar to a screen, and add
gadgets to the BACKDROP window.
Parameters:
Window:
GOOget
Position:
Result:
See Also:
AddGList(),RemoveGadget(),RemoveGList()
Structures:
310
OxOO
00
Ox04
04
Ox06
OxOS
06
OS
OxOA
OxOC
OxOE
10
12
14
ABACUS
Ox10
Ox12
Ox16
Ox1A
Ox1E
Ox22
Ox26
Ox28
Ox2C
};
GADGHIGHBITS Ox0003L/*
GADGHCOMP OxOOOOL
/*
GADGHBOX Ox0001L
/*
GADGHIMAGE Ox0002L /*
GADGHNONE Ox0003L
/*
GADGIMAGE Ox0004L
/*
GRELBOTTOM Ox0008L /*
GRELRIGHT Ox0010L
/*
GRELWIDTH Ox0020L
/*
GRELHEIGHT Ox0040L /*
SELECTED Ox0080L
/*
GADGDISABLED Ox0100L/*
Gadget_Activation:
RELVERIFY Ox0001L
/* Verifies selection */
GADGIMMEDIATE Ox0002L /* Selection executes on 1 click */
ENDGADGET Ox0004L
/* Requester gadget that goes to the end */
FOLLOWMOUSE Ox0008L
/* Follows mouse coordinates */
RIGHTBORDER Ox0010L
/* Gadget placed in right window border */
LEFTBORDER Ox0020L
/* Gadget placed in left window border */
TOPBORDER Ox0040L
/* Gadget placed in top window border */
BOTTOMBORDER Ox0080L /* Gadget placed in bottom window border */
TOGGLESELECT Ox0100L /* Toggles gadget on/off */
STRINGCENTER Ox0200L /* Shoe text in middle of string gadget */
STRINGRIGHT Ox0400L
/* Displays text in right margin */
LONGINT Ox0800L
/* Long word integer gadget */
ALTKEYMAP Ox1000L
/* Gadget uses alternate keymap */
Gadget_GadgetType:
BOOLEXTEND Ox2000L
GADGET TYPE OxFCOOL
SYSGADGET Ox8000L
SCRGADGET Ox4000L
GZZGADGET Ox2000L
REQGADGET Ox1000L
SIZING OxOOlOL
WDRAGGING Ox0020L
SDRAGGING Ox0030L
WUPFRONT Ox0040L
/*
/*
/*
/*
/*
/*
/*
/*
/*
Gadget types */
System gadget */
Screen gadget */
GimmeZeroZero gadget */
Requester gadget */
Sizing gadget */
Window Drag gadget */
Screen Drag gadget */
Window Up Front gadget */
311
6.
SUPFRONT Ox0050L
/* Screen Up Front gadget */
WDOWNBACK Ox0060L
/* Window Down Back gadget */
SDOWNBACK Ox0070L
/* Screen Down Back gadget */
CLOSE Ox0080L
/* Close gadget */
BOOLGADGET Ox0001L
/* Boolean gadget (in/out) */
GADGET0002 Ox0002L
/* Type 0002 gadget */
PROPGADGET Ox0003L
/* Proportional gadget */
STRGADGET Ox0004L
/* String gadget */
struct Boollnfo <intuition/intuition.h>
{
OxOO
00
Ox02
Ox04
Ox08
02
04
08
};
Boollnfo_Flaqs:
BOOLMASK Ox0001L /* User-defined Boolean mask */
struct Proplnfo
{
OxOO
Ox02
Ox04
Ox06
Ox08
OxOA
OxOC
Ox DE
Ox10
Ox12
00
02
04
06
08
10
12
14
16
18
Ox14
Ox16
20
22
USHORT
USHORT
USHORT
USHORT
USHORT
USHORT
USHORT
USHORT
USHORT
USHORT
Flags;
/* Proportional gadget flags*/
HorizPot; /* Horizontal position of slider */
VertPot;
/* Vertical position */
HorizBody; /* Horizontal size of slider */
VertBody; /* Vertical size */
CWidth;
/* Container width*/
CHeight;
/* Container height */
HPotRes; /* Horizontal resolution of slider */
VPotRes;
/* Vertical resolution */
LeftBorder;/* Left border of proportional
gadget */
USHORT TopBorder; /* Top border */
};
Proplnfo_Flaqs:
AUTOKNOB Ox0001L /* Default slider knob */
FREEHORIZ Ox0002L /* Slider can be moved horizontally */
FREEVERT Ox0004L /* Slider can be moved vertically */
PROPBORDERLESS OxOOOBL /* No box around slider */
KNOBHIT Ox0100L
/* Set when slider is active */
Proplnfo_Values:
KNOBHMIN 6L
/* Minimum horizontal knob resolution */
KNOBVMIN 4L
/* Minimum vertical resolution */
MAXBODY OxFFFFL / * Maximum * /
MAXPOT OxFFFFL
struct Stringlnfo <intuition/intuition.h>
{
312
OxOO
Ox04
Ox08
OxOA
00
04
08
10
UBYTE
UBYTE
SHORT
SHORT
OxOC
OxOE
12
14
SHORT DispPos;
SHORT UndoPos;
*Buffer;
*UndoBuffer;
BufferPos;
MaxChars;
/*
/*
/*
/*
ABACUS
Ox10
Ox12
Ox14
Ox16
Ox18
OxIC
16
18
20
22
24
28
Ox20
32
Ox24
36
SHORT NUmChars;
/* Number of characters entered */
SHORT DispCount; /* Number of characters in display */
SHORT Cleft;
/* Left border of container */
SHORT CTop;
/* Top border */
struct Layer *Layerptr; /* Pointer to gadget layer */
LONG Longlnt; /* Number re-converted for integer
gadget */
struct KeyMap *AltKeyMap; /* Pointer to an alternate
keymap */
};
IAddGList
Syntax:
Description:
Parameters:
Window:
Gadget
Position:
Numgad:
Requester:
Result:
Returns the position at which the gadget was actually inserted. This
number is in effect until no other gadgets are inserted.
Warning:
If you don't use all of the gadgets of a linked list for the window or the
requester, make sure that Intuition changes the pointer of the last gadget
inserted.
See Also:
AddGadget(),RemoveGadget(),RemoveGList()
313
IModifyProp
Syntax:
AO
Al
A2
00
struct
struct
struct
USHORT
USHORT
USHORT
02
03
04
Gadget *Gadget;
Window *Window;
Requester *Requester;
Flags;
HorizPot, VertPot;
HorizBody, VertBody;
Description:
Parameters:
Gadget:
Window:
Requester:
Flags:
HorizPot:
VertPot:
HorizBody:
VertBody:
See Also:
INewMOdifyProp
Syntax:
AO
Al
A2
00
01
03
04
05
Description:
314
The command has the same function as the Modi fyP rop ( )
command. How many gadgets should be re-drawn can also be set
through Numgad.
ABACUS
Description:
Parameters:
Gadget
Window:
Requester:
Flags:
HomPot:
VertPot:
HorizBody:
VertBody:
Numgad:
See Also:
ModifyProp ()
IOrrGadget
Syntax:
Disables gadget!
OffGadget (Gadget, Window, Requester);
-114
AO
A1
A2
Description:
Parameters:
Gadget
Window:
Requester:
See Also:
OnGadget ()
Enables gadget!
IOn Gadget
Syntax:
AO
A1
A2
315
6.
Description:
Parameters:
GOOget
Window:
Requester:
See Also:
Off Gadget ()
IRerreshGadgets
Syntax:
Redraws gadgetsl
RefreshGadgets (Gadgets, Window, Requester);
-222
AO
Al
A2
Description:
Parameters:
Gadget.:
Window:
Requester:
See Also:
RefreshGList(),RemoveGadget(),RemoveGList(),
AddGadget(),AddGList()
IRerreshGList
Syntax:
AD
Al
A2
DO
Description:
316
ABACUS
Parameters:
o.Iget
Window:
Requester:
Numgad:
See Also:
IRemoveGadget
Syntax:
-228
AO
Al
USHORT Position;
struct Window kWindow;
struct Gadget *Gadget;
Description:
This function removes the specified gadget from the window list
Gadgets that are present in a window's requester.
Parameters:
Window:
Gadget
requester.
Result:
See Also:
IRemoveGList
Syntax:
-444
AD
Al
DO
USHORT Position;
struct Window *Window;
struct Gadget *Gadget;
SHORT Numgad
Description:
317
Parameters:
Window:
Gadget
Numgad:
Result:
See Also:
6.3.3
Menu functions
ClearMenuStri
Syntax:
from window
C1earMenuStrip(Window);
-54
AD
Description:
This function removes the menu strip from the window. If menus are
currently being accessed,the ClearMenuStrip function executes
after the menu access ends.
Parameter:
Window:
Comments:
See Also:
SetMenuStrip ()
IItem Address
Syntax:
-144
AD
DO
Description:
Parameters:
MenuS trip:
Pointer to menu strip.
MenuNumber: Number of the (sub)menu item.
318
ABACUS
Result:
ItemAddress:
IOffMenu
Syntax:
Description:
Parameters:
Window:
Pointer to window containing the menu strip.
MenuNumber: Menu/item that should be displayed in ghost print.
See Also:
OnMenu ()
IOnMenu
Syntax:
OnMenu(Window, MenuNumber);
-192
AD
DO
struct Window *Window;
USHORT MenuNumber;
Description:
Parameters:
Window:
Pointer to window containing the menu strip.
MenuNumber: Menu/item that should be enabled.
See Also:
OffMenu ()
SetMenuStri
from window
Syntax:
Description:
Parameters:
Window:
Menu:
Result:
Success:
319
Warning:
When using a menu, make sure that a menu strip is removed from the
window before closing the window, or an error may occur.
See Also:
ClearMenuStrip()
Structures:
OxOO
00
Ox04
04
Ox06
Ox08
OxOA
OxOC
OxOE
OxOF
06
08
10
12
14
18
Ox16
Ox18
Ox10
Ox12
Ox14B
22
24
26
28
30
);
OxOO
00
Ox04
04
Ox06
Ox08
OxOA
Oxoc
OxOE
06
08
10
12
14
Ox12
Ox16
OxlA
18
22
26
OxlB
27
OxlF
31
Ox21
33
);
Menultem_Flags:
CHECKIT OxOOOlL
/*
ITEMTEXT Ox0002L
/*
COMMSEQ Ox0004L
/*
MENU TOGGLE Ox0008L /*
ITEMENABLED OxOOl0L/*
320
*/
(no graphics) */
kbd shortcut */
*/
*/
ABACUS
HIGHFLAGS OxOOCOL
HIGH IMAGE OxOOOOL
HIGHCOMP Ox0040L
HIGHBOX Ox0080L
/*
/*
/*
/*
HIGHNONE OxOOCOL
/*
CHECKED OxOlOOL
/*
ISDRAWN OxlOOOL
/*
HIGHITEM Ox2000L
/*
MENUTOGGLED Ox4000L/*
6.3.4
IAutoRequest
Syntax:
Description:
This function creates a requester from the available data and processes
the result selected by the user.
Parameters:
Window:
Result:
Response:
Warning:
321
Comments:
See Also:
BuildSysRequest (),Request ()
IB uildSysRequest
Syntax:
00
hl
DO
02
D3
Description:
Parameters:
Window:
Result:
ReqWindow:
Warning:
Comments:
See Also:
ClearDMRe uest
Syntax:
Removes double
Response
DO
ClearDMRequest(Window);
-48
BOOL Response;
struct Window *Window;
322
AO
ABACUS
Description:
Parameter:
Window:
Result:
Response:
See Also:
IDisplayAlert
Syntax:
Description:
Parameters:
Result:
Response:
Warning:
DEADEND_ALERT.
system reset.
uest
Removes re
Syntax:
EndRequest(Requester, Window);
-120
AD
Al
struct Requester *Requester;
struct Window *Window;
Description:
This function removes the specified requester from the window, and sets
the window's status to normal if this was the last requester in a group.
Parameters:
Requester:
Window:
323
IFreeSYSRequest
Syntax:
FreeSysRequest(Window);
-372
AO
struct Window *Window;.
Description:
Parameter:
Window:
See Also:
BuildSysRequest(),AutoRequest()
uester
eneral values
Syntax:
InitRequester(Requester);
-138
AO
struct Requester *Requester;
Description:
Parameter:
Requester:
See AlSO:
Request (),EndRequest ()
StructureS:
324
OxOO
00
Ox04
04
Ox06
Ox08
OxOA
OxOC
06
08
10
12
OxOE
Ox10
14
16
Ox14
20
Ox18
24
Ox1C
Ox1E
Ox20
28
30
32
Ox24
Ox44
36
68
Ox48
72
/* Internal pointer
to previous
requester */
SHORT LeftEdge; /* Upper left pixel position of
requester in window */
SHORT TopEdge;
SHORT Width;
/* Requester width in pixels */
SHORT Height;
/* Requester height in pixels */
SHORT RelLeft; /* Relative coordinates with a
relative position statement to
mouse pointer */
SHORT RelTop;
struct Gadget *ReqGadget; /* Pointer to first
requester gadget */
struct Border *ReqBorder; /* Pointer to first
requester border */
struct IntuiText *ReqText;/* Pointer to first
requester text */
USHORT Flags;
/* Flag settings for this requester */
UBYTE Backfill;
/* Requester background color */
struct Layer *ReqLayer;
/* Pointer to layer
structure managed by the
requester * /
UBYTE ReqPad1 [32];
/* More memory bytes * /
struct Bitmap *ImageBMapi /* Pointer to requester
bit-map */
struct Window *RWindow;
/* Pointer to window in
ABACUS
Ox4c
Ox70
76 UBYTE ReqPad2[36];
112
};
Requester_Flags:
POINTREL OxOOOIL
PREDRAWN Ox0002L
NOISYREQ Ox0004L
REQOFFWINDOW OxIOOOL
REQACTlVE Ox2000L
SYSREQUEST Ox4000L
DEFERREFRESH Ox8000L
IRequest
Activates requesterl
Syntax:
Description:
Parameters:
Requester:
Window:
Pointer to requester.
Pointer to window whose input channel is interrupted.
Result:
Success:
Comments:
See Also:
EndRequest ()
ISetDMRequest
Syntax:
Description:
Parameters:
Window:
325
6.
Result:
Success:
See Also:
ClearDMRequest(),Request(),EndRequest()
6.3.5
Screen functions
ICloseScreen
Syntax:
AO
Description:
This function closes the specified screen and frees bit-map memory and
any parameters used by openScreen ( ) .
Parameter:
Screen:
Warning:
Comment:
If the screen closed was the last screen, Intuition tries to open the
Workbench screen.
See Also:
OpenScreen ()
ICloseWorkbench
Closes Workbenchl
Syntax:
Success = CloseWorkBench();
DO
-78
BOOL Success;
Description:
Result:
Success:
Exceptions:
Warning:
Be aware of the fact that the control is taken from a program because by
closing this screen you have pulled the "floor from under your feet".
326
6.3
ABACUS
See Also:
OpenWorkbench(),CloseScreen()
IDisplayBeep
Blinks screenl
Syntax:
DisplayBeep(Screen);
-96
AO
struct Screen *Screen;
Description:
Parameter:
Screen:
Exceptions:
GetScreenData
Syntax:
Description:
This function gets screen structure data and places the data in a buffer.
Parameters:
BufftT.
Size:
Type:
Screen:
Result:
Exceptions:
MakeScreen
Pointer to buffer.
Data buffer size.
Type of screen (WBENCHSCREEN, CUSTOMSCREEN).
Pointer to screen structure.
Syntax:
MakeScreen(Screen);
-378
AO
struct Screen *Screen;
Description:
Parameter:
Screen:
See Also:
RethinkDisplay(),RemakeDisplay()
327
!MoveScreen
Syntax:
Description:
This function moves the screen by the specified delta values. The
distance is relative to the current location rather than by absolute
coordinates.
Parameters:
Screen:
Pointer to screen.
Horizontal movement value.
Vertical movement value.
DeltaX:
DeltaY:
Exceptions:
In the current version of the operating system the screen can only be
moved in the vertical direction. For compatibility reasons the De 1 t aX
value should always be set to zero.
! Open Screen
Syntax:
Screen = OpenScreen(NewScreen);
DO
-198
AO
struct Screen *Screen;
struct NewScreen *NewScreen;
Description:
Parameter:
NewScreen:
Result:
Screen:
See Also:
CloseScreen(),MakeScreen()
struct NewScreen <intuition/intuition.h>
{
328
OxOO
00
SHORT LeftEdge;
Ox02
02
SHORT TopEdge;
Ox04
Ox06
Ox08
04
06
08
SHORT Width;
SHORT Height;
SHORT Depth;
OxOA
OxOB
OxOC
OxOE
Ox10
Ox14
10
Ox18
24
11
12
14
16
20
ABACUS
OxIC
28
Ox20
32
(not used) */
struct Bitmap *CUstomBitmap; /* Pointer to added
screen bit-map */
};
OxOOO
00
329
SCREENTYFE OxOOOFL
WBENCHSCREEN Ox0001L
CUSTOMSCREEN OxOOOFL
SHOWTITLE Ox0010L
BEEPING Ox0020L
CUSTOMBITMAP Ox0040L
SCREENBEHINO OxOOBOL
SCREENQUIET Ox0100L
STDSCREENHEIGHT -1L
/*
/*
/*
/*
/*
IOpenWorkBench
Opens Workbenchl
Syntax:
WBScreen = OpenWorkBench();
DO
-210
struct Screen *WBScreen;
Description:
This function opens the Workbench screen and displays all Workbench
icons and windows.
Result:
WBScreen:
Exception:
Warning:
Avoid using the pointer, because the Workbench screen can be affected
or even closed by external programs.
See Also:
IScreenToBack
Syntax:
ScreenToBack (Screen) ;
-246
AD
struct Screen *Screen;
Description:
This function places the screen of the given screen structure in the
background.
Parnmeter:
Screen:
See Also:
ScreenToFront(),WBenchToBack(),WBenchToFront()
ScreenToFront
Syntax:
ScreenToFront(Screen);
-252
AD
struct Screen *Screen;
Description:
This function places the screen of the given screen structure in the
foreground.
330
6.3
ABACUS
Parameter:
Screen:
See Also:
ScreenToBack(),WBenchToBack(),WBenchToFront()
IShowTitie
Syntax:
ShowTitle(Screen, Showlt)
-282
AO
DO
struct Screen *Screen;
BOOL Showlt;
Description:
This function sets the display mode of the screen title bar. The screen
title bar covered by a BACKDROP window can be placed in front of or
behind the window.
Parameters:
Screen:
Showlt:
IWBenchToBack
Syntax:
Description:
Comments:
See Also:
IWBenchToFront
Syntax:
WBenchToFront();
-342
Description:
Comments:
See Also:
WBenchToBack(),ScreenToBack(),ScreenToFront()
331
6.
6.3.6
Graphic functions
IClearPointer
Syntax:
ClearPointer (Window) ;
-60
AO
struct Window *Window;
Description:
This function clears the custom mouse pointer from the window. After
the call the mouse cursor appears as set under Preferences.
Parameter:
Window:
See Also:
SetPointer ()
DrawBorder
Syntax:
Description:
This function draws the given lines in the RastPort at the position
specified by the offsets. If the NextBorder array of the structure
contains more data, these lines are also drawn.
Parameters:
RastPort:
Boob:
LeftOffset
TopOffset
See Also:
Drawlmage(),PrintIText()
Structure:
OxOO
00
SHORT LeftEdge
Ox02
Ox04
OxOS
Ox06
Ox07
Ox08
OxOC
02
04
05
06
07
08
12
SHORT TopEdge;
UBYTE FrontPen /* Line drawing color */
UBYTE BackPen; /* Not used */
UBYTE DrawMode; /* Draw mode=JAMl */
BYTE Count;
/* Number of coordinate pairs */
SHORT *XY;
/* Coordinate table pointer to */
struct Border *NextBorder; /* Link to other
border structures */
Ox10
16
);
332
ABACUS
IDrawlmage
Syntax:
Description:
This function draws the given image in the RastPort at the position
specified by the offsets. If the Next Image array contains more data,
these images are also drawn.
Parameters:
RastPort:
Image:
LeftOffset:
TopOffset
See Also:
DrawBorder(),PrintIText()
Structure:
OxOO
00
SHORT LeftEdge;
Ox02
Ox04
Ox06
Ox08
OxOA
OxOE
02
04
06
08
10
14
OxOF
15
Ox10
16
SHORT TopEdge;
SHORT Width; 1* Graphic width and height in pixels *1
SHORT Height;
SHORT Depth;
1* depth of graphic bit-planes *1
USHORT *ImageData; 1* Pointer to image data *1
UBYTE PlanePick
1* Marking bit-planes
for picking *1
UBYTE PlaneOnOff; 1* Marking bit-planes for
turning off *1
struct Image *Nextlmage; 1* Link to more image
structures *1
Ox14
20
};
hn tuiTextLength
or
an IntuiText!
Syntax:
Width = IntuiTextLength(IText);
-330
DO
USHORT Width;
struct IntuiText *IText;
Description:
Parameter:
IText:
Result:
Width:
See Also:
PrintIText ()
333
IPrintIText
Syntax:
Description:
This function writes the text of the IntuiText structure in the given
RastPort at the position specified through the offsets. If the
Next Text array contains more data, this data is also written.
Parameters:
RastPort:
IText:
LeftOffset:
TopOffset:
See Also:
IntuiTextLength(),DrawBorder(),Drawlmage()
Structure:
00
Ox01
01
Ox02
02
Ox04
04
Ox06
Ox08
06
08
OxOC
Ox10
12
16
Ox14
20
);
SetPointer
Syntax:
Description:
This function defines a custom mouse pointer for the given window.
This is always represented when the window is active. The offsets
specify the pointer's position and hot spot.
334
,.3
ABACUS
Parameters:
Window:
Pointer:
Height:
Width:
XOffset:
YOffset:
See Also:
ClearPointer ( )
6.3.7
Memory functions
IAlIocRemember
Allocates memoryl
Syntax:
Description:
Parameters:
RememberKey:
Pointer to Remembe r structure. The pointer must be
set to zero on the initial call.
Memory block size.
Attributes of the desired memory block.
Size:
Flags:
Result:
MemBlock:
See Also:
Structure:
OxOO
00
Ox04
OxOB
OxOC
04
OB
12
};
335
6.
FreeRemember
in the list
Syntax:
FreeRemember(RememberKey, ReallyForget);
-408
AO
DO
struct Remember *RememberKey;
BOOL ReallyForget;
Description:
This function frees all of the memory regions that are entered in the
Link_list from RememberKey. You can also clear the
RememberKey structure through this function.
Parameters:
RememberKey:
Pointer to first remember structure of a list.
ReallyForget: Tests for release of just the structure or just the
memory range. TRUE releases both the memory and
the structure.
See Also:
6.3 8
Refresh functions
!BeginRefresh
Syntax:
BeginRefresh (Window) ;
-354
AO
struct Window *Window;
Description:
This routine prepares the given window for redrawing only in areas that
require refresh.
Parameter:
Window:
See Also:
EndRefresh ()
!EndRefresh
Syntax:
EndRefresh(Window, Complete);
-366
AO
DO
struct Window *Window;
BOOL Complete;
Description:
Parameters:
Window:
Complete:
released.
336
ABACUS
See Also:
BeginRefresh ()
RemakeDis la
Syntax:
RemakeDispIay ()
-384
Description:
Warning:
See Also:
IRethinkDisplay
Syntax:
RethinkDispIay ()
-390
Description:
This function works through all of the ViewPorts and selects the error,
corrects it and re-initializes the Copper lists.
Warning:
See Also:
6.3.9
Other functions
CurrentTime
Syntax:
-84
AD
Al
Description:
This function copies the current values of the system time into the
specified memory locations. This time is correct about 60 times per
second.
Parameters:
Seconds:
Micros:
337
DoubleClick
Syntax:
Description:
This function tests whether two clicks occur within the time span
specifIed under Preferences.
Parameters:
Result:
IsDouble:
See Also:
Current Time ()
GetDefPrefs
Syntax:
Description:
This function copies the default values from Preferences into the
specified buffer. These are the values set when the system is started.
Other values are searched for on the disk when it is frrst booted.
Parameters:
Preffiuffer:
Size:
Result:
Prefs:
See Also:
GetPrefs ()
GetPrefs
Syntax:
338
6.3
ABACUS
Description:
This function copies the settings from Preferences into the given
buffer. These are the values set by the user through the Preferences
program.
Parameters:
PrefBuffer:
Size:
Result:
Prefs:
See Also:
GetPrefs ()
Structure:
OxOO
00
OxOl
01
Ox02
Ox04
02
04
OxOC
12
Ox14
20
OxIC
28
Ox64
Ox65
Ox66
Ox68
Ox6A
Ox6C
Ox6E
Ox70
Ox72
Ox74
Ox76
100
101
102
104
106
108
110
112
114
116
118
Ox77 119
Ox78 120
Ox7A
Ox7C
Ox7E
Ox80
122
124
126
128
Ox9E 158
OxAO 160
0xA2 162
OxA4 164
OxA6 166
OxA8 168
OxAA 170
BYTE FontHeight;
/* character set: 60 or 80
characters */
UBYTE PrinterPort; /* PrinterPort: serial or
parallel */
USHORT BaudRate; /* BaudRate: bet ween 11 0 and 19200 */
struct timeval KeyRptSpeed; /* Keyboard repeat
speed */
struct timeval KeyRptDelay; /* Delay time until a
key repeat * /
struct timeval DoubleClick; /* Double-click
time interval */
USHORT PointerMatrix[36LJ; /* Mouse pointer graphic
data */
BYTE XOffset;
/* Hot spot offset */
BYTE YOffset;
USHORT color17;
/* Mouse pointer colors */
USHORT color18;
USHORT color19;
/* Mouse movement conversion */
USHORT PointerTicks;
USHORT colorO;
/* Workbench colors */
USHORT color1;
USHORT color2;
USHORT color3;
BYTE ViewXOffset;
/* Relative position of the
Workbench screen to the View */
BYTE ViewYOffset;
WORD ViewlnitX;
/* Initialization values for the
View */
WORD ViewlnitY;
BOOL EnableCLI;
/* Enable/disable CLI */
USHORT PrinterType;
/* Printer type */
UBYTE PrinterFilename[30LJ; /* Name of the printer
with CUSTOM */
USHORT PrintPitch;
/* Kind of type: Pica, Elite,
Fine */
/* Print quality: Draft, NLQ */
USHORT PrintQuality;
/* Print spacing: 6 LPI or 8
USHORT PrintSpacing;
LPI */
UWORD PrintLeftMargin; /* Left and right print
margin */
UWORD PrintRightMargin;
USHORT Printlmage;
/* Positive or negative graphic
imaging */
USHORT PrintAspect;
/* Print aspect: horizontal,
vertical */
339
6.
OxAC 172
USHORT PrintShade;
OxAE
OxBO
OxB2
OxB4
174
176
178
180
OxB6 182
UBYTE SerRWBits;
OxB7 183
UBYTE SerStopBuf;
OxB8 184
OxB9 185
UBYTE SerParShk;
UBYTE LaceWS;
OxBA 186
UBYTE WorkName[30Ll;
OxDS
OxD9
OxDA
OxDC
OxDE
OxEO
OxE1
OxE2
BYTE RowSizeChange;
BYTE ColumnSizeChange; /* Final Version 1.2 */
UWORD PrintFlags;
/* New graphic settings */
UWORD PrintMaxWidth;
UWORD PrintMaxHeight;
UBYTE Print Density;
UBYTE PrintXOffset;
/* Workbench width, height,
UWORD wb_Width;
depth */
UWORD wb_Height;
UBYTE wb_Depth;
/* Version 1.3 */
UBYTE ext_size;
/* Length of an integrated
expansion */
216
217
218
220
222
224
225
226
OxE4 228
OxE6 230
OxE7 231
OxES 232
};
Preferences_FontHeight:
TOPAZ__EIGHTY 8L
TOPAZ SIXTY 9L
Preferences LaceWB:
LACEWB Ox01L
Preferences_PrinterPort:
PARALLEL PRINTER OxOOL
SERIAL PRINTER Ox01L
Preferences_BaudRate:
BAUD 110 OxOOL
BAUD-300 OxOlL
BAUD 1200 Ox02L
BAUD-2400 Ox03L
BAUD 4800 Ox04L
BAUD 9600 Ox05L
BAUD 19200 Ox06L
BAUD MIDI Ox07L
340
6.3
ABACUS
Preferences_PaperType:
FANFOLD OxOOL
SINGLE Ox80L
Preferences PrintPitch:
PICA OxOOOL
ELITE Ox400L
FINE Ox800L
Preferences_PrintQuality:
DRAFT OxOOOL
LETTER Oxl00L
Preferences_PrintSpacinq:
SIX LPI OxOOOL
EIGHT LPI Ox200L
Preferences_Printlmaqe:
IMAGE POSITIVE OxOOL
IMAGE-NEGATIVE Ox01L
Preferences_PrintAspect:
ASPECT HORIZ OxOOL
ASPECT-VERT Ox01L
Preferences PrintShade:
SHADE BW OxOOL
SHADE GREYSCALE OxOlL
SHADE COLOR Ox02L
Preferences_PaperSize:
US LETTER OxOOL
US-LEGAL Oxl0L
N TRACTOR Ox20L
W-TRACTOR Ox30L
CUSTOM Ox40L
Preferences_PrinterType:
CUSTOM NAME OxOOL
ALPHA P 101 OxOlL
BROTHER-15XL Ox02L
CBM MPSIOOO Ox03L
DIAB 630 Ox04L
DIAB- AnV D25 Ox05L
DIAB-C 150 Ox06L
EPSON Ox07L
EPSON JX 80 OxOeL
OKIMATE 20 Ox09L
341
QUME LP 20 OxOAL
HP rAsERJET OxOBL
HP- LASERJET PLUS OxOCL
Preference. SerialBuffer:
SBUF 512 OxOOL
SBUF-1024 Ox01L
SBUF-2048 Ox02L
SBUF-4096 Ox03L
SBUF--8000 Ox04L
SBUF--16000 Ox05L
Preference. SerRWBit.:
SREAD BITS OxFOL
SWRITE BITS OxOFL
Preference._SerStopBuf:
SSTOP BITS OxFOL
SBUFSIZE BITS OxOFL
Preferences SerParShk
SPARrTY BITS OxFOL
SPARITY NONE OL
SPARITY EVEN 1L
SPARITY-ODD 2L
SHSHAKE-XON OL
SHSHAKE RTS lL
SHSHAKE-NONE 2L
ILockIBase
Syntax:
Lock = LockIBase(LockNumber);
DO
-414
DO
ULONG Lock;
ULONG LockNumber;
Description:
This function locks the entire Intuition system. The function is called
from Intuition by any elementary change made to structures.
Parameter:
Result:
Lock:
Warning:
Comments:
(LayerInfo).
See Also:
342
UnlockIBAse(),LockLayerInfo(),ObtainSemaphore()
ABACUS
IReportMouse
Syntax:
AO
DO
BOOL Boolean;
struct Window *Window;
Description:
Parameters:
Boolean:
Exceptions:
ISetPrers
Syntax:
Sets Prererencesl
Prefs = SetPrefs(PrefBuffer, Size, Inform);
DO
-324
AO
DO
Dl
Description:
Parameters:
PretBuffer:
Size:
Inform:
Result:
Prefs:
See Also:
IUnlockIBase
Syntax:
AO
ULONG Lock;
Description:
Parameter:
Lock:
Warning:
If you try to free a lock that that doesn't exist, the system crashes.
343
6.
See Also:
LockIBase ()
IView Address
Syntax:
Address = ViewAddress();
-294
struct View *Address;
Description:
This function returns the pointer to the View, needed for every graphic
operation.
Result:
Adcb:ess:
IViewPortAddress
Syntax:
Address = ViewPortAddress(Window);
-300
AO
struct View *Address;
struct Window *Window;.
Description:
This function returns the pointer to the ViewPort, needed for every
graphic operation performed within a window.
Parameter:
Window:
Result:
Address:
344
OxOO
00
Ox14
Ox18
OxlA
OxlC
20
24
26
28
Ox20
32
Ox22
Ox24
Ox28
Ox2C
34
36
Ox30
48
Ox34
52
40
44
6.3
ABACUS
IntuiMessage_IDCMPFlags:
SIZEVERIFY Ox00000001L
NEWSIZE Ox00000002L
RRRRESHWINDOW Ox00000004L
MOUSEBUTTONS Ox00000008L
MOUSEMOVE Ox00000010L
GADGETDOWN Ox00000020L
GADGET UP Ox00000040L
REQSET Ox00000080L
MENUPICK Ox00000100L
CLOSEWINDOW Ox00000200L
RAWKEY Ox00000400L
REQVERIFY Ox00000800L
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
REQCLEAR Ox00001000L
MENUVERIFY Ox00002000L
/*
/*
NEWPREFS Ox00004000L
DISKINSERTED Ox00008000L
DISKREMOVED Ox00010000L
WBENCHMESSAGE Ox00020000L
/*
/*
/*
/*
ACTlVEWINDOW Ox00040000L /*
INACTlVEWINDOW Ox00080000L/*
DELTAMOVE Ox00100000L
/*
VANILLAKEY Ox00200000L
/*
INTUITICKS Ox00400000L
/*
LONELYMESSAGE Ox80000000L /*
MENUHOT Ox0001L
MENUCANCEL Ox0002L
MENUWAITING Ox0003L
OKOK MENUHOT
OKABORT Ox0004L
OKCANCEL MENUCANCEL
/* Menu Status */
Workbench_Flags:
WBENCHOPEN Ox0001L
WBENCHCLOSE Ox0002L
Intuition Macros:
Menu Macros:
MENUNUM(n) (n & Ox1F)
ITEMNUM (n) n 5) & OxOO3F)
SUBNUM(n) n 11) & OxOO1F)
SHIFTMENU(n) (n & Ox1F)
SHIFTlTEM(n) n & Ox3F) 5)
/*
/*
/*
/*
/*
Menu number */
Number of menu items */
Number of submenu items */
Shifted menu number */
Number of shifted menu
items */
SHIFTSUB(n) n & Ox1F) 11) /* Number of shifted submenu
items */
345
6.
Serial Macros:
SRBNUM(n)
SWBNIJM (n)
SSBNUM(n)
SPARNUM(n)
SHAKNUM(n)
(Ox08
(n 4
(Ox08
(n & OxOF
(Ox01 + (n 4.
(n 4)
(n & OxOF)
Preferences Definition:
NOMENU Ox001FL
NOITEM Ox003FL
NOSUB Ox001FL
MENUNull OxFFFFL
FOREVER fore;;)
1* Infinite loop *1
SIGN (x) ( x) > 0)
x) < 0) )
NOT !
CHECKWIDTH 19L
COMMWIDTH 27L
LOWCHECKWIDTH 13L
LOWCOMMWIDTH 16L
ALERT_TYPE Ox80000000L
1* Alert mask *1
RECOVERY ALERT OxOOOOOOOOL
1* Recoverable error *1
DEADEND ALERT Ox80000000L
1* Non-recoverable alert *1
AUTOFRONTPEN OL
1* Standard drawing colors *1
AUTOBACKPEN 1L
AUTODRAWMODE JAM2
1* Standard drawing mode *1
AUTOLEFTEDGE 6L
1* Standard coordinates *1
AUTOTOPEDGE 3L
AUTOITEXTFONT Null
1* Standard left *1
AUTONEXTTEXT Null
SELECTUP (IECODE_LBUTTON
IECODE UP PREFIX)
SELECTDOWN (mCODE LBUTTON)
MENUUP (IECODE RBUTTON I IECODE UP PREFIX)
MENUDOWN (IECODE RBUTTON)
- ALTLEFT (IEQUALIFIER LALT)
ALTRIGHT (IEQUALIFIER RALT)
AmigaLEFT (IEQUALIFIER LCOMMAND)
AmigaRIGHT (IEQUALIFIER RCOMMAND)
AmigaKEYS (AmigaLEFT I AmigaRIGHT)
CURSORUP Ox4CL
CURSORLEFT Ox4FL
CURSORRIGHT Ox4EL
CURSORDOWN Ox4DL
KEYCODE_Q Ox10L
KEYCODE X Ox32L
KEYCODE N Ox36L
KEYCODE-M Ox37L
KEYCODE V Ox34L
KEYCODE-B Ox35L
346
ABACUS
6.4
vary 1n size.
Intuition windows are represented by layers. Almost all of the attributes
6.4.1
Layer creation
Ot-ateBehindLayer
CreateUpfron<Layer
FattenLayerInfo
Ini<Layers
NewLayerInfo()
6.4.2
348
349
351
351
351
Layer processing
BeginUpdate
BehindLayer
EndUpdate
InstallClipRegion
LockLayer
LockLayerInfo
LockLayers
MoveLayer
MoveLayerInFrontOf
ScrollLayer
SizeLayer
SwapBitsRastPortClipRect
Upfron<Layer
WhichLayer
353
355
355
356
356
357
357
357
358
358
359
359
360
360
347
6.4.3
Releasing layers
DeleteLayer
DisposeLayerInfo
ThinLayerInfo
UnlockLayer
UnlockLayers
UnlockLayerInfo
6.4.1
361
361
362
362
362
363
Layer creation
ICreateBehindLayer
Syntax:
Description:
Parameters:
LayerInfo:
Bit-map:
occurs.
Layersuper:
348
ABACUS
Ba:kdrq>:
See Also:
CreateUpFrontLayer()
Syntax:
-36
AO
Al
DO
Dl
D2, D3, D4 [ A2 ]
struct Layer
*Layer;
struct Layer_Info *LayerInfo;
struct Bit-map
*Bit-map;
LONG
xl,yl,
x2,y2;
LONG
Flags;
struct Bitmap
*Superbitmap;]
Description:
This function creates a layer that is placed in front of all other layers or
before all other BACKDROP layers.
Parameters:
LayerInfo:
Bit-map:
349
refreshed.
Layersmart:
Layersuper:
See Also:
CreateBehindLayer()
350
ABACUS
IFattenLayerInro
FattenLayerInfo (LayerInfo);
Syntax:
-156
AD
Description:
Parameter:
Layerinfo:
See Also:
InitLayers (),ThinLayerInfo ()
ers
Syntax:
InitLayers(LayerInfo);
-30
AD
struct Layer_Info *LayerInfo;
Description:
Parameter:
Layerlnfo:
See Also:
FattenLayerInfo(),ThinLayerInfo()
LayerInfo = NewLayerInfo()
DO
-144
struct Layer_Info *LayerInfo;
Description:
Parameter:
None
Result:
Layerlnfo:
351
Structures:
offsets
Structure
struct Layer_Info <graphics/layers.h>
{
OxOO
Ox04
Ox08
4
8
OxOc
Ox18
Ox46
Ox54
Ox58
Ox5a
Ox5b
Ox5c
Ox5e
Ox62
12
24
70
84
88
90
91
92
94
98
352
OxOO
Ox04
0
4
Ox08
OxOc
12
OxlO
16
Ox18
Oxlc
Oxle
24
28
30
Ox20
32
Ox22
34
Ox26
38
Ox2a
Ox2c
42
44
Ox30
Ox34
Ox38
48
52
56
Ox40
Ox44
64
68
Ox48
72
ABACUS
Ox76
Ox7e
OxB2
OxB6
Ox9c
6.4.2
/* See LockLayer il * /
UBYTE reserved3[B);
struct Region *ClipRegion;
struct Region *saveClipRects;
UBYTE reserved2[22];
struct Region *DamageList;
/* see BeginUpdate() */
118
126
130
134
156
Layer processing
IBeginUpdate
Syntax:
Description:
This function ensures that the damage list that contains the sections of
the layers that must be redrawn is transferred into the ClipRect list
This cli pRect list contains all of the sections that must be redrawn.
When redrawing, only those sections that need redrawing are redrawn.
All other sections are undisturbed. BeqinUpdate () is usually used
in conjunction with the ClipRects. That way the old damage list is
saved:
struct Region *OldDamageList;
OldDamage-List = Layer->DamageList;
Then you make sure that the region that you have previously processed
with OrRectRegion () ,AndRectReqion (), etc. is declared as
the damage list:
struct Region *Region;
Layer->DamageList
Region;
Parameter:
Layer.
Result:
Status:
See Also:
EndUpdate ( )
353
struct Layer
rJ
struct Layer:
struct Layer:
*front
t--
struct Layer:
*front
struct Layer:
*baclt
struct Layer:
*baclt
struct OipRect:
*C\ipRect
struct OipRect:
*ClipRect
SIrUct RastPort:
struc:t RastPort:
*rp
*rp
f+
struct Rectangle:
struct Bit~:
*SuperBi ap
struct Layer_Info:
*LayerInfo
strut! Layer_Info:
r-
struct Region:
*OipRegion
struct Region:
*ClipRegion
struct Layer
~.
*LayerInfo
struct Layer:
*front
sttuct Layer:
*baclt
struct OipRect:
*C\ipRect
struct RastPort:
*rp
sttuct Rectangle:
bounds
struct BitMap:
*SuperBitMap
bounds
struct Rectangle:
bounds
sttuct BitMap:
*SuperBitMap
struct Layer_Info:
~
struct Region:
*DamageList
*LayerInfo
struct Region:
*ClipRegion
1
struc:t Region:
*DlmageUst
struct Region:
*DarnageUst
struct Layer_Info
....
struct Layer:
*t~_Layer
BYIE:
LockLayersCourt
354
ABACUS
IBehindLayer
Syntax:
Description:
This function places the given layer behind all other existing layers.
When sections of a REFRESH layer are visible, the LAYERREFRESH
bit for this layer is set.
Dummy:
Layer:
Result:
Status:
See Also:
UpFrontLayer ()
IEndUpdate
Syntax:
-84
aO
dO
Description:
Parameters:
This function ensures restoration of the ClipRects list after the layer
is refreshed.
Layer:
Flag:
Comments:
See Also:
BeginUpdate ()
355
hnstaIIClipRegion
Syntax:
-174
AO
Al
Description:
This function clips a specified region in a layer. This takes place after
creating a region using OrRectRegion () AndRectRegion () ,
etc.
Parameters:
Layer.
Region:
Result:
OldClipRegion:
Address of the previously installed clipping region.
Comments:
See Also:
BeginUpdate(),EndUpdate()
ILockLayer
Syntax:
Description:
Parameters:
Dummy:
Layer.
Comments:
See Also:
LockLayerInfo(),LockLayers()
356
6.4
ABACUS
erInfo
Syntax:
AO
Description:
Parameter:
LayerInfo:
See Also:
UnLockLayerInfo()
ILockLayers
Syntax:
AD
Description:
Parameter:
LayerInfo:
See Also:
LockLayer ()
IMoveLayer
Syntax:
Description:
Parameters:
Dummy:
Layer:
357
DeltaX, DeltaY:
Number of pixels that the layer should be moved in the
X or Y direction.
If you move the layer to a point outside of the RastPort, a system crash
Comments:
may occur.
erlnFrontOr
Syntax:
Description:
Parameters:
Layerl:
Layer2:
er
Syntax:
Scroll Layer (Dummy, Layer, DeltaX, DeltaY);
-72
AO
A1
DO
DO
LONG
Dununy ;
struct Layer *Layer;
LONG
Deltax,
DeltaY;
Description:
Parameters:
Dummy:
Dummy variable (not used).
Layer:
Address of the layer whose contents should be scrolled.
DeltaX, DeltaY:
Number of pixels that the layer should be moved.
Positive delta values move the contents toward the
upper left comer of the screen; negative delta values
move the contents toward the lower right comer.
358
6.4
ABACUS
ISizeLayer
Syntax:
Description:
This function changes the size of a layer. After sizing a layer, parts of
other layers may need to be covered or exposed. The
LA YERREFRESH bits are set after SizeLayer () to alleviate this.
When superbitmap layers are enlarged, the visible sections of the
superbitmap are copied into the new regions of the layer.
Parameters:
Dummy:
Layer:
Result:
Status:
SwapBitsRastPortClipRect
Syntax:
Description:
Parameters:
RastPort:
ClipRect:
359
IUpFrontLayer
Syntax:
dummy;
Description:
Parameters:
Dummy:
Layer:
Result:
Status:
See Also:
BehindLayer ( )
Returns la er containin
Syntax:
Description:
This function returns the layer that contains the given pixel of the bitmap.
Parameters:
LayerInfo:
x, y:
Result:
Layer:
Structures:
Offsets
360
OxOO
Ox04
0
4
Ox08
OxOc
8
12
struct
struct
/*
struct
struct
/*
ClipRect *Next;
ClipRect *prev;
For linking */
Layer *lobs;
Bit-map *Bit-map;
Bit-map of ClipRect */
ABACUS
6.4.3
Ox10
16
Ox18
Ox1c
Ox20
24
28
32
Ox24
36
*-p2;
LONG reserved;
'ifdef NEWCLIPRECTS_1_1
LONG Flags;
'endif
Releasing layers
IDeleteLayer
Deletes layerl
Syntax:
Description:
This function removes the specified layer and frees memory allocated
for the layer structure by either CreateUpFrontLayer () or
CreateBehindLayer (). In addition the LAYERREFRESH flag is
set to accommodate the remaining layers.
When using a LAYERS MART layer, all of the backup memory is freed.
When using a superbitmap layer, the superbitmap remains and makes
further graphic manipulations available.
Parameters:
Dummy:
Layer.
Result:
Status:
See Also:
DisposeLayerInfo()
IDisposeLayerInfo
Syntax:
DisposeLayerlnfo (Layerlnfo)
-150
aO
struct Layer_Info *LayerInfo;
Description:
361
Parameter:
LayerInfo:
!Thin LayerInfo
Syntax:
AD
Description:
This function frees the memory locations allocated for the extra
information of a Layer_Info sbUcture. This memory was allocated
with Fa t tenLayerInfo () . ThinLayerInfo () is an old
function and should be replaced by DisposeLayerInfo ()
whenever possible.
Parameter:
LayerInfo:
See Also:
IUnlockLayer
Syntax:
AD
Description:
This function unlocks the layer to all tasks. The access must have been
previously denied using LockLayer ().
Parameter:
Layer:
See Also:
LockLayer ()
IUnlockLayers
Syntax:
UnlockLayers (LayerInfo);
-114
AD
struct Layer_Info *LayerInfo;
Description:
Parameter:
LayerInfo:
See Also:
LockLayers ()
362
ABACUS
IUnlockLayerInro
Syntax:
Un1ockLayerInfo (LayerInfo)
-128
AO
struct Layer_Info *LayerInfo;
Description:
Parameter:
Layerlnfo:
See Also:
LockLayerInfo()
363
6.5
6.5.2
Icon functions
GetIcon
PutIcon
6.5.3
365
365
365
366
367
368
368
369
369
370
371
364
372
372
373
ABACUS
6.5.1.
IAllocWBObject
Syntax:
-66
Description:
This function uses memory for a Workbench object and initializes its
FreeLisl
Result:
Object
Exceptions:
Comments:
See Also:
IFreeWBObject
Syntax:
AO
Description:
sttucture's FreeLisl
Parameter:
Object
Comments:
See Also:
IGetWBObject
Syntax:
-30
AD
365
Description:
Parameter:
Name:
Result:
Object
Exceptions:
The function returns a value of zero if the file could not be loaded.
IoErr returns the exact error message.
Comments:
See Also:
PutWBObject
IputWBObject
Syntax:
is added to the
UBYTE *Name;
struct WBObject *Object;
Description:
Parameters:
Name:
Object
Result:
OK:
Comments:
See Also:
GetWBObject
Structures:
OxOO
OxOE
Ox1C
Ox2A
Ox38
Ox3C
Ox3D
Ox3E
Ox40
Ox44
36'
0
14
28
42
56
60
61
62
64
68
struct
struct
struct
struct
struct
UBYTE
UBYTE
USHORT
char
SHORT
Node
Node
Node
Node
WBObject
wo MasterNode;
wo:::'Sibl ings;
wo Select Node;
wo~::UtilityNode;
*wo_P arent ;
wo_Flags;
wo_Type;
wo_UseCount;
*wo_Name;
wO_NameXOffset;
6.S
ABACUS
Ox46
Ox48
Ox4C
Ox50
Ox54
Ox58
Ox5C
Ox60
Ox64
Ox68
Ox6C
Ox70
Ox74
70
SHORT
char
struct
struct
LONG
LONG
char
struct
struct
char
LONG
LONG
72
76
80
84
88
92
96
100
104
108
112
116
wo NameYOffset;
*wo=DefaultTool;
DrawerData *wo_DrawerData;
Window
*wo_IconWin;
wo_CUrrentX;
wo CurrentY;
**wo=ToolTypes;
Gadget
*wo_Gadget;
FreeList
*wo_FreeList;
*wo ToolWindow;
wo=StackSize;
wo_Lock;
OxOO 0
Ox30 48
Ox34 52
Ox38 56
struct NewWindow
dd NewWindow;
LONG
dd=CurrentX;
LONG
dd CurrentY;
1* more extensive under Version 1.1
*1
);
6.5.2
Icon functions
IGetIcon
Syntax:
GetIcon(Name,Icon,Free)
-42
AD
A1
A2
BOOL OK;
UBYTE *Name;
struct DiskObject *Icon;
struct FreeList *Free;
Description:
Parnmeters:
Name:
Object
Free:
Result:
OK:
See Also:
Put Icon
367
IPutIcon
Syntax:
OK = Putlcon(Name,Icon)
DO
-48
AO
AI
BOOL ok;
UBYTE *Narre;
struct Di skObject *Icon;
Description:
Parameters:
Name:
Icon:
Result:
OK:
See Also:
Getlcon
Structures:
Oxoo
Ox02
Ox04
Ox30
Ox32
Ox36
Ox3A
Ox3E
Ox42
Ox46
Ox4A
Ox4E
0
2
4
48
50
54
58
62
66
70
74
78
do_Magic;
UWORD
do Version;
UWORD
struct Gadget
dO=Gadget;
do Type;
UWORD
char
*do=DefaultTool;
char
**do ToolTypes;
LONG
do=CurrentX;
LONG
do_CurrentY;
struct DrawerData *do DrawerData;
*do-ToolWindow;
char
LONG
do=StackSize;
};
WE DISKMAGIC
WE DISKVERSION
NO ICON POSITION
6.5.3
Oxe310
1
(Ox80000000)
IFreeDiskObject
Syntax:
368
1* do Magic *1
1* do-Version *1
1* dO=CurrentX/Y *1
ABACUS
Description:
This routine frees the memory that belongs to the given disk object.
The DiskObject sttucture should have been previously added using
GetDiskObject.
Parameter:
Object:
See Also:
GetDiskObject
!GetDiskObject
Syntax:
-78
AO
Description:
Parameters:
Name:
Result:
Object:
Exceptions:
The function returns zero if memory could not be allocated for the
DiskObject sbUcture, or if the file could not be loaded. IoErr
returns the exact error message.
Comments:
See Also:
PutDiskObject
!PutDiskObject
Syntax:
is added to the
DO
-84
BOOL OK;
UBYTE *Name;
AO
Al
Description:
Parameters:
Name:
Object:
369
Result:
OK:
See Also:
GetDiskObject
Structures:
OxOO
Ox02
Ox04
Ox30
Ox32
Ox36
Ox3A
Ox3E
Ox42
Ox46
Ox4A
Ox4E
o
2
4
48
50
54
58
62
66
70
74
78
};
WE
WE
UWORD
do Magic;
do-Version;
UWORD
struct Gadget
do=Gadget;
UWORD
do Type;
*do-DefaultTool;
char
**do-ToolTypes;
char
LONG
do=CurrentX;
do CurrentY;
LONG
struct DrawerData *do-DrawerData;
*do-ToolWindow;
char
LONG
do=StackSize;
DISKMAGIC
DISKVERSION
NO ICON POSITION
6.5.4
Oxe310
1
(Ox80000000)
/* do Magic */
/* do-Version */
/* do=CurrentX/Y */
FreeList functions
AddFreeList
Inserts a memor
in FreeList
Syntax:
OK = AddFreeList(Free,Mem,Length)
DO
-72
AO
Al
A2
BOOL OK;
struct FreeList *Free;
UBYTE *Mem;
ULONG Length;
Description:
Parameters:
Free:
Mem:
Length:
Result:
OK:
See Also:
370
ABACUS
IFreeFreeList
Syntax:
FreeFreeList (free)
-54
AD
struct FreeList *free;
Description:
Pararne1er:
Free:
Comments:
See Also:
Structures:
Oxoo 0 WORD
Ox02 2 struct List
Ox10 16
fl_NumFree;
fl_MemLi st;
};
struct
MemList <exec/memory.h>
OxDD 0
DxOE 14
Ox10 16
Ox18 24
struct Node
UWORD
struct MemEntry
m1 Node;
ml-NumEntries;
ml=ME[11;
};
struct
MemEntry <exec/memory.h>
OxOO 0 union
OxOO 0
DxOO 0
ULONG
APTR
meu Reqs;
meu=Addr;
/* memory flags or * /
/* pointer to memory */
me Un;
Ox04 4 ULONG me_Length;
Ox08 8
};
371
6.5.5
Utility functions
Chan es filename to "co
Syntax:
Result = BumpRevision(newBuffer,oldName)
DO
-108
AO
Al
UBYTE *rResult;
UBYTE *newBuffer,oldName;
Description:
This function creates a copy of a file, appending "Copy of... " to the
beginning of the copy's filename.
Parameters:
newBuffer.
oldName:
c~ter).
made.
Result:
Result:
Exceptions:
Comments:
Examples:
oldName
newBuffer
''Test''
"copy of Test"
"copy 2 of Test"
"copy 199 of Test"
"copy Test"
"copy 0 of Test"
"copy of Test"
"copy 2 of Test"
"copy 3 of Test"
"copy 200 of Test"
"copy of copy Test"
"copy 1 of Test"
IFindTOOIType
Syntax:
FindToolType(toolTypeArray,Name)
-96
AO
Al
UBYTE *Value;
UBYTE **toolTypeArray,*Name;
Description:
372
This function searches the To 0 1 Type array for a certain entry. The
Tool Type array consists of pointers to strings which are constructed
in the following way:
ABACUS
VARIABLE=value
You get a pointer to the value of the string back, rather than a copy of
the value string.
Parameters:
toolTypeArray:
Pointer to the Tool Type array.
Pointer to the variable name that should be searched in
the array. This is found in the region outside of the
array and is not a part of it.
Name:
Result:
Value:
Exceptions:
When the variable could not be found, you get a zero back.
Comments:
Tool Types are assigned files (programs) and can be set from the
Workbench with the menu point "Info".
Example:
UBYTE *tTA[] =
(
"FlLETYPE=text",
"TEMPDIR=:t"
See Also:
MatchToolType
IMatchToOIValue
Syntax:
OK = MatchToolValue(typeString,Value)
DO
BOOL
-102
AD
Al
OK;
UBYTE *typeString,*Value;
Description:
Parameters:
typeString:
Value:
Result:
OK:
See Also:
FindToolType
373
6.6
374
Oxoo
Ox22
0
34
Ox26
Ox2a
38
42
Ox2e
46
long *blitter;
Ox32
Ox36
Ox3a
Ox3e
50
54
58
62
Ox42
Ox46
66
70
Ox4a
74
Ox60
96
Ox76
118
Ox8c
140
Ox9a
Oxge
OxaO
Oxa1
Oxa2
Oxa4
Oxa6
154
158
160
161
162
164
166
Oxa7
Oxa8
Oxaa
Oxac
Oxae
167
168
170
172
174
Oxbc
188
UWORD *LOFlist;
UWORD *SHFlist;
struct bltnode *blthd,
*blttl;
1* List for QBlit () *1
struct bltnode *bsblthd,
*bsblttl;
/* List for QBSBlit () */
struct Interrupt vbsrv,
1* vertical blank server */
timsrv,
1* time server */
bltsrv;
/* blitter server */
struct List TextFonts;
/* System font list */
struct TextFont *DefaultFont;
UWORD Modes;
BYTE VBlank;
BYTE Debug;
SHORT Beamsync;
SHORT system_bplconO;
UBYTE SpriteReserved;
/* reserved Sprites */
UBYTE bytereserved;
USHORT Flags;
SHORT BlitLock;
short BlitNest;
struct List Bli tWai tQ;
/* Blitter Wait Queue */
struct Task *BltOwner;
ABACUS
OxcO
192
Oxce
206
OxdO
Oxd4
Oxd6
OxdB
Oxda
Oxdc
Oxde
OxeO
20B
212
214
216
21B
220
222
224
Oxe4 22B
OxeB 232
Oxea 234
Oxf2 242
6.6.2
378
378
379
379
380
380
381
381
382
382
ClearScreen
Draw
DrawEllipse
DrawCircle
PolyDraw
ReadPixel
ScrollRaster
Text
TextLength
WritePixel
385
385
385
386
386
386
387
387
388
388
389
375
6.
6.6.3
AreaEllipse
AreaEnd
AreaMove
BNDRYOFF
Hood
InitArea
InitTmpRas
RectFill
SetAtPt
SetOPen
6.6.4
391
391
391
392
392
393
394
394
395
397
397
397
398
399
399
401
403
403
404
405
406
407
407
407
408
408
409
Copper functions
CBump
CEND
CMove
CWait
FreeCopList
FreeCprList
376
390
Blitter functions
BltBitMap
BltBitMapRastPort
BltClear
BltMaskBitMapRastPort
BltPattem
BltTemp1ate
ClipBlit
DisownBlitter
OwnBlitter
QBlit
QBSBlit
WaitBlit
6.6.6
389
390
ColorMap functions
FreeColorMap
GetColorMap
GetRGB4
LoodRGB4
SetRGB4
SetRGB4CM
6.6.5
411
411
412
412
413
413
6.6
ABACUS
FreeVPortCopLists
InitView
InitVPort
lradView
MakeVPort
MrgCop
ScrollVPort
UCopperListlnit
VBeamPos
WaitBOVP
WaitTOF
6.6.7
420
420
420
421
421
421
421
422
422
422
423
423
424
424
424
Character display
AddFont
AskFont
AskSoftStyle
CloseFont
OpenFont
RemFont
SetFont
SetSoftStyle
6.6.9
413
414
414
414
415
415
416
416
416
417
417
Layer functions
AndRectRegion
AndRegionRegion
AuemptLockLayerRom
OearRectRegion
ClearRegion
CopySBitMap
DisposeRegion
LockLayerRom
NewRegion
OrRectRegion
OrRegionRegion
SyncSBitMap
UnlockLayerRom
XorRectRegion
XorRegionRegion
6.6.8
427
427
427
428
428
429
429
430
AddVSprite
Animate
432
432
432
433
377
433
ChangeSprite
DoCollision
DrawGList
FreeGBuffers
FreeSprite
GetGBuffers
GetSprite
InitAnimate
InitGels
InitGMasks
434
434
435
435
436
436
437
437
438
438
439
439
InitMasks
MoveSprite
RemBob
Remmob
RemVSprite
SetCollision
SortGList
6.6.1
440
440
440
441
IAllocRaster
Syntax:
-492
DO
01
PlANEPTR Memory;
SHORT
Width,Height;
Description:
Parameters:
Width:
Height:
Result:
Memory:
See AlSO:
FreeRaster ()
IFreeRaster
Syntax:
378
ABACUS
Description:
Parameters:
Memory:
Width:
Height:
Comments:
You must give the same values for Height and width as you did in
AllocRaster. If these values are different than the ones used to
allocate memory, too little or too much memory is freed.
See Also:
AllocRaster ()
IInitBitMap
Syntax:
Description:
Parameters:
Bit-map:
Depth:
Width:
Height:
Comments:
See Also:
AllocRaster ()
InitRastPort
Syntax:
-198
A1
Description:
Parameter:
RastPort:
Comments:
379
ISetAPen
Syntax:
-342
Al
DO
Description:
Parameters:
RastPort:
ColorPen:
Comments:
See Also:
SetBPen(),SetOPen()
\SetBPen
Syntax:
-348
Al
DO
Description:
Parameters:
RastPort:
ColorPen:
Comments:
The background pen can be found in JAM2 mode and any combinations
using JAM2 mode (JAM2 I COMPLEMENT and JAM2 I INVERSVID)
in conjunction with text or area fills. The points not actually set in
JAMl mode are the color of the background pen in JAM2 drawing mode
(JAM2 I INVERSVID).
See Also:
SetDrMd(),SetAPen()
380
ABACUS
ISetDrMd
Syntax:
Description:
This function sets the drawing mode of a RastPort. The drawing mode
dictates the behavior of a pixel, line, etc., in conjunction with pixels
already placed in the RastPort. In JAM! mode the point appears directly
in the RastPort. Text output requires special attention. For example,
free areas inside of the letter 0 show through the rest of the letter.
The JAM2 mode is different. There the color of the BPen is assigned to
all of the points not set by letters (e.g., the inside of the letter 0). In
addition, the BPen color covers any 0 bits (e.g., a single color fill
pattern). This means that the Blitter can only copy rectangular areas,
which can contain these areas. The empty area can be made any color
you want.
The following drawing modes function only in conjunction with the
JAM! or JAM2 mode:
COMPLEMENT
mode pixels are run through XOR before you set them.
RastPort:
DmwMode:
Comments:
ISetDrPt
Syntax:
Description:
381
Parameters:
RastPort:
Pattern:
Comments:
This line pattern is only 16 points wide. Any lines wider than 16
pixels repeat the pattern.
/SetRast
Syntax:
Description:
This function assigns one color to all the pixels in the RastPort.
Parameters:
RastPort:
ColorPen:
See Also:
SetAPen(),SetBPen()
ISetWrMsk
Syntax:
Description:
Parameters:
RastPort:
Mask:
Structures:
Offset
Structures
struct BitMap <graphics/gfx.h>
(
382
OxOO
Ox02
Ox04
OxOS
4
S
Ox06
OxOB
6
B
Ox10
16
UWORD BytesPerRow;
1* Width in bytes *1
UWORD Rows;
1* Height in lines */
UBYTE Flags;
UBYTE Depth;
1* Number of bit-planes *1
UWORD pad;
PLANEPTR Planes[B);
1* Address of bit-plane *1
6.6
ABACUS
OxOO
Ox04
OxOB
OxOc
12
Ox10
16
Ox14
20
Ox1B
24
Ox19
25
Ox1a
26
Ox1b
27
Ox1c
2B
Ox1d
29
Ox1e
Oxlf
Ox20
Ox22
30
31
32
34
Ox24
Ox26
36
3B
Ox2B
Ox30
Ox32
Ox34
40
4B
50
52
Ox3B
56
Ox39
Ox3a
Ox3c
Ox3e
Ox40
Ox42
57
5B
60
62
64
66
Ox46
70
Ox4e
Ox5c
7B
92
Ox64
100
383
struct RastPort
struct Layer:
*Layer
....
,....
struct BitMap
struct BitMap:
*BitMap
UBY1E:
Mask
BYIE:
FgPen
BYIE:
BgPen
BY1E:
AOlPen
BY1E:
DrawMode
USHORT:
LinePtrn
SHORT:
cp_x
cp-y
384
........
UWORD:
BytesPerRow
UWORD:
Rows
UBY1E:
Flags
UBY1E:
Depth
PLANEPTR:
Planes [8]
.....
...
ABACUS
6.6.2
ClearEOL
Syntax:
Clears line u
to current cursor
ClearEOL (RastPort)
-42
Al
Description:
This function clears a text line displayed using the RastPort character
set, up to the current graphic cursor position. This position can be
determined using the Move () function. The clearing occurs in such a
way that all of the points that lie outside the graphic cursor position are
erased, or (in JAM2 drawing mode) changed to the color of the BPen.
Parameter:
RastPort:
See Also:
ClearScreen(),Move()
Clear Screen
Syntax:
-48
Al
Description:
This function clears the entire screen starting at the current graphic
cursor position. The clearing occurs in such a way that all of the points
that lie outside the graphic cursor position are erased, or (in J AM2
drawing mode) changed to the color of the BPen.
Parameter:
RastPort:
See Also:
ClearEOL ()
IDraw
Syntax:
-246
Al,
DO, Dl
Description:
This function draws a line in the given RastPort, from the current
graphic cursor position to the specified coordinates. These coordinates
become the new graphic cursor position.
Parameters:
RastPort:
x, y:
385
Comments:
See Also:
Move ()
IDrawElIipse
Draws ellipsel
Syntax:
Description:
Parameters:
RastPort:
XM, YM:
Xr, Yr:
See Also:
AreaEllipse ( )
!DrawCircle
Draws circlel
Syntax:
Description:
Parameters:
RastPort:
XM,YM:
Radius:
See Also:
AreaEllipse ()
!PolyDraw
Draws polygonl
Syntax:
Description:
Parameters:
RastPort:
Number:
PointArray:
386
ABACUS
See Also:
Move () ,Draw ()
IReadPixel
Syntax:
Description:
This function determines the color of the pixel at the given X/Y
COOIdinates.
Parameters:
RastPort:
x, y:
Result:
ColorPen:
See Also:
WritePixel ()
ScrollRaster
Syntax:
Comments:
Parameters:
RastPort:
RastPort in which a rectangle should be scrolled.
DeltaX. DeltaY:
Coordinates to which the rectangle should be moved.
Positive Delta values move the rectangle toward the
upper left comer of the RastPort; negative Delta values
move the rectangle in the opposite direction.
Upper left comer of the rectangle to be moved.
xl, yI:
Lower right comer of the rectangle to be moved.
x2. y2:
Comments:
387
6.
String output!
Syntax:
Al
AO
DO
Description:
Parameters:
RastPort:
Comments:
See Also:
Move () SetDrMd ()
ITextLength
Syntax:
-54
A1
AO
DO
SHORT
Length;
struct RastPort *RastPort;
char
*String;
SHORT
NumCharacters;
Description:
Parameters:
RastPort:
RastPort into which the string should be written.
String:
Address of the string whose width should be tested.
NumCharacters:
Number of characters in the string.
Result:
Length:
Comments:
388
ABACUS
See Also:
Text (),SetFont()
IWritePixel
Syntax:
Description:
This function draws one pixel in the current drawing color (Apen) at
the specified X/Y coordinates oCthe current RastPort.
Parameters:
RastPort:
x,
y:
Result:
Status:
See Also:
ReadP ixel ( )
Structure:
Offset
Structure
struct tPoint <graphics/gfx.h>
{
OxOO
Ox02
Ox04
6.6.3
2
4
WORD x,
y;
AreaCircie
Syntax:
Description:
Parameters:
RastPort:
Xm, Ym:
Radius:
389
6.
Result:
Status:
Comments:
See Also:
AreaEnd() ,InitArea ()
AreaDraw
Syntax:
ixel in AreaInfo
Defines
Status = AreaDraw (RastPort, x, y)
DO
-258
A1
00 D1
LONG
Status;
struct RastPort *RastPort;
SHORT
x,y;
Description:
Parameters:
RastPort:
x, y:
Result:
Status:
See Also:
AreaEnd(),AreaEllipse(),AreaMove(),InitArea()
\AreaEllipse
Syntax:
-186
Al
00
01
02
03
LONG
Status;
struct RastPort *RastPort;
SHORT
Xm,Ym;
SHORT
Xr,Yr;
Description:
This function defines the data for a filled ellipse in the Arealnfo
structure of the given RastPort.
Parameters:
RastPort:
Xm, Ym:
Xr, Yr:
Result:
Status:
See Also:
390
AreaEnd() ,InitArea ()
ABACUS
IAreaEnd
Syntax:
-264
Al
Description:
Parameter:
RastPort:
Result:
Status:
Comments:
See Also:
AreaDraw(),AreaMove(),AreaEllipse(),InitArea(),
InitTmpRas ()
AreaMove
Syntax:
Defines start of
01
on in AreaInfo
-252
Al
DO 01
Description:
Parameters:
RastPort:
x, y:
Result:
Status:
See Also:
AreaDraw(),AreaEllipse(),AreaEnd(),InitArea()
IBNDRYOFF
Syntax:
BNDRYOFF (RastPort)
(Macro)
struct *RastPort;
391
Description:
Parameter:
RastPort:
Comments:
If you want to draw border lines, set the AREAOUTLINE bit in the
Flags variables of the RastPort (AREAOUTLINE is defined in
graphics/rastport.h).
Flood
IFlood
Syntax:
Description:
Parameters:
RastPort:
Mode:
x, y:
Comments:
filii
See Also:
InitArea
InitTmpRas(),SetOPen()
Syntax:
Description:
392
ABACUS
When this structure is initialized through this function. you specify the
address of the coordinates buffer. which must be NumPoints * 5
bytes. so that it will accommodate a UBYTE array consisting of the
number of comer points used in the polygon. For example. at least 25
bytes must be allocated in the coordinates buffer for a four-point
polygon 4+1*) 5 bytes).
The AreaEllipse () function needs two coordinates. One ellipse
requires a buffer of at least 15 bytes (2*5 bytes for the ellipse itself
plus 1*5 bytes for AreaEnd
When you have initialized the
Arealnfo structure using InitArea (). you must add this with
RastPort .Arealnfo = Arealnfo in the RastPort.
(.
Parameters:
AreaInfo:
Buffer:
NumPixels:
See Also:
AreaDraw().AreaEnd().AreaEllipse().AreaMove()
hnitTmpRas
Syntax:
-468
AD
Al
DO
Description:
Parameters:
TmpRas:
Buffer:
BufferSize:
393
6.
Result:
ITmpRas:
InitTmpRas
( ).
Fills a rectanglel
IRectFiII
Syntax:
Al
DO
D1
D2
D3
Description:
This function fills a rectangle using the current drawing mode, color
pen and fill pattern. As soon as the AREAOUTLINE bit is set in the
RastPort . F 1 a g variables a border line appears around the filled
rectangle in the color of the OPen.
Parameters:
RastPort:
When working in COMP LEMENT mode, all of the bit-planes are rotated
in the rectangle, as well as those selected using the APen.
See Also:
BNDRYOFF ()
ISetAfPt
Syntax:
Description:
Parameters:
RastPort:
Pattern:
NumLines:
394
ABACUS
ISetOPen
Syntax:
Description:
Parameters:
RastPort:
ColorPen:
Comments:
See Also:
BNDRYOFF ()
Structures:
Offset
Structures
struct Arealnfo <graphics/gfx.h>
{
OxOO 0
Ox04 4
Ox08 8
OxOc 12
Ox10 16
Ox12 18
SHORT *VctrTbl;
/* Vector table */
SHORT *VctrPtr;
/* Next free vector */
BYTE *FlagTbl;
BYTE *FlagPtr;
SHORT Count;
/* Number of vectors to count */
SHORT MaxCount;
/* Maximum numbere of vectors */
SHORT FirstX,
FirstY;/* First coordinate {AreaMove( */
Ox14 20
Ox16 22
Ox18 24
OxOO
Ox04
Ox08
0
4
8
BYTE *RasPtr;
LONG Size;
/* Pointer to raster */
/* Size of raster */
395
6.
struct RastPort
slroct Layer:
*Layer
f+
sttuct BitMap:
*BitMap
~
struct TmpRas
USHORT:
*AreaPtrn
struct TmpRas:
*TmpRas
Slroct AreaInfo:
*AreaInfo
struct AreaInfo
......
SHORT:
*Vctr'Ibl
UBYIE:
Mask
SHORT:
*VctrPtr
BITE:
FgPen
BYJE:
*F1agTbl
BITE:
BgPen
BYIE:
*F1agPtr
BITE:
AOIPen
SHORT:
Count
BYIE:
DrnwMode
SHORT:
MaxCount
BY1E:
AreaPtSz
SHORT:
FirstX
Firsty
USHORT:
LinePtm
SHORT:
cP_x
CPJ
396
BYlE:
*RasPtr
LONG:
Size
ABACUS
6.6.4
Colormap functions
FreeColorMa
Frees memor
from ColorMa
Syntax:
FreeColorMap (ColorMap)
-576
AD
struct ColorMap *ColorMap;
Description:
This function releases the memory allocated for the Colo rMa p
structure. When you allocate memory for a color table using
GetColorMap () , you must free this memory before ending the
program using the FreeColorMap () function. This ensures that
other applications have access to as much memory as possible.
Parameter:
ColorMap:
See Also:
GetColorMap ()
IGetColorMap
Syntax:
Description:
Parameter:
NumColors:
Result:
ColorMap:
See Also:
!GetRGB4
Syntax:
FreeColorMap ()
397
Description:
Parameters:
ColorMap:
ColorRegister:
Number of the color register that you want to read
(values range from 0 to 31).
Result:
Color:
Comments:
See Also:
GetColorMap(), LoadRGB4(),GetRGB4(),SetRGB4CM(),
MrgCop () , LoadView ()
ILoadRGB4
Syntax:
Initializes ColorMapl
LoadRGB4 (ViewPort, ColorPalette, ColorEntries)
-192
AD
A1
DO
Description:
This function creates a color palette with different color entries in the
ColorMap of the specified ViewPort. This adds the colors to the
ColorMap only; they are not visible in the ViewPort. The sequences
MakeVPort (), MrgCop () and LoadView () must first be called
Parameters:
398
ViewPort:
ABACUS
See Also:
GetRGB4 (),SetRGB4 ()
ISetRGB4
Syntax:
AO
DO
D1
D2
D3
Description:
Parameters:
ViewPcrt:
Address .of the ViewPcrt to be changed.
CclcrRegister:
Number .of the colcr register to be changed.
Red, Green, Blue:
Cclcr ccmpcnents. The Amiga creates cclcrs by
ccmbining the basic cclcrs red, green and blue in
different prcporticns. Values for each colcr component
range frcm 0 to 15, resulting in 16"3, .or 4096, possible
cclcr combinaticns.
See Also:
ISetRGB4CM
Syntax:
AO
DO
D1
D2
D3
Descripticn:
Parameters:
CclcrMap:
Address .of the ColorMap to be changed.
CclcrRegister:
Number .of the cclcr register tc be changed.
Red, Green, Blue:
Cclcr ccmponents. The Amiga creates cclcrs by
combining the basic cclors red, green and blue in
different proporticns. Values fcr each cclor component
399
SetRGB4 ()
Structures:
Offset
Structures
struct ColorMap <graphics/view.h>
{
OxOO
OxOl
Ox02
0
1
2
Ox04
Ox08
UBYTE Flags;
UBYTE Type;
{)WORD Count;
/* number of the color entry */
APTR colorTable;
/* Address of the color table */
SIrUtt VOPm:
r'
*Nat
stnII:IOhMap:
*Cci1lMap
*Ncxt
SlrUttCopI.isl:
SprIns
sInEI CopliI:
*(]rIlE
SlnllSUCoplil:
*UCopIns:
SHORT:
UBYl'E:
UBYl'E:
SlnldCoklMap:
~
....
Copliat ....
SInId
T~
SprlDs
UWoo.
SInIIS Coplist:
*OrIns:
....
Am:
CdllTaIK
llUctuo.,lii:
*UCopIns:
....
...
SHORT:
!1NiII
SHORT:
DxOlkt
SHORT:
DxOfkt
MIkt
UWORD:
Modal
Mla
*RasInfo
...
*~Im
Cowl
DIfjgbI
SIrUQ RBnfo:
....
SlnldOJpUat
...
I1!V1dIh
400
sInEI CDIlMap
...... Hap
Copliat ....
*~
SIIUCt
Ib1II% VoM
UW<iD:
r+
IIII1ia RasIDfo:
*Raslnfo
f.+
6.6
ABACUS
6.6.5.
Blitter functions
BUts rectangle between bit-mapsl
IBItBitMap
Syntax:
BitPlanes
DO
Description:
Parameters:
SourceBitMap:
xl, yl:
DestBitMap:
x2, y2:
Width, Height:
Minterm:
Ox80
Ox40
!C)
BC (!B and C)
= Ox20
Bp (!B and
BC (B and
!C)
OxlO
401
Mask:
Buffer:
Result:
BitPlanes:
inserted.
See Also:
402
ClipBit ()
ABACUS
IBItBitMapRastPort
Syntax:
Description:
Parameters:
SourceBitMap:
Pointer to the bit-map from which the data should be
read.
xl, yl:
Upper left corner coordinates of SourceBi tMap's
rectangle.
DestRastPort: Pointer to the RastPort to which the data should be read
or combined.
Upper left corner coordinates of DestRastPort's
x2, y2:
rectangle.
Width, Height:
Size of the rectangle being blitted.
Minterm:
Variable which specifies the operation performed by the
Blitter when creating the destination rectangle (see
B 1 t Bit Map () for more information about
Minterm).
Mask::
Parameter mask which specifies the accessible
bit-planes of the two areas. Only the bit-planes for
which the corresponding bit is set are included in the
blit (bit O=Bi tMap. Plane s [0] (first bit-plane), bit
l=BitMap. Planes [2] (second bit-plane), etc.).
See Also:
IBItClear
Syntax:
BltBitMap ()
403
Description:
This function clears memory up to the given absolute address using the
APTR (Absolute memory PoinTeR, compatible with PLANEPTR
[pLANE PoinTeR]). The memory range must be Chip accessible and
located in less than 512K.
Parameters:
Memblk:
NumBytes:
Flags:
IBItMaskBitMapRastPort
Syntax:
Description:
Parameters:
SourceBitMap:
Pointer to the bit-map from which the data should be
read.
xl, yl:
404
ABACUS
Minterm:
source.
BltMask:
See Also:
B1 tBi tMap ( )
IBItPattern
Syntax:
x2, y2;
SHORT
NumBytes;
Description:
This function fills a rectangle using the current drawing mode, color
pen and fill pattern. The fIll pattern is transferred through a mask. This
mask is actually a bit-plane, which acts as a template for controlling
the fill operation. This mask is the same size as the rectangle being
blitted.
Parameters:
RastPort:
Mask:
xl, yl, x2, y2:
NumBytes:
See Also:
B1tMaskBitMapRastport()
405
IBItTemplate
Syntax:
-36
AO
DO
DI
Al
D2,
y, Width, Height)
D3
D4
DS
APTR
*Source;
SHORT
Bi tPosition;
SHORT
Modulo;
struct RastPort *RastPort;
SHORT
x,y;
SHORT
Width,Height;
Description:
Parameters:
Source:
BitPosition:
Modulo:
RastPort:
x, y:
Width, Height:
Modulo = 6 Bytes
Byte 1
Byle 0
Byle 2
Byle 7
Byle 14
Byte 21
Byte 3
Byte 4
Appearance
x
I
406
---.t
..
I
I
I
I
...
Byle 6
Height = 9 Rows
+ +
Byle S
Width - 10 Bits
'n
IMPort
Byle 62
ABACUS
IclipBit
Syntax:
Description:
Parameters:
SourceRastPort:
Pointer to the RastPort from which the data should be
read.
xl, yl:
Upper left comer coordinates of SourceRastPort's
rectangle.
DestRastPort: Pointer to the RastPort to which the data should be read
or combined.
x2, y2:
Upper left comer coordinates of DestRastPort's
rectangle.
Width, Height:
Size of the rectangle being blitted.
Minterm:
Variable which specifies the operation performed by the
Blitter when creating the destination rectangle (see
BIt Bit Map () for more information about
Minterm).
See Also:
BltBi tMap ( )
DisownBlitter
Syntax:
DisownBlitter ()
Description:
This function releases the Blitter from exclusive access, allowing other
programs or tasks to use the Blitter.
See Also:
ownBli t ter ()
OwnBlitter
Syntax:
407
Description:
This function locks the Blitter into exclusive access mode (only one
task can use the Blitter, excluding all other tasks). WaitBlit ()
should be invoked before Blitter use. This forces the Blitter to wait on
executing OwnBli t ter () until any task currently running through
the Blitter is done.
See Also:
DisownBlitter(),WaitBlit()
IQBHt
Syntax:
QBlit (BlitNode)
-276
struct blitnode *BlitNode;
Description:
Parameter:
BlitNode:
Comments:
See Also:
QBSBlit ()
IQBSBlit
Syntax:
QBSBlit (BlitNode)
-294
struct blitnode *BlitNode;
Description:
408
ABACUS
Parameter:
BlitNode:
See Also:
Qblit ()
IWaitBlit
or
Blitter access I
Syntax:
WaitBlit ()
Description:
This command returns to your program or task when the blit, the
current blit operation, is completely done. Unfortunately you cannot
always get out of Wa i t B1 it ( ) . This is because a processor error
occurs in Agnus so that Wai tBli t () comes back although the blit
has actually not begun. This can happen especially when the Amiga is
running in HIRES with 4 bit-planes.
Structures:
Offset
Structures
struct bltnode <hardware/blit.h>
{
OxOO
Ox04
OxOB
OxOa 10
OxOc 12
OxOe 14
Ox12 IB
409
struct GfxBase
struct Library:
LibNode
struct View:
*ActiView
UWORD:
*WFList
UWORD:
*SHFList
struct bltnode:
*blthd
*blttl
struct bltnode:
*bsblthd
*bsblttl
struct List
*TextFonts
struct TextFont:
*DefaultFont
struct bltnode
struct bltnode:
*n
int:
(*function) 0
char:
stat
short:
bltsize
short:
beamsync
UBYfE:
SpriteReserved
struct List:
BlitWaitQ
struct Task:
*BlitOwner
struct SimpleSprite:
**SimpleSPrites
410
int:
(*cleanup) 0
ABACUS
6.6.6
Copper functions
ICBump
Syntax:
-366
Al
struct UCopList *UCopList;
Description:
Parameter:
UcopList:
See Also:
CMove(),CWait,UCopListInit
ICEND
Syntax:
CEND (UCopList)
(Macro)
struct UCopList *UCopList;
Description:
Parameter:
UCopList:
See Also:
CMove(),CWait(),UCOpListInit()
411
6.
ICMove
Syntax:
Description:
Parameters:
UCopList:
Register:
Value:
placed.
Comments:
Instead of using CMove () and CBump () you can use the macro
CMOVE () (graphics/gfxmacros. h). This macro is called using
the same parameters as CMove ( ) .
You can also invoke CWa i t () to wait for a certain electron beam
position, and then change a register (e.g., color register). You may not
fill all of the hardware registers with the Copper.
See Also:
UCopListlnit(),CWait
ICWait
Syntax:
CWait (UCopList, Y, X)
-378
Al
DO, 01
struct UCopList *UCopList;
SHORT
Y,X;
Description:
This function places a command in the user Copper list to ensure that
the Copper program waits on the processing until the electron beam
reaches the specified position. If the electron beam has already passed
the specified position, the program continues with the Copper program.
Parameter:
UCopList:
placed.
Y,X
Comments:
412
ABACUS
See Also:
CMove(),CWait(),UCOpListlnit()
Frees memor
ia intermediate Co
Syntax:
FreeCopList (CopList)
-546
AO
struct coplist *CopList;
Description:
Parameter:
CopList:
See Also:
FreeVPortCopLists()
Frees memor
or hardware Co
Syntax:
FreeCprList (CprList)
-564
AO
struct cprlist *CprList;
Description:
This function frees memory that was allocated by the executed Copper
list (View. LOFCprList, View. SHFCCprList).
Parameter:
CprList:
See Also:
MrgCop ()
IFree VPortCopLists
Syntax:
FreeVPortCopLists (ViewPort)
-540
AO
struct ViewPort *ViewPort;
Description:
Parameter:
ViewPort:
freed.
See Also:
MakeVPort (),FreeCopList ()
413
structurel
Syntax:
InitView (View)
-360
Al
struct View *View;
Description:
This routine clears all variables and initializes a View structure. Then
the variables DxOffset and DyOffset, which control the position
of the View on the screen, initialize so that the View's position moves
1/2" from the upper left comer of the screen when the monitor and
Preferences are correctly set
The starting address of the current Copper lists is saved in this View
structure. One list is always in use (View. LOFCprList) and another
comes into service only when interlace mode is invoked
(View. SHFCprList). When using a resolution mode (HIRES or
LACE) remember that a ViewPort arranged within a View can only use
the resolution mode that is set in the View.
Parameter:
View:
See Also:
MrgCop ()
InitVPort
Syntax:
InitVPort (ViewPort)
-204
AD
struct ViewPort *ViewPort;
Description:
Parameter
ViewPort:
See Also:
MakeVPort(),MrgCop(),LoadView()
ILoadView
Syntax:
414
ABACUS
Description:
Parameter:
View:
See Also:
IMakeVPort
Syntax:
Description:
Parameters:
View:
ViewPort:
See Also:
MrgCop(),LoadView()
IMrgCop
Syntax:
MrgCop (View)
-210
A1
struct View *View;
Comments:
Parameter:
View:
See Also:
MakeVPort(),LoadView()
415
IScrollVPort
ScrollVPort (ViewPort)
Syntax:
-588
AD
Description:
This function recalculates the Copper list for the ViewPort and adds the
result to the hardware Copper list. After you change some variables in
the ViewPort structure or in the Ra sIn f 0 structure, the
Scroll VP 0 rt () function offers a simple method of making the
changes.
Parameter:
ViewPort:
IUCopperListlnit
Syntax:
AD
DO
Description:
Parameters:
CopperList:
Pointer to the user Copper list to be re-intialized.
NumberCommands:
The number of commands to be placed in the user
Copper list.
Result:
UCopList:
Comments:
This function can also be called using the CINIT () macro (found in
graphics/ gfxmacros . h) . The syntax remains the same.
structure if
When accessing the user Copper lists you must remember that these are
given in the ViewPort in which they should be presented
(ViewPort.UCoplns = UCopListorViewPort.UCoplns =
CopperLi st). Then you must only calculate the Copper lists
(MakeVPort () ,MrgCop () ).
See AlSO:
IVBeamPos
Syntax:
VBeamPos()
-384
ULONG Position;
416
ABACUS
Description:
This function returns the current position of the electron beam that is
responsible for drawing the video image. Unfortunately you cannot be
100% certain about the result from this function during multitasking.
because multitasking returns slightly inaccurate results. The most
accurate result (up to one line) is returned if you run your task at the
highest priority.
Result:
Position:
!WaitBOVP
Syntax:
WaitBOVP (ViewPort)
-402
AO
struct ViewPort *ViewPort;
Description:
This function returns to your program or tasks when the electron beam
displayed the last raster line of the given ViewPort (Bottom Of
ViewPort).
Parameter:
ViewPort:
!WaitTOF
Syntax:
WaitTOFO
270
Description:
This function waits at the Top Of Frame (TOF) for the electron beam
to return. The electron beam travels between the bottom of the screen
and the top. displaying nothing. The ViewPort display begins at the
frrst line after the TOF. You can direcdy change the bottom line of the
screen after wai t TOF () without an immediately visible change. The
task with the highest priority executes immediately after Wa it TOF ( ) .
Structures:
Offset
Structures
---------struct UCopList
<graphics/copper.h>
OxOO
Ox04
Ox08
OxOc
4
8
struct
/*
struct
struct
UCopList *Next;
For linking */
CopList *FirstCopList;
CopList *CopList;
12
struct CopList
<graphics/copper.h>
OxOO
Ox04
Ox08
OxOc
12
struct
/*
struct
struct
/*
struct
CopList *Next;
For linking */
CopList *_CopList;
ViewPort * ViewPort;
Interface to ViewPort *1
CopIns *CopIns;
1* Copper instructions *1
1* Linked list *1
417
6.
OxlO
Ox14
16
20
Ox18
24
Oxlc
28
Oxle
30
Ox20
32
Ox22
34
OxOO
Ox04
Ox08
OxOa
10
OxOO
Ox04
Ox08
OxOc
12
OxlO
16
Ox14
20
Ox18
Oxla
24
26
OxIc
Oxle
28
30
Ox20
32
Ox22
Ox23
Ox24
34
35
36
Ox28
40
struct
/*
struct
/*
struct
/*
struct
ViewPort *Next;
For linking */
ColorMap *ColorMap;
Address of the ColorMap */
CopList *DspIns;
Display instructions */
CopList *SprIns;
1* Sprite instructions */
struct CopList *ClrIns;
/* Color instructions */
struct UCopList *UCopIns;
/* User instructions */
SHORT DWidth,
DHeight;
/* Size of the ViewPort */
SHORT DxOffset,
DyOffset;
/* Position of the ViewPorts */
UWORD Modes;
/* Display mode */
UBYTE SpritePriorities;
UBYTE reserved;
struct RasInfo *RasInfo;
/* Interface to the bit-map */
struct RasInfo <graphics/view.h>
{
418
OxOO
Ox04
Ox08
OxOa
8
10
ABACUS
1* relative to ViewPort *1
OxOc 12
struct View
{
OxOO
Ox04
Ox08
OxOc
OxOe
12
Ox10
16
Ox14
20
14
IInJCt VicwPat
tVnPut
IInJCt qlliit
r1
~
-S
=
mt
UWORD:
Mocb
..
IInJCt VnPut
IInJCtVnl'cJrt
~
f+
IInJCt CdorMIp:
"Co\mMIp
IInJCt Co!i.iII:
"DIp"
IInJCt Co!i.iII:
Sp'D
IInJCt Co!i.iII:
tClrlDl:
IInJCt Cqi.iIt
IInJCt Co!i.iII:
~
r+
IInJCt CopIDI:
r+
UWatD:
~1IIt
IInII:I UCcd.iII
*U~IDI:
1InII:I~
Li
IInJCt qlliit
*NcJd
UWORD:
*SWt
SmRT:
MuCamt
-capIDI
UWORD:
*CopSSIIn
SHOKI':
DWidIh
SmRT:
c-
DIJciaI'
SmRT:
MaCama
SHOKr:
IhOIIic:t
o,oDiI:t
SmRT:
D,OIfIat
UWORD:
Mocb
IInICI RaIDfo:
*Ra1Dfo
......IInJCt RaInfo
IIr1Ic:IRaInfo:
*Nm
IInJCt BWap:
IInII:I UCqi.iIt
IIInII:IUCopLiII:
*Next
IInICI CopLiII:
*FinICopLiIt
I1nICt CopLiII:
tCopLiIt
-..
-..
-+
-..
SHORT:
RxOffIct
R)Oftic:t
r+
419
6.6.7
Layer functions
!AndRectRegion
Syntax:
Description:
Parameters:
Region:
Rectangle:
See Also:
OrRectRegion(),XorRectRegion(),OrRegionRegion()
!AndRegionRegion
Syntax:
Description:
Parameter:
Regionl, Region2:
Regions to be ANDed.
!AttemptLockLayerROm
Syntax:
Description:
This function tries to gain exclusive access right to a layer. If the layer
is unlocked, At temptLoclLayerRom obtains exclusive access.
Parameter:
Layer:
Result:
Status:
420
ABACUS
IClearRectRegion
Syntax:
Status
DO
-522
AD
Al
BOOL
Status;
struct Region
*Region;
struct Rectangle *Rectangle;
Description:
Parameters:
Region:
Rectangle:
See Also:
ClearRegion ()
IClearRegion
Syntax:
Clears a region I
ClearRegion (Region)
-528
AD
Description:
Parameter:
Region:
See Also:
AndRectRegion () , OrRectRegion ()
!copySBitMap
Syntax:
AO
Description:
Parameter:
Layer:
See Also:
SyncSBitMap ()
IDisposeRegion
Syntax:
-534
AD
421
Description:
This function frees the memory for all of the rectangles of the specified
region and frees the region memory itself. It also frees the region that
was previously allocated using NewRegion () .
Parameter:
Region:
See Also:
NewRegion ()
ILockLayerRom
Syntax:
-432
AS
Description:
Parameter:
Layer:
Comments:
See Also:
UnLockLayerRom()
INewRegion
Syntax:
DO
-516
Description:
Result:
Region:
See Also:
OrRectRegion ( ) , DisposeRegion ()
ion
Syntax:
Inserts cli
Status = OrRectRegion (Region, Rectangle)
-510
AO
BOOL
Status;
struct Region
*Region;
struct Rectangle *Rectangle;
422
Al
ABACUS
Description:
This function adds a clipping rectangle to the specified region. After the
RectRegion function inserts the rectangle, it can be manipulated
using AndRectRegion () and XorRectRegion () .
Parameters:
Region:
Rectangle:
Result:
Status:
See Also:
AndRectRegion(),XorRectRegion()
IOrRegionRegion
Syntax:
Description:
Parameter:
Region!, Region2:
Regions to be ORed.
Result:
Status:
See Also:
NewRegion () , Di sposeRegion ()
ISYDCSBitMap
Syntax:
AO
Description:
Parameter:
Layer:
See Also:
CopySBi tMap ( )
423
IUnloekLayerRom
Free layerl
UnlockLayerRom (Layer)
Syntax:
-438
AS
Description:
Parameter:
Layer.
Warning:
Comments:
See Also:
LockLayerRom ( )
XorReetRe ion
Syntax:
ORs eli
Status
DO
-558
AD
Al
Status;
struct Region
*Region;
struct Rectangle *Rectangle;
BOOL
Description:
Parameters:
Region:
Rectangle:
Result:
Status:
See Also:
OrRectRegion(),AndRectRegion()
ion
Syntax:
Description:
424
Al
This function inserts data from Regionl into Region2 if the data
differs between the two regions, and clears the data from Region2 if
the data in Regionl is identical to the data in Region2.
ABACUS
Parameter:
Region I, Region2:
Addresses of the two regions that should be exclusive
oRedo
Result:
Status:
See Also:
OrRegionRegion()
Structures:
Offset
Structure
struct Rectangle <graphics/gfx.h>
{
OxOO
Ox02
0
2
OxOIl
Ox06
II
6
Ox08
SHORT MinX,
MinY;
/* Upper left corner * /
SHORT MaxX,
MaxY;
/* Lower right corner */
struct RegionRectangle <graphics/regions.h>
{
OxOO
OxOIl
0
II
Ox08
OxlO
16
OxOO
Ox08
OxOc
8
12
425
struct Region
struct Rectangle:
bounds
struct Rectangle
SHORT:
MinX
MinY
struct RegionRectangle:
*RegionRectangle
SHORT:
MaxX
MaxY
struct RegionRectangle
....
... struct RegionRectangle:
*Next
*Prev
struct Rectangle:
bounds
426
ABACUS
6.6.8
Character display
IAddFont
.~
Syntax:
AddFont (TextFont)
-480
Al
struct TextFont *TextFont;
Description:
Parameter:
TextFont:
See Also:
RemFont(),OpenFont(),OpenDiskFont()
AskFont
Syntax:
Description:
Parameters:
RastPort:
TextAttr:
See Also:
Set Font ()
IASkSoftStyle
Syntax:
Description:
This function retmns the style(s) in use in the current font. Two style
types exist:
1.
427
2.
Bit patterns of each character are set for normal display (no
italic, etc.).
are defined
in
Parameter:
RastPort:
Result:
FontStyle:
See Also:
SetSoftStyle ()
ICloseFont
Closes font!
Syntax:
CloseFont (TextFont)
-78
Al
struct TextFont *TextFont:
Description:
Parameter:
TextFont:
See Also:
OpenFont ( ) ,AddFont ( )
IOpenFont
Syntax:
Opens fontl
TextFont = OpenFont (TextAttr)
DO
-72
AO
Description:
428
This function opens a font in the system font list. The TextA t t r
structure describes the desired font as closely as possible. This structure
contains the font names (e.g., TextAttr.ta_Name
" Top a z . Fan t "), the size or height (e.g., 9 lines,
TextAttr. ta_YSize = 9) and the text type that the font should
havee.g.,TextAttr.ta_Style = Underlined).
ABACUS
When a font with the given name is found but the height and text type
differ from all of the available fonts, the function opens the font that
most closely matches the description given.
Parameter:
TextAttr:
Result:
TextFont:
See Also:
CloseFont(),AddFont(),RemFont()
IRemFont
Syntax:
-486
Al
Description:
This function removes a font from the system font list. All programs
or tasks that currently have access to the font release their access. If a
task tries to access this font using OpenFont () , the system denies
access.When all tasks indicate that they no longer need the font (using
CloseFont () ), the system frees the memory used by the font.
Parameter:
TextFont:
See Also:
AddFont ()
ISetFont
Syntax:
-66
Al
AD
Description:
This function controls text output after you have opened a font using
OpenFont () or OpenDiskFont () by assigning the new font to
RastPort:
TextFont:
Comments:
See Also:
OpenFont(),CloseFont()
429
ISetSoftStyle
Syntax:
Description:
This function assigns a new text style to the font used by Text () .
Only the text styles whose bits are set in DTextTypes can be
algorithmically generated.
Parameters:
RastPort:
TextType:
DTextType:
Result:
NewTextType:
Text types set by SetSoftStyle () .
See Also:
AskSoftStyle ()
Structures:
Offsets
Structures
struct TextAttr <graphics/text.h>
(
OxOO
Ox04
Ox06
Ox07
Ox08
STRPTR ta Narre;
/* Font narre * /
UWORD ta YSize;
/* Height */
UBYTE ta Style;
/* Text style */
UBYTE ta Flags;
/* Font preference flags */
struct TextFont <graphics/text.h>
(
430
OxOO
Ox14
0
20
Ox16
22
Ox17
23
Ox18
Ox1a
Ox1c
Ox1e
24
26
28
30
Ox20
Ox21
32
33
ABACUS
Code Ox22
Ox26
Ox28
38
40
Ox2c
44
Ox30
48
Ox34
52
34
struct GfxBase
sttuct Ubrary:
UbNode
IIIrUct View:
SlIUct TextAtlr
*ActiView
UWORD:
*LOFLi.st
UWORD:
*SHFList
IIIrUct bItnode:
*b1thd
*bsblttl
struct b1tnode:
*bsblthd
*bsblttl
*SimpIeSPrites
UBYfE:
ta_Flags
SIIUct TextFont
...
UWORD:
tCYSize
UBYIE:
tCStyle
UBYIE:
tCFlags
struct List:
BlitWaitQ
SIl'Ilct SimpIeSprite:
UBYIE:
ty_Style
~
~
UWORD:
ta_YSize
...
UBYIE:
SpiteReserved
struct Tilt:
*BlitOwncr
ta_Name
struct List
*TextForu
sttuct TextFont:
*DefaultFom
S'mPl'R;
APIR:
OaData
~
~
f+
UWORD:
tCModulo
APIR:
tCOta-Loc
AP1R:
tCQwSpace
f.+
APIR:
tCOuI-Kern
r+
431
6.6.9
\AddAnimOb
Syntax:
Description:
Parameters:
AnimOb:
AnimKey:
RastPort:
See Also:
Animate(),DrawGList()
IAddBob
Syntax:
AddBob (Bob,RastPort)
-96
AO,
Al
struct Bob
*Bob;
struct RastPort *RastPort;
Description:
This function adds a bob (Bliller OBject) to the GEL list of a RastPort.
Parameters:
Bob:
RastPort:
See Also:
AddVSprite(),DrawGList()
\AddVSprite
Syntax:
432
ABACUS
Description:
Parameters:
Vsprite:
RastPort:
See Also:
DrawGList ()
IAnimate
Syntax:
Description:
Parameters:
AnimKey:
RastPort:
See Also:
!changeSprite
AddAnimOb ( )
Syntax:
Description:
433
UWORD posctl[2];
UWORD Daten [Height] [2];
UWORD Reserved[2]; 1* = 0,0 */
The data array in this structure which contains the actual twodimensional bit pattern of the sprite has other dimensions
corresponding to the bit pattern. This must be determined by the user.
Parameters:
ViewPort:
Sprite:
SpriteData:
See Also:
GetSprite(),FreeSprite(),MoveSprite()
!DOCollision
Syntax:
DoCollision (RastPort)
-108
A1
struct RastPort *RastPort;
Description:
This function tests for GEL/GEL collisions that automatically call the
respective collision routine. The function should be called following
each gel movement.
GELs (bobs and sprites) must be sorted according to X and Y
coordinates in increasing order (SortGLi st () ).
Parameter:
RastPort:
See Also:
SortGList(),SetCollision()
!DrawGList
Syntax:
Displays GELs!
DrawGList (RastPort, ViewPort)
-114
Al
AO
434
ABACUS
Description:
This routine draws all of the bobs of the given RastPort's GEL list and
creates the Copper lists for vsprite display. The vsprites do not appear
on the screen immediately after DrawGList () ; MakeVPort () ,
MrgCop () and LoadView () must be called after DrawGList () to
display the vsprites. MakeScreen () and RethinkDisplay () are
called for Intuition screens.
Parameters:
RastPort:
ViewPort:
See Also:
IFreeGBurrers
Syntax:
Description:
Parameters:
AnimObject:
See AlSO:
GetGBuffers(),InitGBuffers()
IFreeSprite
Syntax:
FreeSprite (SpriteNumber)
-414
DO
SHORT SpriteNumber;
Description:
Parameter:
SpriteNumber:
Number of the sprite to be freed, as declared in
GetSprite ().
435
Warning:
Do not attempt to free sprites that were not previously declared by you
using GetSprite ().
See Also:
\ GetGBuffers
Syntax:
Description:
This function allocates all of the buffers needed for the bobs of an
animation object. In addition to the SaveBuffer, the BorderLine
and the CollMask (
ImageShadow) functions,
DoubleBuffer == TRUE allocates, double buffering used by the
animation objects.
Parameters:
AnimObject:
Result:
Status:
Comments:
You cannot guarantee that memory locations can be freed from all of
the previously allocated buffers. GetGBuffers() can also be used to
"refresh" memory.
See Also:
FreeGBuffers(),InitGBuffers()
IGetSprite
Allocates spritel
Syntax:
Description:
436
ABACUS
Parameters:
Sprite:
DesSprite:
Result:
SpriteNumber:
Returns the number of the assigned sprite or the value
-1 if the desired sprite or no sprite at all could be
allocated.
Comments:
See Also:
FreeSprite(),ChangeSprite()
IInitAnimate
Initializes AnimKeyl
Syntax:
InitAnimate (AnimKey)
(Macro)
struct AnirrOb *AnimKey;
Description:
Parameter:
AnimKey:
See Also:
AddAnimOb ( )
hnitGels
Syntax:
AO
Al
A2
struct VSprite
*ListStart,
*ListEnd;
struct Gelslnfo *Gelslnfo;
Description:
437
ListStart, ListEnd:
Addresses of the two Vspri te structures that represent
the start and the end of the GEL list These vspri te
structures cannot be used for bobs or vsprites.
GelsInfo:
the Gelslnfo structure to be initialized.
See Also:
SortGList ()
hnitGMasks
Syntax:
InitGMasks (AnimationObject)
-174
AD
struct AnimOb *AnimationObject;
Description:
This function initializes all of the buffers previously allocated for the
bobs of an animation object. A double buffer parameter does not need
to be given here as with GetGBuffers () and FreeGBuffers () ,
because In i t GMa s k s () knows if the animation object or its bobs
require double buffer operation.
Parameter:
AnimOb:
See Also:
InitMasks(),GetGBuffers(),FreeGBuffers()
InitMasks
Syntax:
InitMasks (Vsprite)
-126
AD
struct VSprite *Vsprite;
Description:
438
ABACUS
InitGels ()
IMoveSprite
Moves a spritel
Syntax:
Description:
Parameters:
ViewPort:
Sprite:
x,y:
See Also:
ChangeSprite(),GetSprite()
IRemBob
Syntax:
RemBob (Bob)
(Macro)
struct Bob *Bob;
Description:
Parameter:
Bob:
439
Comments:
See Also:
AddBob()
&=-
BOBSAWAY;)
IRemIBob
Syntax:
Description:
This function removes a bob from the GEL list and the screen.
Removal from the screen is synchronized with the electron beam
location given by the ViewPort.
Parameters:
Bob:
RastPort:
ViewPort:
See Also:
RemBob ()
IRem VSprite
Syntax:
Removes vspritesl
RemVSprite (VSprite)
-138
AD
Description:
This function removes a vsprite from the GEL list and from the screen.
This happens immediately. as with RemIBob () but here you do not
have to give a ViewPort for electron beam synchronization. After
RemVSpri te () the corresponding Copper list is recalculated and the
electron beam synchronization compensates automatically.
Parameter:
VSprite:
See Also:
AddVSpri te ( )
SetCollision
Syntax:
440
ABACUS
Description:
This function inserts a routine that should be called when two GELs
collide, in the corresponding memory Gel sIn f 0 structure
(Gelslnfo. collHandler). After two GELs collide, an AND
combination joins the Hi tMask of one GEL and the MeMask of the
other GEL. The resulting bit indicates the number of the routine (0-15)
to which the program should jump. Routine 0 is always called when a
GEL collides with the border, determined by the variables
Gelslnfo.leftmost/rightmost/topmost/bottommost.
The remaining routines (1-15) specify the addresses of the v s p r i t e
structures in the collided GELs. Only routine 0 (GEUborder collision)
contains a pointer to the vsprite of the GEL, and a flag that designates
with which border the GEL has collided (LEFfHIT, RIGHTHIT,
TOPHIT, BOTIOMHIT-see graphics/collide .h).
Parameters:
Number:
Routine:
GelsInfo:
ISortGList
Syntax:
-150
Al
Description:
This function sorts the entries in the GEL list of the given RastPort.
The GELs are sorted so that those with the smallest Y coordinates are
at the beginning of the list and those with the largest Y coordinates are
at the end of the list If some GELS have matching Y coordinates, the
X coordinate is the deciding factor, and the X coordinates are also sorted
in increasing order. This sorting maintains optimum speed in accessing
hardware sprites for vsprite generation. The advantage to bobs is that
fewer bobs can be drawn before the electron beam, minimizing
flickering. The drawing is done from DrawGList () .
Parameter:
RastPort:
See Also:
DrawGList ()
Structures:
Offset
Structures
Oxoo
Ox04
0
4
Ox08
441
6.
Ox1c
12
OxiO
Ox12
16
18
Ox14
Ox16
Ox18
20
22
24
Ox1a
26
Ox1c
28
Ox1e
30
Ox20
Ox22
32
34
Ox26
38
Ox2a
Ox2e
42
46
Ox32
Ox36
50
54
Ox37
Ox38
56
57
Ox3a
58
OxOO
Ox02
0
2
Ox06
OxOa
OxOe
10
14
Ox12
18
Ox16
22
Ox1a
26
Ox1e
30
WORD Flags;
WORD *SaveBuffer;
/* Address of background memory * /
WORD *ImageShadow;
/* OR all of the planes */
struct Bob *Before;
struct Bob *After;
/* Previously set character order */
struct VSprite *BobVSprite;
/* Address of the BobVSprite */
struct AnirrComp *BobComp;
/* Animation component addresses of Bob
sequence in an AnirrComp* /
struct DBuffPacket *DBuffer;
/* For use in DoubleBuffer BitMaps */
BUserStuff BUserExt;
/* User-defined */
struct DBufpacket <graphics/gels.h>
{
442
OxOO
Ox02
Ox04
Ox08
WORD BufY,
BufX;
/* Background position in second bit-map */
struct VSprite *Bufpath;
WORD *BufBuffer;
/* Address of background memory * /
ABACUS
OxOc
12
struct AnimComp <graphics/ge1s.h>
OxOO
Ox02
Ox04
Ox06
OxOa
0
2
4
6
10
OxOe
Ox12
14
18
Ox14
22
Ox1a
Ox1c
26
28
Ox1e
30
Ox22
34
Ox26
38
WORD Flags;
WORD Timer;
WORD TimeSet;
struct AnimComp *NextComp;
struct AnimComp *PrevComp;
/* For component linking */
struct AnimComp *NextSeq;
struct AnimComp *PrevSeq;
/* For linking sequences */
WORD (*AnimCRoutine) ();
/* Routine to be called */
WORD XTrans;
WORD YTrans;
/* Speed */
struct AnimOb *HeadOb;
/* Interface to AnimObject */
struct Bob *AnimBob;
/* Bob address */
struct AnimOb <graphics/gels.h>
{
OxOO
Ox04
0
4
Ox08
OxOc
OxOe
8
12
14
Ox10
Ox12
16
18
Ox14
Ox16
20
22
Ox18
Ox1a
24
26
Ox1c
Ox1e
28
30
Ox20
32
Ox24
36
Ox28
40
OxOO
Ox04
Ox06
Ox08
6
8
UWORD *posctldata;
/* Address of the sprite data */
UWORD height;
/* Height */
UWORD x,
y;
/* Position */
443
OxOa
10
OxOc
12
UWORD num;
/* Number of the sprite */
struct Geslslnfo <graphics/rastport.h>
(
OxOO
Ox01
Ox02
Ox06
1
2
6
OxOa
OxOe
10
14
Ox12
18
Ox16
Ox18
Oxla
OxIc
22
24
26
28
OxIc
Ox22
Ox26
30
34
38
UBYTE SprRsrvd;
/* Reserved sprites */
UBYTE Flags;
struct VSprite *geIHead,
*geITail;
/* Beginning and end of GEL List */
WORD *nextLine;
WORD **lastColor;
/* VSprite colors presented last */
struct collTable *coIIHandler;
/* Collision Handler */
short leftmost,
rightmost,
topmost,
bottommost;
/* Rectangle for border collision */
APTR firstBlissObj,
lastBlissObj;
struct ColI Table <graphics/gels.h>
(
444
OxOO
Ox40
64
ABACUS
SlIuct VSpite
SlIuct AnimComp
s1IuctBob
sIruct VSPrite:
*NextVS{rite
.. ...
WORD:
Flags
SInJct VSprite:
*PrevVSprite
WORD:
*SaveBuffer
WORD:
Tuner
WORD:
*ImageShadow
WORD:
TimeSet
SlructBob:
*Before
struct AnimComp:
*NextComp
struct AnimComp:
*PrevComp
WORD:
adY
0IdX
WORD:
Flags
slructBob:
*After
...
struct VSprite:
*BobVS{rite
struct AnimComp:
*NextSeq
SInJct AnimComp:
*BobComp
.......
struct AnimComp:
*PrevSeq
struct DBufPacket:
*DBuffer
WORD:
(*AnimCRoutine) (
WORD:
Y
X
WORD:
Heigbl
WORD:
WidIh
WORD:
WORD:
Flags
Deph
WORD:
XTrans
WORD:
MeMask
sIJuct AnimOb
WORD:
HitMask
WORD:
*ImageData
WORD:
*BorderLine
WORD:
CoIIMa*
WORD:
*SprColors
structBob:
*VSBob
BYl'E:
PlaDePick
BYl'E:
PIaneOnOff
...
....
..
struct AnimOb:
*NextOb
struct AnimOb:
*PrevQb
...
...
WORD:
YTrans
SIIUcl AnimOb:
*HeadQb
....
sIJuct Bob:
*AnimBob
-~
LONG:
Clock
... j
j
WORD:
WORD:
BufY
BufX
AnY
AnX
WORD:
YVel
XVel
struct VSprite:
*BufPath
WORD:
YAluJ
XAa:eI
WORD:
(*AnimORoutine) (
struct AnimComp:
*HeadComp
struct DBufPacket
...
WORD:
*BufBuffer
. . .1
....
..
445
6.7
AvailFonts
DisposeFontContents
NewFontContents
OpenDiskFont
IAvailFonts
Syntax:
DO
-36
AO
DO
01
LONG Error;
UBYTE *Buffer;
LONG Length;
LONG Type;
Description:
This function fills a data buffer with information about the fonts
available on disk or in memory. Disk fonts must be loaded using the
OpenDiskFont function, while fonts in memory can be opened with
the OpenFont function (graphics library).
Parameters:
Buffer:
Length:
Type:
Result:
446
Error:
ABACUS
Comments:
See Also:
FontsContents structure
IDisposeFontContents
Syntax:
Frees FontsContentsHeaderl
DisposeFontContents (FontContentsHeader)
-48
Description:
Al
Parameter:
FontContentsHeader:
Pointer to the FontContentsHeader structure
returned by the NewFontsContents function.
Warning:
crash.
See Also:
NewFontContents
INewFontContents
Syntax:
FontContentsHeader = NewFontContents(FontsLock,FontName)
DO
-42
AD
Al
Description:
Parameters:
FontsLock:
FontName:
Result:
FontContentsHeader:
Pointer to the FontContentsHeader structure.
Exceptions:
447
See Also:
DisposeFontContents
IOpeaDiskFont
Syntax:
Description:
This function loads the font described by the TextAt t r structure from
disk and returns a pointer to this font. When the font is no longer
needed, call the CloseFont function to save memory. If the font
already exists in memory, the system returns a pointer without loading
the font a second time.
Parameter:
TextAttr:
Result:
CharSet:
Exceptions:
See Also:
CloseFont,SetFont
Structures:
1*
UWORD fch_FileID;
UWORD fch_NumEntries;
1* FCH_ID *1
1* Number of entries *1
};
OxOOO
OxlOO
Ox102
Ox103
Ox104
0
256
258
259
260
char
UWORD
UBYTE
UBYTE
fc_FileName[MAXFONTPATH);
fc YSize; 1* Font height *1
fc=Style; 1* Text type *1
fc_Flags; 1* Font type *1
};
MAXFONTPATH 256
1* Inclusive null byte *1
FCH ID
OxOfOO
struct AvailFontsHeader <libraries/diskfont.h>
{
OxOO 0
Ox022
1*
AvailFonts afh_AF[); *1
};
OxOO 0
Ox02 2
OxOA 10
};
448
UWORD af_Type;
1* MEMORY or DISK *1
struct
TextAttr af_Attr;
ABACUS
Type (af_Type):
AFF MEMORY 1
AFF DISK
2
struct TextAttr <graphics/text.h>
{
OxOO
Ox04
Ox06
Ox07
Ox08
0
4
6
7
8
STRPTR
{)WORD
UBYTE
UBYTE
ta_Name;
ta YSize;
ta::::Style;
ta_Flags;
/* Font height */
/* Text style */
/* Font type */
};
(13)
(12)
(11)
(10)
OxOO
Ox14
Ox16
Ox17
Ox18
Ox1A
Ox1C
OxlE
Ox20
Ox21
Ox22
Ox26
Ox28
Ox2C
Ox30
Ox34
o
20
22
23
24
26
28
30
32
33
34
38
40
44
48
52
};
449
6.8
6.8.1
450
6.8
ABACUS
SPAbs
SPAdd
SPCmp
SPDiv
SPFix
SPFlt
SPMul
SPNeg
SPSub
SPTst
FFP
Absolute valuel
ISPAbs
Syntax:
result = SPAbs(value)
DO
-54
DO
FLOAT result;
FLOAT value;
Description:
Z
V
C
X
= 1, if result = 0
= 0
= not defined
= not defined
Additionl
ISPAdd
Syntax:
result = SPAdd(value1,value2)
DO
-66
01
DO
FLOAT result;
FLOAT value1,value2;
Description:
1 if result < 0
1 if result = 0
1 if overflow
not defined
not defined
451
ISPcmp
Syntax:
result = SPCmp(valuel,value2)
DO
-42
01
DO
LONG result;
FLOAT value1,value2;
Description:
value2
value2
value2
value2
value2
value2
> value1
>= value1
= value1
<> value1
< value1
<= value1
ISPDiv
Divisionl
Syntax:
result = SPDiv(value1,value2)
DO
-84
01
DO
FLOAT result;
FLOAT value1,value2;
Description:
=
=
=
=
=
1 if result < 0
1 if result = 0
1 if overflow
not defined
not defined
ISPFix
Syntax:
result = SPFix(value)
DO
-30
DO
LONG result;
FLOAT value;
Description:
452
<0
= if result = 0
= 1 if result
= if overflow
= not defined
= not defined
ABACUS
ISPFIt
Syntax:
result = SPFlt(value)
DO
-36
DO
FLOAT result;
LONG value;
Description:
1 if result < 0
1 if result = 0
0
not defined
not defined
!SPMul
Syntax:
Multiplication!
result = SPMul(valuel,value2)
DO
-78
Dl
DO
FLOAT result;
FLOAT valuel,value2;
Description:
1 if result < 0
if result = 0
if overflow
not defined
not defined
!SPNeg
Syntax:
result = SPNeg(value)
DO
-60
DO
FLOAT result;
FLOAT value;
Description:
value:~
result
-value.
1 if result < 0
if result = 0
0
not defined
not defined
453
6.
Subtractionl
ISPSub
Syntax:
result = SPSub(valuel,value2)
00
-72
01
DO
FLOAT result;
FLOAT valuel,value2;
Description:
result
value2 -
valuel.
ISPTst
Syntax:
result = SPTst(value)
00
-48
01
LONG result;
FLOAT value:
Description:
C = not defined
X = not defined
Formatl
Syntax:
31 23 15 7
Meaning:
M = 24-bit mantissa
S = sign
E = 7-bit exponent
454
10~lB
10~IB
ABACUS
6.8.2
* 2"'3F
SPAcos
SPAsin
SPAtan
speos
SPCosh
SPExp
SPFieee
SPLog
SPLoglO
SPPow
SPSin
SPSincos
SPSinh
SPSqrt
SPTan
SPTanh
SPTieee
FFP
460
460
460
461
461
Calculates arccosinel
ISPACOS
Syntax:
result = SPAcos(value)
-120
DO
DO
FLOAT result;
FLOAT value;
Description:
Z = if result
V= 0
=0
455
6.
C = not defined
X = not defined
ISPAsin
Calculates arcsinel
Syntax:
result = SPAsin(value)
DO
-114
DO
FLOAT result;
FLOAT value;
Description:
N
V
C = not defined
X = not defined
ISPAtan
Calculates arctangent!
Syntax:
result = SPAtan(value)
DO
-30
DO
FLOAT result;
FLOAT value;
Description:
IsPCos
Calculates cosinel
Syntax:
result = SPCos(value)
DO
-42
DO
FLOAT result;
FLOAT value;
Description:
1 if result < 0
Z = 1 i f result
0
V = 1 if value is too large
C =
not defined
X = not defined
456
ABACUS
ISPCOSh
Syntax:
result = SPCosh(value)
DO
-66
DO
FLOAT result;
FLOAT value;
Description:
1 if result < 0
1 if result = 0
1 if overflow
not defined
not defined
\SPExp
Syntax:
result = SPExp(value)
DO
-78
DO
FLOAT result;
FLOAT value;
Description:
Z = 1 if result = 0
V = 1 if overflow
C = not defined
X = not defined
\SpFieee
Syntax:
result = SPFieee(value)
DO
-108
DO
FLOAT result;
FLOAT value; /* IEEE standard format */
Description:
=
=
=
=
=
not defined
1 if result = 0
1 if overflow
not defined
not defined
457
ISPLog
Syntax:
result = SPLog(value)
DO
-84
DO
FLOAT result;
FLOAT value;
Description:
= 1 if result < 0
= 1 if result = 0
= 1 if value <= 0
= not defined
= not defined
ISPLogI0
Syntax:
result = SPLog10(value)
DO
-126
DO
FLOAT result;
FLOAT value;
Description:
Isppow
Syntax:
result = SPPow(value1,value2)
DO
-90
DO
D1
FLOAT result;
FLOAT value1,value2;
Description:
458
ABACUS
ISPSin
Calculates sinel
Syntax:
result = SPSin(value)
DO
-36
DO
FLOAT result;
FLOAT value;
Description:
1 if result < 0
1 if result = 0
1 if value is too large
not defined
not defined
ISPSincos
Syntax:
result = SPSincos(value,adr_c)
DO
-54
DO
D1
FLOAT result;
FLOAT value,*adr_c;
Description:
Calculates the sine and cosine of val ue. Returns the sine immediately
and saves the cosine in the variable to which adr_ c points.
= 1 if result < 0
= 1 if result = 0
= 1 if value is too large
= not defined
= not defined
ISPSinh
Syntax:
result = SPSinh(value)
DO
-60
DO
FLOAT result;
FLOAT value;
Description:
1 if result < 0
1 if result = 0
1 if overflow
not defined
not defined
459
!SPSqrt
Syntax:
result = SPSqrt(value)
DO
-96
DO
FLOAT result;
FLOAT value;
Description:
Z
V
C
X
= 1 if result = 0
=
1 if value < 0
= not defined
= not defined
!SPTan
Tangent!
Syntax:
result = SPTan(value)
DO
-48
DO
FLOAT result;
FLOAT value;
Description:
=
=
=
=
=
1 if result < 0
1 if result = 0
1 if cos (value)
not defined
not defined
!SPTanh
Syntax:
result = SPTanh(value)
DO
-72
DO
FLOAT result;
FLOAT value;
Description:
460
=
=
=
=
=
1 if result < 0
1 if result = 0
1 if overflow
not defined
not defined
ABACUS
ISPTieee
Syntax:
result = SPTieee(value)
DO
-102
DO
FLOAT result; /* Standard IEEE format */
FLOAT value;
Description:
Z = 1 if result
V = not defined
C = not defined
X = not defined
=0
Format!
Syntax:
Meaning:
M = 24 bit mantissa
S - sign
E = 7 bit exponent
* 10 A1B
* 10 A1B
461
6.8.3
hEEEDPAbS
463
463
464
464
464
464
465
465
465
466
Absolute valuel
Syntax:
result = IEEEDPAbs(value)
DO/Dl
-54
DO/Dl
DOUBLE result;
DOUBLE value;
Description:
1 if result = 0
=0
C = not defined
X = not defined
Z
462
462
463
ABACUS
IIEEEDPAdd
Additionl
Syntax:
result = IEEEDPAdd(value1,value2)
00/01
-66
00/01
02/03
Description:
1 if result < 0
1 if result = 0
1 if overflow
not defined
not defined
IIEEEDPCeil
Syntax:
result = IEEEDPCeil(value)
00/01
-96
00/01
DOUBLE result;
DOUBLE value;
Description:
IIEEEDPCmp
Comparisonl
Syntax:
result = IEEEOPCmp(value1,value2)
DO
-42
00/01 02/03
LONG result;
DOUBLE value1,value2;
Description:
if
if
if
if
if
if
463
6.
Divisionl
hEEEDPDiv
Syntax:
result = lEEEOPOiv(value1,value2)
00/01
-84
00/01 02/03
DOUBLE result;
DOUBLE value1,value2;
Description:
Z
V
C
X
= 1 if result = 0
= 1 if overflow
= not defined
= not defined
hEEEDPFix
Syntax:
result = IEEEOPFix(value)
DO
-30
00/01
LONG result;
DOUBLE value;
Description:
1 if result < 0
1 if result = 0
1 if overflow
not defined
X = not defined
N
Z
hEEEDPFloor
Syntax:
Description:
464
ABACUS
Description:
1 if result < 0
1 if result = 0
0
not defined
not defined
hEEEDPMul
Multiplicationl
Syntax:
result = lEEEOPMul(value1,value2)
00/01
-78
00/01 02/03
DOUBLE result;
DOUBLE value1,value2;
Description:
1 if result < 0
1 if result = 0
1 if overflow
not defined
not defined
IIEEEDPNeg
Syntax:
result = IEEEOPNeg(value)
00/01
-60
DO/D1
DOUBLE result;
OOUBLE value;
Description:
-value.
1 if result < 0
1 if result = 0
0
not defined
not defined
hEEEDPSub
Subtractionl
Syntax:
result = lEEEOPSub(value1,value2)
00/01
-72
00/01 02/03
DOUBLE result;
DOUBLE value1,va1ue2;
Description:
valuel
465
a
a
hEEEDPTst
Syntax:
result = IEEEOPTst(value)
DO
-48
00/01
LONG result;
DOUBLE value;
Description:
if value = a
-1 i f value < a
v= a
a
a
C = not defined
X = not defined
Sb'Uctures:
MathlEEE.resource:
struct MathlEEE =
{
OxOO
OxOE
Ox10
Ox14
Ox18
OxIC
Ox20
Ox24
}
466
a
14
16
20
24
28
32
36
struct
UWORD
ULONG
ULONG
ULONG
ULONG
ULONG
6.8
ABACUS
6.8.4
MathTrans library
IEEEDPAcos
IEEEDPAsin
IEEEDPAtan
IEEEDPCos
IEEEDPCosh
IEEEDPExp
IEEEDPFieee
IEEEDPLog
IEEEDPLoglO
IEEEDPPow
IEEEDPSin
IEEEDPSincos
IEEEDPSinh
IEEEDPSqrt
IEEEDPTan
IEEEDPTanh
IEEEDPTieee
467
468
468
468
468
468
468
469
469
469
469
469
470
470
470
470
471
Arccosinel
IIEEEDPACOS
Syntax:
result = IEEEDPAcos(value)
00/01
-120
00/01
DOUBIE resul t;
DOUBIE value;
Description:
467
6.
Arcsinel
hEEEDPAsin
Syntax:
result = IEEEOPAsin(value)
00/01
-114
00/01
DOUBLE result;
DOUBLE value;
Description:
hEEEDPAtan
Arctangent!
Syntax:
result = IEEEOPAtan(value)
00/01
-30
00/01
DOUBLE result;
DOUBLE value;
Description:
hEEEDPCOS
Cosinel
Syntax:
result = IEEEDPCos(value)
00/01
-42
00/01
DOUBLE result;
DOUBLE value;
Description:
hEEEDPCOSh
Hyperbolic cosinel
Syntax:
result = IEEEOPCosh(value)
00/01
-66
00/01
DOUBLE result;
DOUBLE value;
Description:
IIEEEDPExp
Syntax:
result = IEEEOPExp(value)
00/01
-78
00/01
DOUBLE result;
DOUBLE value;
Description:
hEEEDPFieee
Syntax:
468
ABACUS
Description:
hEEEDPLog
Natural logarithml
Syntax:
result = IEEEDPLog(value)
00/01
-84
00/01
DOUBLE result;
DOUBLE value;
Description:
hEEEDPLoglO
Base 10 logarithm
Syntax:
Description:
hEEEDPPow
x to the y power!
Syntax:
result = IEEEDPPow(value2,value1)
00/01
-90
02/03 00/01
DOUBLE result;
DOUBLE value1,value2;
Description:
!IEEEDPSin
Sine!
Syntax:
result = IEEEDPSin(value)
00/01
-36
DO/D1
DOUBLE result:
DOUBLE value;
Description:
hEEEDPSincos
Syntax:
result = IEEEDPSincos(adr_c,value)
00/01
-54
AD 00/01
DOUBLE result;
DOUBLE value,*adr_c;
Description:
Calculates the sine and cosine of val ue. The sine returns immediately
and the cosine is saved in the variable to which adr_ c points.
469
6.
Hyperbolic sinel
hEEEDPSinb
Syntax:
result = IEEEOPSinh(value)
00/01
-60
00/01
DOUBLE result;
DOUBLE value;
Description:
hEEEDPSqrt
Syntax:
Square root!
result = IEEEOPSqrt(value)
00/01
-96
00/01
DOUBLE re suI t;
DOUBLE value;
Description:
hEEEDPTan
Syntax:
Tangent!
result = IEEEOPTan(value)
00/01
-48
00/01
DOUBLE result;
DOUBLE value;
Description:
IIEEEDPTanh
Syntax:
Hyperbolic tangent!
result = IEEEOPTanh(value)
00/01
-72
00/01
DOUBLE result;
DOUBLE value;
Description:
470
6.8
ABACUS
hEEEDPTieee
Syntax:
result = IEEEOPTieee(value)
DO
-102
00/01
FLOAT result; 1* Single precision IEEE format *1
DOUBLE value;
Description:
Structures:
MathIEEE.resource:
struct MathIEEE =
(
OxOO
OxOE
Ox10
Ox14
Ox18
Ox1C
Ox20
0
14
16
20
24
28
32
struct
UWORD
ULONG
ULONG
ULONG
ULONG
ULONG
471
6.9
AlIocPotBits
FreePotBits
WritePotgo
IAlIocPotBits
Syntax:
-6
DO
LONG Reserved;
LONG Bits;
Description:
This function reserves bits in the Potgo register. You must request
access to this register ($DFF034) before accessing the register because
of the Amiga's multitasking capability. You can reserve any bits, but
after the function call you must examine the bits to see if you can
reserve them at that time.
Parameters:
Bits:
START
DAlLX
OUlLX
DAlLY:
OUlLY:
DATRX:
OUTRX:
DA1RY:
OUI'RY:
Result:
472
Reserved:
ABACUS
Comments:
When you have reserved bits of the Potgo register with this function,
you must free these again with FreePotBits once you no longer
need them, or the bits will be suppressed until the next reset
See Also:
FreePotBits
IFreepotBits
Syntax:
FreePotBits (Reserved)
-12
DO
LONG Reserved;
Description:
Parameter:
Reserved:
See Also:
AllocPotBits
IWritePotGo
Syntax:
Description:
This function writes the specified bits in the Potgo register. It only
changes the bits that are set in the mask. You should only specify bits
which are actually reserved.
Parameters:
wont:
Mask:
473
6.10
Translate
Syntax:
Error = Translate(Sentence,Length,Buffer,BufLength)
DO
-30
AO
DO
Al
Dl
LONG Error;
UBYTE *Sentence;
LONG Length;
UBYTE *Buffer;
LONG BufLength;
Description:
Parameters:
Sentence:
Length:
Buffer:
buflength:
Result:
474
6.11
ABACUS
6.11
Some include files may not contain comments, since the manufacturer
may have stripped the comments to save memory. Only non-stripped
include files will contain commentary.
476
476
477
477
478
478
479
479
480
480
481
481
481
482
483
483
484
484
484
485
475
6.
IAdd ConfigDev
Syntax:
AddConfigDev(configDev)
-30
AO
struct ConfigDev *configDev;
Description:
Parameter:
configDev:
See Also:
RemConfigDev
IAddDosNode
Syntax:
ok = AddDosNode(bootPri,flags,deviceNode)
DO
-150
DO
D1
AO
BOOL ok;
BYTE bootPri;
LONG flags;
struct DeviceNode *deviceNode;
Description:
This function adds a disk drive driver to the system. If DOS was already
initialized, the function adds the driver immediately. Otherwise, the
system initializes DOS then adds the driver.
Parameter:
bootpri:
deviceNode:
Result:
ok:
Comments:
+5
-5
-128
flags:
476
6.11
ABACUS
Warning:
Because the Aztec C compiler expects long values on the stack, you
must convert bootpri to a long value.
The task to which the device node belongs is a DOS task and not an
Exec task. A DOS task is similar to a process, like it can create from
the DOS functions.
Example:
The following lines connect a bootable drive in the system and start the
driver process immediately:
AddDosNode(O,ADNF_STARTPROC,MakeDosNode(paramPacket;
See Also:
MakeDosNode
!AllocBoardMem
Syntax:
Description:
Parameter:
slotSpec:
Result:
startSlot:
Exceptions:
Comments:
Example:
See Also:
!AllocConfigDev
Syntax:
configDev = AllocConfigDev ()
DO
-48
struct ConfigDev *configDev;
Description:
Result:
configDev:
See Also:
FreeConfigDev
477
IAllocExpansionMem
Syntax:
startSlot = AllocExpansionMem(numSlots,slotOffset)
DO
-!l4
DO
01
APTR ptr;
LONG startSlot;
LONG numSlots,slotOffset;
Description:
Pammeters:
numSlots:
slotOffset.:
Result:
startS lot:
Comments:
Example:
AllocExpansionMem(2,0);
Gets two slots, where the number of the startS lot parameter must be an
even address.
AllocExpansionMem(64,32);
limit.
See Also:
IConfigBoard
Syntax:
Configures expansionl
Error
ConfigBoard(board,configDev)
-60
AD
A1
LONG Error;
LONG board;
struct ConfigDev *configDev;
=
DO
Description:
478
This function configures the expansion card. This card is usually at the
address E_EXPANSIONBASE, which can be changed on later model
Amigas so that the address can be given as a parameter.
ConfigBoard uses expansion memory, places the card there, and
moves the ConfidDev structure to the newest location.
6.11
ABACUS
Parameters:
board:
configDev:
Result:
See Also:
FreeConfigDev
IConfigChain
Syntax:
ConfigChain(baseAdr)
DO
-66
AD
LONG Error;
LONG baseAdr;
Description:
Parameter:
hlseAdr:
Result:
error:
See Also:
FreeConfigDev
IFindConfigDev
Syntax:
FindConfigDev(oldConfigDev,manufacturer,product)
DO
-72
AD
DO
01
Description:
Parameters:
oldConfigDev:
ConfigDev search process. If this parameter equals
zero, the ConfigDev structure should be searched for
from the beginning; otherwise it should search from the
element following oldConfigDev structure in the
list.
manufacturer: Manufacturer ID that should be searched for, or -1 if no
particular manufacturer should be searched for.
pnxluct
Product ID that should be searched for, or -1 if no
particular product should be searched for.
Result:
configDev:
479
Example:
!FreeBoardMem
Syntax:
*/
DO
Dl
LONG startSlot,slotSpec;
Description:
This function frees the memory from the expansion board previously
allocated using the AllocBoardMem function.
Parameters:
startS lot:
slotSpec:
Warning:
Example:
FreeBoardMem(startSlot,slotSpec);
See Also:
AllocExpansionMem, FreeExpansionMem,
AllocBoardMem
!FreeConfigDev
Syntax:
AO
Description:
Parameters:
congifDev:
See Also:
AllocConfigDev
480
6.11
ABACUS
ansionMem
Syntax:
FreeExpansionMem (startSlot,numSlots)
-90
DO
01
LONG startSlot,numS1ots;
Description:
Parameters:
startS lot:
numSlots:
Warning:
See Also:
AllocExpansiOnMem
Starting slot.
Number of slots.
GetCurren tBindin
Syntax:
-138
AD
DO
UWORD number;
struct CurrentBinding *currentBinding;
UWORD size;
Description:
Parameters:
currentBinding:
size:
Result:
number:
See Also:
SetCurrentBinding
IMakeDosNode
Syntax:
-144
AO
Description:
This function creates all of the data structures necessary to add a drive to
the system. These structures consist of a DeviceNode, a disk
environment vector, a FileSysStartupMsg and up to two BCPL
strings. The include files <libraries/dosextens. h> and
<libraries/filehandler. h> contain further information.
MakesDosNode allocates the necessary memory and links the
different SbUctures together.
481
Parameters:
parameterPkt:
Parameter block containing the information needed for
creating structures. The parameter block consists of
long words of variable length:
0= Pointer to string with the name of the DOS driver.
4 = Pointer to string with the name of the Exec driver.
8 = Number of the unit for OpenDevice.
12 =Flags for OpenDevice.
16 = Number of long words that follow.
20 =Additional information.
Returns a pointer to the DeviceNode structure, or a
value of zero if insufficient memory exists.
Result:
deviceNode:
Example:
The following program section adds a 3.5" disk drive to the system as
DF1:
char execName[] = "trackdisk.device";
char dosName[] = "dfl";
ULONG parmPkt [ ]
{
(ULONG) dosName,
(ULONG) execNarne,
1,
f* Drive number *f
f* Flags for OpenDevice *f
f* now the additional information follows *f
f* 11 additional long words *f
11,
512 2,
f* long words per block *f
0,
f* Sector Start, unused *f
0,
2,
/* Number of sides */
1,
11,
2,
0,
0,
0,
79,
5
};
See Also:
AddDosNode
IObtainConfigBinding
Syntax:
ObtainConfigBinding ()
-120
Description:
This function must be called before adding a driver to the Con f igDev
structure, if you wish to add the driver using means other than the CLI
BindDrivers command. The ObtainConfigBinding function
ensures that no other programs want to add drivers at the same time.
482
ABACUS
See Also:
ReleaseConfigBinding
IReadExpansionByte
Syntax:
Byte = ReadExpansionByte(Board,Offset)
DO
-96
AO
DO
BYTE Byte;
LONG Board,Offset;
Description:
This function reads a byte from a new expansion card. New expansion
card data is read from memory nibble by nibble.
Parameters:
B<ml:
Offset
Result:
Byte:
Comments:
Example:
type = ReadExpansionByte(od->BoardAddr,EROFFSET(er_Type:
ints =
ReadExpansionByte(cd->BoardAddr,ECOFFSET(ec_Interrupt;
See Also:
ReadExpansionRom,WriteExpansionByte
IReadExpansionRom
Syntax:
Error = ReadExpansionRom(board,configDev)
DO
-102
AD
A1
LONG Error:
LONG board;
struct ConfigDev *configDev;
Description:
Parameters:
board:
coofigDev:
Result:
error:
483
configDev = AllocConfigDev():
if (!configDev) Error();
Error = ReaJExpansionRom(board,configDev);
if (!Error)
Example:
See AlSO:
ReadExpansionByte, WriteExpansionByte
ReleaseConfi
Syntax:
ReleaseConfigBinding ()
-126
Description:
See Also:
ObtainConfigBinding
Dev
Syntax:
RemConfigDev(configDev)
-108
AD
struct ConfigDev *configDev:
Description:
This function removes the given ConfigDev structure from the list
of all of the Conf igDev structures.
Parameter:
configDev:
See Also:
AddConfigDev
SetCurrentBindin
Sets conti
Syntax:
Description:
Parameters:
cunentBinding:
number:
See Also:
484
GetCurrentBinding
6.11
ABACUS
IWriteExpansionB yte
Syntax:
Error = WriteExpansionByte(board,offset,byte)
DO
-114
AD
DO
D1
LONG Error;
LONG board, offset;
BYTE byte;
Description:
Parameters:
Boa:d:
Offset:
Result:
Byte:
Warning:
Because the Aztec C compiler requires long values on the stack, you
must convert the byte to a long word.
Example:
Error = WriteExpansionByt
(cd->BoardAddr,ECOFFSET(ec Shutup), (LONG)O);
Error = WriteExpansionByte
(cd->BoardAddr,ECOFFSET(ec_Interrupt),lL);
See AlSO:
ReadExpansionByte,ReadExpansionRom
Structures:
Global sizes:
E SLOTSIZE
E_EXPANSIONBASE
E EXPANSIONSIZE
E EXPANSIONSLOTS
E MEMORYBASE
E MEMORYSIZE
E MEMORYSLOTS
Ox10000
Oxe80000
Ox080000
8
Ox200000
Ox800000
128
OxOO
Ox01
Ox02
Ox03
Ox04
Ox06
OxOA
OxOC
OxOD
OxOE
Ox OF
Ox10
I;
0 UBYTE
1 UBYTE
2 UBYTE
3 UBYTE
4 UWORD
6 ULONG
10 awORD
12 UBYTE
13 UBYTE
14 UBYTE
15 UBYTE
16
er_Type;
er Product;
er::::Flags;
er_Reserved03;
er_Manufacturer;
er SerialNumber;
er::::lnitDiagVec;
er ReservedOc;
er::::ReservedOd;
er ReservedOe;
er::::ReservedOf;
485
6.
Types (er_Type):
ERT TYFEMASK
ERT NEWBOARD
ERT MEMMASK
ERTF CHAINEDCONFIG
ERTF DIAGVALID
ERTF MEMLIST
Flags (er_Flags):
ERFF MEMSPACE
ERFF NOSHUTUP
OxeO
OxeO
Ox07
(13)
(14)
(15)
(17)
(16)
OxOO
Ox01
Ox02
Ox03
Ox04
Ox05
Ox06
Ox07
Ox08
Ox09
OxOA
OxOB
OxOC
OxOD
OxOE
OxOF
Ox10
o
1
2
3
4
6
7
8
9
10
11
12
13
14
15
16
UBYTE
UBYTE
UBYTE
UBYTE
UBYTE
UBYTE
UBYTE
UBYTE
UBYTE
UBYTE
UBYTE
UBYTE
UBYTE
UBYTE
UBYTE
UBYTE
ee Interrupt;
ee-Reserved11;
ee=BaseAddress;
ec Shut up;
ec=ReservedI4;
ec Reservedl5;
ec-Reserved16;
ec- Reserved1 7;
ec=ReservedI8;
ec Reservedl9;
ec-Reservedla;
ec-Reserved1b;
ee-Reserved1c;
ec-Reservedld;
ec-Reservedle;
ec=Reserved1f;
);
(11)
(13)
(14)
(15)
(16)
(17)
OxOO
OxOE
OxOF
Ox10
Ox20
Ox24
Ox28
Ox2A
Ox2C
Ox30
Ox34
Ox44
);
486
0
14
15
16
32
36
40
42
44
48
52
68
struet Node
UBYTE
UBYTE
struct ExpansionRom
APTR
APTR
UWORD
UWORD
APTR
struct ConfigDev *
ULONG
cd Node;
cd~)lags;
cd Pad;
cd=Rom;
cd BoardAddr;
cd=BoardSize;
cd_SlotAddr;
cd_Slot Size;
cd_Driver;
cd_NextCD;
cd_Unused [ 4];
ABACUS
Flags (cd_Flags):
COF SHUTUP
COF CONFIGME
Ox01
Ox02
OxOO 0
Ox04 4
Ox08 8
OxOC 12
Ox10 16
};
OxOO 0 ULONG
Ox04 4 BSTR
Ox08 8 BPTR
OxOC 12 ULONG
Ox10 16
fssm_Unit;
fssm Device;
fssm::::Environ;
fssm_Flags;
};
OxOO
Ox04
Ox08
OxOC
Ox10
Ox14
Ox18
Ox1e
Ox20
Ox24
Ox28
Ox2e
0 BPTR
dn Next;
4 ULONG
dn::::Type;
8 struct MsgPort *dn Task;
12 BPTR
dn::::Lock;
16 BSTR
dn Handler;
20 ULONG
dn::::StackSize;
dn Priority;
24 LONG
28 BPTR
dn::::Startup;
32 BPTR
dn SegList;
36 BPTR
dn::::GlobaIVec;
40 BSTR
dn_Name;
44
};
487
6.12
Structures:
struct RomBootBase
{
Oxoo
Ox22
Ox26
Ox34
Ox3B
0
34
3B
52
56
struct Library
LibNode;
struct Execbase *ExecBase;
struct List
BootList;
ULONG
Reserved [4] ;
);
struct BootNode
{
OxOO 0
OxOE 14
Ox10 16
Ox14 20
};
488
ABACUS
6.13
6.13
ICDlnputHandler
489
489
Syntax:
CDInputHandler (events,ConsoleDevice)
-42
AO
Al
struct Events *events;
struct Device *ConsoleDevice;
Description:
This function receives input (nonnally from the input. task ROM)
and sends this information to the console device.
Parameters:
events:
Pointer to list of events.
ConsoleDevice:
Pointer to console device.
Comments:
This function is listed here for historical purposes only. and should not
be used. Input in the system is handled by the WriteEvent function
of the input device.
IRawKeyCOnvert
Syntax:
Description:
489
Parameters:
event
buffer:
length:
keyMap:
Result:
number:
Exceptions:
If the n umbe r parameter equals -1, the contents of the data buffer are
dedared invalid
Structures:
Oxoo 0
Ox04 4
Ox05 5
Ox06 6
OxOS S
OxOA 10
struct
UBYTE
UBYTE
UWORD
UWORD
union
InputEvent *ie_NextEvent;
ie_Class;
/* Type */
ie SubClass;
1* Sub type *1
ie-Code;
ie:=Oualifie r;
struct
{
OxOA 10
OxOC 12
OxOA 10
OxOE 14
Ox16 22
1* Mouse position */
WORD
WORD
ie_xy;
APTR
ie addr;
ieyosition;
struct timeval ie_TimeStamp;/* System time */
};
490
OxOO
Ox01
Ox02
Ox03
Ox04
Ox06
OxO?
OxOS
Ox09
OxOA
OxOB
OxOC
OxOD
OxOE
OxOF
Ox10
Oxll
Ox12
ABACUS
LIBRARY
Ox80
OxOO
Ox11
Ox18
Ox1F
IECODE co FIRST
IECODE-CO-LAST
IECODE ASCII FIRST
IECODE-ASCII-LAST
IECODE ASCII DEL
IECODE-CI FIRST
IECODE CI LAST
IECODE-LATINI FIRST
IECODE LATINI LAST
OxOO
OxlF
Ox20
Ox1E
Ox7F
Ox80
Ox9F
OxAO
OxFF
ANSI Codes:
RA WMOUSE Codes:
IECODE
IECODE
IECODE
IECODE
LBUTTON
RBUTTON
MBUTTON
NOBUTTON
Ox68
Ox69
Ox6A
OxFF
WINDOW Codes:
IECODE NEWACTIVE
OxOl
REQUESTER Codes:
IECODE_REQSET
IECODE_REQCLEAR
OxOI
OxOO
OxOOOl
Ox0002
Ox0004
Ox0008
OxOOIO
Ox0020
Ox0040
Ox0080
OxOIOO
Ox0200
Ox0400
Ox0800
OxlOOO
Ox2000
Ox4000
Ox8000
491
6.
OxOO
Ox04
Ox08
OxOC
OxlO
Ox14
Ox18
OxlC
Ox20
0
4
8
12
16
20
24
28
32
UBYTE
ULONG
UBYTE
UBYTE
UBYTE
ULONG
UBYTE
UBYTE
*km_LoKeyMapTypes;
*km_LoKeyMap;
*km_LoCapsable;
*km_LoRepeatable;
*km_HiKeyMapTypes;
*km_HiKeyMap;
*~HiCapsable;
*km_HiRepeatable;
};
Keymap Types:
KC_NOQUAL
KC VANILLA
KCF SHIFT
KCF ALT
KCF CONTROL
KCF DOWNUP
KCF DEAD
KCF STRING
KCF NOP
0
7
OxOl
Ox02
Ox04
Ox08
Ox20
Ox40
Ox80
492
OxOl
Ox08
OxOf
4
ABACUS
6.14
493
493
494
CmpTime
SubTime
IAddTime
Syntax:
AddTime (Dest,Source)
-42
AD
Al
struct timeval *Dest,*Source;
Description:
This function adds the two times specified by the timeval structures.
The result is placed in the Dest timeval structure.
Parameters:
Dest:
Source:
Comments:
!cmpTime
Syntax:
result = CmpTime(Dest,Source)
DO
-54
AD
Al
LONG result;
struct timeval *Dest,*Source;
Description:
Parameters:
Dest:
Source:
Result:
result:
Comments:
493
ISubTime
Syntax:
SubTime (Dest,Source)
-48
AO
Al
timeval *Dest,*Source;
Description:
This function subtracts the two times specified by the time val
structures. The result is saved in the Dest timeval structure:
dest = dest - source
Parameters:
Dest:
Source:
Comments:
Structures:
494
ABACUS
7.
7.1
7.1
495
7.1.1
OxOOO
Ox001
Ox002
Ox004
Ox004
OxOOB
OxOOC
OxOOC
Ox010
Ox014
Ox014
Ox01B
Ox01C
Ox064
Ox065
Ox066
Ox06B
Ox06A
Ox06C
Ox06E
OxO?O
Ox072
OxO?4
OxO?6
OxO??
OxO?B
OxO?A
OxO?C
OxO?D
OxOBO
Ox09E
OxOAO
OxOA2
OxOM
OxOA6
OxOAB
OxOM
OxOAC
OxOAE
OxOBO
OxOB2
OxOB4
OxOB6
OxOB?
OxOB8
OxOB9
OxOBA
OxOBB
496
000
001
002
004
004
OOB
012
012
016
020
020
024
02B
100
101
102
104
106
lOB
110
112
114
116
11B
119
120
122
124
126
12B
15B
160
162
164
166
16B
1?0
172
1?4
176
17B
1BO
182
183
184
185
186
18?
BYTE
UBYTE
USHORT
struct
ULONG
ULONG
struct
ULONG
ULONG
struct
ULONG
ULONG
USHORT
BYTE
BYTE
USHORT
USHORT
USHORT
USHORT
USHORT
USHORT
USHORT
USHORT
BYTE
BYTE
WORD
WORD
BOOL
USHORT
UBYTE
USHORT
USHORT
USHORT
UWORD
UWORD
USHORT
USHORT
USHORT
WORD
USHORT
UWORD
USHORT
UBYTE
UBYTE
UBYTE
UBYTE
UBYTE
BYTE
FontHeight;
PrinterPort;
BaudRate;
timeva1 KeyRptSpeed;
tv_secs;
tv micro;
ti~val KeyRptDelay;
tv secs;
tv-micro;
ti~val DoubleClick;
tv_secs;
tv micro;
pointerMatrix[36];
XOffset;
YOffset;
color1?;
color1B;
color19;
PointerTicks;
col orO;
color1;
color2;
color3;
ViewXOffset;
ViewYOffset;
ViewlnitX;
ViewlnitY;
EnableCLI;
PrinterType;
PrinterFilename[FlLENAME_SIZEj;
PrintPi tch;
PrintQuality;
PrintSpacing;
PrintLeftMargin;
PrintRightMargin;
Printlmage;
P rintAspect;
PrintShade;
Print Threshold;
PaperSize;
PaperLength;
PaperType;
/* End Ver. 1.1 */
SerRWBits;
SerStopBuf;
SerParShk;
LaceWB;
WorkName[30];
RowSizeChange;
7.1
ABACUS
OxOBC
OxOBE
OxOcO
OxOC2
OxOC4
OxOCS
OxOC6
OxOCS
OxOCA
OxOCB
OxOCD
1S8
190
192
194
196
197
198
200
202
203
204
BYTE
UWORO
UWORD
UWORD
UBYTE
UBYTE
UWORD
UWORD
UBYTE
UBYTE
ColumnSizeChange;
PrintFlags;
PrintMaxWidth;
PrintMaxHeight;
PrintDensity;
PrintXOffset;
wb_Width;
wb_Height;
wb_Depth;
ext_size;
1* End Ver. 1. 2 *1
1* Ver. 1. 3 * 1
};
The structure can be divided into the subject groups listed below.
Time intervals
All of the system time intervals applying to the keyboard and the
mouse can be set. This means that the timeval structures are
integrated into the Preferences structure. They use components
made of seconds and microseconds. The keyRptSpeed field specifies
the frequency at which the key repeats. The smaller this time value, the
more characters are repeated on the screen at a time.
Before a key repeats, the keyboard driver delays repetition until a certain
interval elapses. This interval is called the repetition threshold, which
is defined by the KeyRptDelay structure. The larger the value, the
longer the system waits until beginning key repeat.
The DoubleClick structure specifies the time interval that elapses
between the two clicks of a double-click. This structure indicates the
maximum amount of time between two single clicks before they may
be read as a double-click. If you set the DoubleClick value too
high, the Workbench may read closely spaced single clicks as doubleclicks.
Mouse pointer
The Preferences structure includes a Pointermatrix field,
which describes the mouse pointer graphic data. It is stored in an array
of 36 words, which gives us a possible 16x16 pixel, four color pointer.
This array remains constant-we cannot expand the pointer to a larger
size.
XOf f set and YOf f set variables contain the coordinate values of the
mouse's hot spot (the pixel of the mouse pointer where the actual
activation occurs).
497
7.
Workbench
Our basic structures also store some values which control the
Workbench's appearance.
The colorO, colorl, color2 and color3 fields specify the
Workbench colors.
The ViewXOffset and ViewYOffset fields place the upper left
comer of the Workbench screen (the View) at its proper location of the
monitor screen (you adjust this parameter from the center screen of
Preferences).
The ViewIni tX and viewIni t Y fields contain the initial View
values.
The FontHeight entry specifies the height of the default Topaz font
(8/9).
Version 1.3 includes additional fields: wb_Depth, wb_Height and
wb_width. They contain the dimensions and depth of the Workbench
screen. They can be read from any programs that open a window on the
screen.
The EnableCLI field (Versions 1.1-1.2) determined whether the eLI
icon appeared on the Workbench screen. Versions 1.3 and up ignore
this setting.
Printer settings
Almost half the P references structure lists printer parameters. This
is understandable when you consider how many settings many printers
offer.
The first and most elementary setting is the PrinterPort field,
which indicates the port through which the printer is driven. This is set
to PARALLEL PRINTER or SERIAL PRINTER.
Commodore-Amiga provides its own printer types that are then
supported through a printer driver. The PrinterType field reads
available printer types. If the printer cannot be found,
CustomP rinter is chosen and the name of the printer or printer
498
7.1
ABACUS
499
are:
SerRWBit, one byte in whose top section the number of bits to be
read is saved and in whose bottom section the number of bits to be
written is saved. A setting of either 7 or 8 is possible.
The number of stop bits (1 or 2) as well as the size of the data buffer
are saved in SerStopBuf.
SerParShk acts as a flag for two settings. You can choose between
three handshake methods (xOn/xOff), RTS/CTS and None) and
between three parities (none, even and odd), using the top and
bottom bits as described above.
7.1.2
500
ABACUS
once with NLQ type. The Preferences program must be loaded, which
mayor may not fit into available memory.
Today we know that the Preferences structure can be changed
without actually loading Preferences, and without conflicting with the
system or other programs. This is because Intuition supports three
functions. The first function offers the option of transferring the
contents of the current structure into buffer memory. We supply the
pointer to our buffer and the number of bytes that should be copied.
This GetPrefs () function has the following general format:
GetDefPrefs(PrefBuffer, Size):
-132
AD
DO
If we allocate a memory region and then copy the values there, we can
read the current values first The following program does just that:
1***************************************
*
*
* Author: Date:
*
---------* Wgb
07/03/1988
* cc preLc
* In preLo -lc32
Comments:
---------printer data
*
*
*
*
*
***************************************/
'include <exec/memory.h>
'include <intuition/intuition.h>
'define SIZE sizeof(struct Preferences)
struct IntuitionBase *IntuitionBase:
struct Preferences
*PrefsBuffer;
main 0
{
Open_All () :
GetPrefs(PrefsBuffer, SIZE);
printf ("Printer settings: \n"):
printf ("Pitch
$%4x\n", PrefsBuffer->PrintPitch);
printf("Quality: $%4x\n", PrefsBuffer->PrintQuality):
printf ("Spacing: $%4x\nn, PrefsBuffer->PrintSpacing);
printf("Right Margin: %d\n", PrefsBuffer->PrintRightMargin);
printf ("Left Margin: %d\nn, PrefsBuffer->PrintLeftMargin);
Close All () ;
}
1***************************************
* Function: Open Library & Memory
*
===================================
* Author:
* Wgb
Date:
Comments:
07/03/1988
*
*
*
*
***************************************/
Open_All 0
{
void
*OpenLibrary();
501
UBYTE *AllocMem();
if (! (IntuitionBase = (struct IntuitionBase *)
OpenLibrary ("intuition. library" , OL)
(
1***************************************
* Function: Close anything now open
* =================================== *
* Author: Date:
Comments:
*
* -----*
10.16/1987 Intuition and
* Wgb
*
memory only
*
*
***************************************/
Close All ()
{ if (PrefsBuffer)
if (IntuitionBase)
FreeMem(PrefsBuffer, SIZE);
CloseLibrary(IntuitionBase);
Program description
The program opens the Intuition.Library and allocates a memory range
in which the main program places the data of the current
Preferences structure. The chosen values are displayed and the
program closes the fIles.
This alone may be all that's needed for your program. Let's assume that
your program runs only on an Interlace Workbench. Then at the
beginning of your program you check to see if the Preferences
structure has an entry under LaceWB. Ifnot, the program stops with an
error message.
Another alternative is a short-term change to the Preferences
structure. Many programs load the structure into the buffer twice. The
frrst copy acts as the pattern for returning to default values later. Many
entries are changed in the second copy, and then the entire structure is
sent as a new setting10 the operating system. This is done using the
SetPrefs () function:
SetPrefs(PrefBuffer, Size, Flag)
-324
502
AD
DO
D1
7.1
ABACUS
We assign a pointer to the structure, our buffer range and the size of the
buffer, because it may not be necessary to copy the entire structure and
then return it We include a flag value which determines whether other
programs should change the structure. If this flag value is set to TRUE.
all of the programs containing a NEWPREFS message are informed. A
value of FALSE ignores this message.
The following program uses the Preferences structure exactly like
the fust program. changes some of the values and returns them.
Because the changes are rather trivial (some colors were changed) there
is no NEWPREFS message as for the other program.
/***************************************
* =================================== *
* Author: Date:
* ------ ---------07/03/1988
* Wgb
*
preLc
* In preLo -lc32
Comments:
---------Color data
*
*
*
*
*
***************************************/
iinclude <exec/memory.h>
iinclude <intuition/intuition.h>
idefine SIZE sizeof(struct Preferences)
struct IntuitionBase *IntuitionBase;
struct Preferences
*PrefsBuffer;
main 0
(
Open All 0;
GetPrefs(PrefsBuffer,
PrefsBuffer->colorO
PrefsBuffer->color1 =
PrefsBuffer->color2 =
SetPrefs(PrefsBuffer,
Close All 0 ;
}
-
SIZE);
1*15 + 256* 15;
1;
16*15;
SIZE, FALSE);
1***************************************
* =================================== *
* Author:
* ------
Date:
Comments:
----------
07/03/1988
* Wgb
*
***************************************/
Open All ()
(void *OpenLibrary();
UBYTE *AllocMem () ;
if (! (IntuitionBase = (struct IntuitionBase *)
OpenLibrary ("intuition. library", OL)
{
i f (!PrefsBuffer)
{
503
7.
/***************************************
*
*
*
*
*
===================================
Author:
*
*
*
*
*
Wgb
Date:
Comments:
----------
----------
10/16/1987
Intuition and
memory only
***************************************/
Close_All ()
(
if (PrefsBuffer)
if (IntuitionBase)
)
504
FreeMem(PrefsBuffer, SIZE);
CloseLibrary(IntuitionBase);
7 ~ PRINTER DRIVERS
ABACUS
7.2
Printer drivers
What do yOu do when you have purchased a printer that is not
supported by the Amiga? This can be solved in most cases by
developing your own printer driver. The printer driver mediates between
the printer device and the printer.
What does a printer driver look like? First of all it needs a header,
similar to the fonts. So that a printer driver doesn't disrupt the
computer with a false start, the ftrst four bytes of the driver contain the
assembly language instructions:
moveq 1I0,dO
rts
Next follow two words that give the version and revision number of the
printer driver. The following is the PrinterExtended data
structure:
offset
Structure
struct PrinterExtendedData
(
o
4
OxOO
Ox04
Ox08
12 OxOc
16 Ox10
20 Ox14
21 Ox1S
22 Ox16
23 Ox17
24 Ox18
26 Ox1a
30 Ox1e
34 Ox22
36 Ox24
38 Ox26
42 Ox2a
46 Ox2e
char
VOID
/* Printer name */
/* Initialization
routine */
VOID (*ped_Expunge) (); /* De-Initialization
routine */
VOID (*ped_Open) (); /* called by OpenDevice() */
VOID (*ped_Close) ();
/* called by
CloseDevice() */
UBYTE ped PrinterC1ass;
UBYTE ped-ColorClass;
/* number of printer
UBYTE ped=MaxColumns;
columns (e.g., 80 or
136 ) */
UBYTE ped_NumCharSets;
/* number of printer
fonts */
UWORD ped_NumRows;
/* number of printer
lines */
ULONG ped_MaxXDots;
/* Maximum horiz.
resolution */
ULONG ped_MaxYDots;
/* Maximum vert.
resolution */
UWORD ped_XDotslnch;
/* Dots per inch
(horiz.) */
UWORD ped_YDotslnch;
/* Dots per inch
(vert.) */
char ***ped Commands;
/* Command strings */
VOID (*ped_DoSpecial) ();/* Special command
handler */
VOID (*ped_Render) ();
/* Hardcopy routine */
*ped PrinterName;
(*pe<tlnit) ();
505
50 Ox32
54 Ox36
58 Ox3a
LONG ped_TimeoutSecs;
char **ped 8BitChars;
); /* defined in "devices/prtbase.h" */
7.2.1
.. )
Structure
struct PrinterData
{
o
52
86
OxOO
Ox34
Ox56
90
92
96
100
Ox5a
Ox5c
Ox60
Ox64
104
108
108
Ox68
Ox6c
Ox6c
struct DeviceData
pd_Device;
struct MsgPort
pd_Unit;
BPTR
pd_PrinterSegment; /* For
UnLoadSeg (I
UWORD
pd PrinterType;
struct PrinterSegment *pd-SegmentData;
UBYTE
*pd-PrintBuf; /* Buffer
int
(*pd PWritel (I; /* Write
function
int
(*pd PBothReadyl (I; union
struct IOExtPar pd-pO; /* Parallel */
struct IOExtSer pd_sO; /* Serial */
*/
*/
*/
{
union
190
190
Oxbe
Oxbe
272
312
346
438
2486
Ox110
Ox138
Ox15a
Ox1b6
Ox9b6
2487
2488
2720
2721
2722
Ox9b7
Ox9b8
OxaaO
Oxaa1
Oxaa2
struct IOExtPar
struct IOExtSer
pd_p1; /* Parallel */
pd_s1; /* Serial */
pd_TIOR;
pd_IORPort;
pd TC;
pd=Stk[Ox800]; /* Stack */
pd_Flags;
/* OpenDevice() */
UBYTE
pd pad;
struct Preferences
pd=Preferences;
UBYTE
pd WaitEnabled;
/* here a pad byte is ndssing */
); /* defined in "devices/prtbase.h" */
506
ABACUS
Structure
struct DeviceData
{
0
32
36
40
Oxoo
Ox20
Ox24
Ox28
44
48
Ox2c
Ox30
52
Ox32
Offset
/* Segment list */
/* Jump table for
device commands */
/* Command string */
dd_CrndBytes;
dd_NUlTCommands; /* Number of
supported
commands */
/* defined in "devices/prtbase.h" */
APTR
APTR
Structure
struct PrinterSegment
{
OxOO
Ox04
8
10
12
70
Ox08
OxOa
OxOc
Ox46
507
ped_Open:
S08
ABACUS
7.2.1.1
Additional variables
ped PrinterClass:
This UBYTE contains the class of the printer supported by the driver.
The following values exist:
- black and white printer (only text)
- black and white graphic printer
- color graphic printer
ped ColorClass:
This UBYTE specifies the color class of the supported printer:
'define
'define
'define
'define
'define
'define
'define
'define
PCC BW
PCC- YMC
PCC-YMC BW
PCC-YMCB
PCC-WE
PCC-BGR
PCC-BGR WE
PCC=BGRN
1
2
3
4
9
10
11
12
ped _MaxColumns:
This variable specifies the number of printed columns that the printer
can print If you can print 80 characters per line, for example, you must
specify the value 80 here.
ped_NumCharStes:
This variable contains the number of different text types that your
printer can use (e.g., pica, condensed, elite, sans, serif).
ped _NumRows:
This variable contains the number of lines that you can print per pass
of the printhead. With an eight-pin dot-matrix printer this variable
contains the value 8.
ped MaxXDots:
This variable contains the number of points that fit in a print line.
With 80 characters per line, and characters eight pixels wide, the value
here is 8*80 =640. If your printer supports different character widths,
this value can vary.
509
ped _ MaxYDots:
This variable contains the number of lines that fit on one page of text
This variable is only for page-oriented printers (e.g., laser printer). For
dot-matrix printers with fanfold paper, the value 0 can be entered here.
ped_XDotslnch:
This variable contains the number of pixels that the printer can print
horizontally per inch.
ped_YDotslnch:
This variable contains the number of pixels that the printer can print
vertically per inch.
7.2.1.2
);
"
510
ABACUS
ped_DoSpecial:
This variable contains the address of the DoSpecial function:
DoSpecial (Command,OutPutBuffer,Line,LineSpace,CRLF,Params)
UWORD
*Command;
char
OutPutBuffer [] ;
BYTE
*Line;
BYTE
*LineSpace;
BYTE
*CRLF;
BYTE
Params[];
{
... )
contains the address of a variable that can have the values -I, 0, 1. This
variable is added to an internal variable of the printer device that
contains the current print line on the paper.
When you, for example, want to paper feed one line, you must set this
variable to 1 in addition to the print command for the linefeed so that
the internal variable remains correct. With a paper transport back a line
you must give the value -1 in *Line. If no paper transport should take
place, the value 0 is given in *Line, or it is ignored.
LineSpace contains the address of the control character responsible
for the size of the linefeed. If, for example, the sequences "<ESC>O"
and "<ESC> I" establish the linefeed at 1/8 and 1/6 of an inch,
LineSpace contains the value "0" or "I".
ped_Render:
.. }
Because this routine must assume many tasks, these variables have
different interpretations. The Render function consists of six partial
functions. It is easiest to check these six partial functions through a
SWI TCH construct:
Sl1
switch (Status)
{
case 0:
/* Master Initialization */
/* x = width of the Hardcopy */
/* y = height of the Hardcopy */
break;
case 1:
/* transfer point into printer buffer */
/* ct = color of the point (Black = 0, Yellow = 1,
/*
Magenta = 2, Cyan = 3) */
/* x = X position */
/* y = Y Position */
break;
case 2:
/* send print buffer to the printer */
/* (* (pd PWrite (Buffer, Len); */
break;
case 3:
/* initialize printer buffer */
break;
case 4:
/* Close Down *1
/* ct = Error Code */
1* x = Special Flags *1
break;
case 5:
1* Pre Master initialization */
/* x = Special Flags *1
break;
This partial function reserves the necessary print buffer in which the
individual pixels to be printed for the hardcopy are written. A printer
reset should also be executed. followed by a one-second delay.
The size of the print buffer is determined by the number of pins of the
printer. An eight-pin printer needs an 8*x byte print buffer. This print
buffer must also contain the control characters for "graphic mode on"
and "graphic mode off' so that the hardcopy can be sent immediately
after printing the text. With double buffering this print buffer is twice
as large.
case 1:
This partial function transfers the pixels given by X and Y into the
print buffer. You must calculate the Y coordinate of a hardcopy line so
that it fits in the print buffer described above.
case 2:
Here the print buffer sends graphic control characters to the printer. For
this the PWri te () function from the P rinterData structure is
used. This routine gives the address of the print buffer as well as the
number of bytes to be output. With double buffering you must also
determine the other print buffer for the transfer of the points in this
section function (case 1).
512
ABACUS
case 3:
case 4:
case 5:
This partial function is the ftrst called (even before case 0). In it you
can set the Render internal variables to inform case 1: that the
picture should be centered or variables for the print width is set. In x
you get the special flags that are given with DUMPRPORT.
7.2.1.3
ped_8BitChars:
This pointer contains the address of a 2S6-byte array that contains the
ASCII codes to be printed when using the extended fonts.
513
7.2.2
or
moveq IIO,dO
rts
514
7.3
ABACUS
7.3
The file Opal. font is the font header. It contains the Opal font data
for the 12-pixel and 9-pixel sizes. The Opal directory contains the files
Opal. 12 and Opal. 9, which contain the character definitions.
7.3.1
Structure
struct FontHeader
{
o OxOO
2 OxOO
4 OxOO
fch_FileIO contains the value OxOfOO and signals the Amiga that it
handles this fIle as a font header.
fch_NumEntries contains the total number of fonts the Amiga has
available. It only lists as many fonts that exist under a certain name,
e.g., Opal. Because the Opal font is present in two point sizes (9 and
515
12), this enlIy has the value 2 for the Opal font. The FontContents
structure supplies the exact information about each font:
Offset
Structure
struct FontContents
o OxOOO
256 OxlOO
258 Oxl02
259 Oxl03
char
UWORD
UBYTE
UBYTE
fc_FileName[256];
fc YSize;
fc-Style;
fc=Flags; 260 Oxl04 ) 1* defined in
libraries/diskfont.h *1
fc_Style contains the text style of the font. Normally the value zero
is here, which says that the font is saved in normal style. You can, for
example, define the individual characters so that they appear as italics.
Then you should set the FSF_ITALIC flag (4) so that the Amiga
knows that an italic font in the size Y S i z e is found in the
fc _F ileName file. If you want to open a font that is eight lines high
and should be italic, the Amiga can recognize the header to see if such a
font exists.
If this is not the case, the Amiga tries to load the font that comes the
closest to the given size. If this font only contains normal characters,
the font can be italicized through software if needed. The following text
types are recognized by the Amiga, or can be created with the software:
FC FLAGS:
Contains the flags that inform the Amiga in the fonfs status.
516
ABACUS
*
* Function: Create Font-Header
*
*
***************************************************************/
1***************************************************** **********
* Compile-Info:
*
* cc Font.c
* In Font.o -Ic
*
*
*
*
****************************************************** *********1
lIinclude
lIinclude
llinclude
#include
#include
"exec/types.h"
"exec/memory.h"
"libraries/dos.h"
"libraries/diskfont.h"
"graphics/text.h"
IIdefine NUMFONTS 1
VOID
*Open () ;
*FontHeaderName
"OwnFont. font";
517
struct FontContentsHeader
FontContentsHeader[NUMFONTSj
{OxOfOO,
/* File is Font-Header */
OxOOOl /* Single Font */
}:
struct FontContents
FontContents[ANZFONTSj
{"OwnFont/9" ,
Ox0009,
OxOO,
FPF_REMOVEDIFPF_DISKFONT
}
};
/***************************************************************
main
*
***************************************************************/
*
rrain ()
{
UWORD *FileHandle
UWORD i,j;
01;
(j==O)
Write (FileHandle,&FontContentsHeader[Oj,FONHED_LEN);
Note:
518
You must store your own FontContents structure for each size of
the font (e.g., Opal-12, Opal-9). The font header created from the above
program must be copied into the Font directory, and then the header
determines the appearance of each character.
ABACUS
7.3.2
You have stored the fonts as program files to be able to load and
remove these simply with LoadSeg () and UnLoadSeg ( ) . This
makes the two above commands necessary. so that a system interrupt
does not happen when starting. A FontData fIle has the following
appearance:
moveq fO, dO
rts
DiskFontHeader
FontData
Let's examine the disk font header. This structure has the following
appearance:
Offset
Structure
struct DiskFontHeader
{
o
14
16
18
22
52
OxOO
OxOe
Oxl0
Ox12
Ox16
Ox34
struct Node
dfh Node;
UWORD
dfh=:FileID;
UWORD
dfh Revision;
LONG
dfh-Segment;
char
dfh-Name [32] ;
struct TextFont dfh-TF;
/* defined in "libraries/diskfont.h" */
dfh_Node adds the font to the system font list after it is loaded.
Mter that the Amiga no longer needs to access the disk, but the user
can still access the font
dfh_FileID contains a label that informs the Amiga to handle the
ftle as a font file. This label has the value Ox0f80.
dfh_Revision can be used to assign your own private font version
number. The value is usually here.
519
dfh Segment contains the address of the segment list that is returned
after-LoadSeg ( ) . It is necessary to be able to remove the font from
the system after it is used with UnLoadSeg ( ) . This value must be
set to zero by you. The Atniga does the rest.
dfh Name contains the name of the fonts so that the OpenFont ()
command can recognize that the font to be opened is found in the
memory.
dfh TF is a TextFont structure which returns a pointer after
OpenFont () or OpenDiskFont (). The font can then use this
pointer.
This TextFont structure (dfh_TF) must be initialized by the user. It
looks like this:
Offset
Structure
struct TextFont
{
o Oxoo
20
22
23
24
26
28
30
32
33
34
36
40
44
48
Ox14
Ox16
Ox17
Ox18
Oxla
Oxle
Oxle
Ox20
Ox2l
Ox22
Ox24
Ox28
Ox2c
Ox30
520
7.3
ABACUS
Say you want to create a font that consists of capital letters only. The
tf_ LoChar and tf_ HiChar variables would then contain the values
65 decimal (A) and 91 (Z) respectively. Your new characters are then
1, 2, 3, 4, 5, 6, 7, 8
Bytes 1-8 contain the top lines of all of the characters. Bytes 9-16
contain the second lines of all the characters, and so on. You see, the
character array is organized like a bit-map. The Blitter chip must know
the size of the array so that the Blitter can correctly read the data for a
character from this array. In this case the width would be eight bytes.
You must then give the value 8 for t f _Module.
Because the individual characters in the character array are saved without
any spaces in between (to save memory), the CharSpace array allows
display of each character. This array contains the width of each
character, as well as the width of the character container into which the
characters from the CharLoc array are copied.
The CharKern array contains the column to which the characters in
this container are copied. The following diagram shows this
connection:
521
CharLot:
CharPos:
'J
L-------'--
'}
t
16
30
37
Now you have the elements needed to create your own font. The
following assembly language program contains a font that redefines the
capital letters A through F. Remember that you must always defme one
character more than needed, that always appears when an ASCII code
not included in the font is encountered (see LoChar and HiChar
above). Undefined characters on the keyboard are presented as rectangles.
522
ABACUS
****************************************************************
9.asm
August 1988
(c) Bruno Jennrich
*
*
*
*
*
*
****************************************************************
****************************************************************
Info:
*
* as 9
* ln 9.0
*
*
****************************************************************
FONT:
dc.l
;In_Succ
;Message-Structure
dc.l
;In Pred
dc.b 12
;In-Type (NT]ONT)
dc.b
;In-Pri
dc.l Name
;In=Name
dc.l
;mn ReplyPort
dc.w Ende-FONT ;Length
dc.w 9
;YSize
dc.b
;tf Style (before defined?)
dc.b 128+32+2
;tf-Flags
(FPF REMOVED+FPF_PROPORTIONAL+FPF_ROMFONT)
dc.w 11
;tf XSize
dc.w 7
; t ()aseline
dc.w 1
itf_BoldSmear
dc.w
;tf_Accessors
dc.b 65
;tf LoChar 'A'
dc.b 70
;tCHiChar 'F'
dc.l CharData
;tf CharData
;tf-Modulo
dc.w 8
dc.l CharLoc
;tf=CharLoc
dc.l CharSpace ;tf_CharSpace
dc.l CharKern
;tf_CharKern
CharData:
de. w
de. w
de. w
de. w
de. w
de. w
de. w
de. w
de. w
...
...
...
...
undefined
523
CharLoc:
dc.w
dc.w
dc.w
dc.w
dc.w
dc.w
dc.w
0,10
10,8
18,8
26,10
36,9
45,9
54,10
CharSpace:
dc.w 11
dc.w 9
dc.w
dc.w
dc.w
dc.w
dc.w
;A
;B
;C
;D
;E
;F
; undefined
;A
;B
;C
11
;D
10
10
;E
11
;F
; undefined
CharKern:
dc.w
dc.w
dc.w
dc.w
dc.w
dc.w
dc.w
1
1
1
1
1
1
Ende:
end
Because font files must be stored as program fIles, the following steps
must be taken:
as 9.asm
In 9.0
The linking is necessary to store the file as a program file (including all
of the hunks) so that it can be loaded using LoadSeg () . Then we
must copy the finished program file to a subdirectory of the F 0 n t
directory (you must create a subdirectory within the Font directory
using the CLI makedir command). Then you can use the font.
The C program printed in this chapter (Font. c) creates a header file
for the font Ow n F 0 n t. To use this font you must place the
subdirectory OwnFont in the Fonts directory and copy the assembled
version of the font created above (9). The font header also must be
copied to the Font directory.
524
7.4 KEYMAPS
ABACUS
7.4
Keymaps
It is important that the keyboard of a computer be adaptable to fit other
languages, because some countries use different keyboard arrangements.
Some of the keys must be transposed (e.g., Y becomes Z and Z
becomes Y). This alone is not enough. The Amiga keyboard, which
includes a small microprocessor, tells the Amiga that a certain key was
pressed, rather than a certain character. The Amiga does not know
which character is represented by this key. The number of the key sent
to the Amiga is called the RAWKEY number.
The following diagram of the International Amiga 500 and Amiga 2000
keyboard, includes the RAWKEY numbers in hexadecimal notation.
The Amiga International keyboard has two extra keys, one by the
<Return> key and one by the <Left Shift> key. The operating system
converts these RAWKEY numbers into key characters. The system
uses a table called a key map as a reference, into which the character
representing each RAWKEY number is entered. The Amiga includes
key maps for a number of different countries. A keymap is usually
loaded during the boot operation, or by the CLI SetMap command. If
no keymap is found the Amiga defaults to an American (USA) keymap.
In addition to regular characters, the keymap indicates whether a key
reacts to the <Caps Lock> key. An active <Caps Lock> key usually
has the same effect as continually pressing a <Shift> key. This means
that you get upper case letters instead of lower case letters when you
press the letter keys. If you press number keys you may also get the
corresponding special characters (!,",#,$, ...). Since most people want
access to upper case letters and numbers, but not the shifted numbers,
you can exclude any keys from the <Caps Lock> function, including
number and cursor keys.
The keymap also assigns key repeating for individual keys. For
example, if you press a cursor key, the key continues to repeat until
you release the key. This lets you move the cursor easily in a word
processor. The <Return> key has no repeat function since it is used
mainly for input, and shouldn't have a repeat function assigned to it.
S2S
526
ABACUS
7.4 KEYMAPS
All of these parameters are present in the keymap for each key. A
keymap has the following structure:
struct KeyMap
{
Oxoo
Ox04
Ox08
OxOC
Ox10
Ox14
Ox18
Ox1C
Ox20
0
4
8
12
16
20
24
28
32
UBYTE
ULONG
UBYTE
UBYTE
UBYTE
ULONG
UBYTE
UBYTE
*km LoKeyMapTypes:
*km-LoKeyMap;
*km=LoCapsable:
*km LoRepeatable:
*km=HiKeyMapTypes:
*km HiKeyMap:
*km-HiCapsable;
*km=HiRepeatable;
0
7
Ox01
Ox02
Ox04
Ox08
Ox20
Ox40
Ox80
527
O. Byte
Qualifier
KC_NOQUAL
KCF SHIFT
KCF ALT
KCF CONTROL
KCF ALT+KCF SHIFT
KCF CONTROL+KCF ALT
KCF CONTROL+KCF SHIFT
KC VANILLA
Shift+Alt
Ctrl+Alt
Ctrl+Shift
Shift+Alt
1. Byte
2. Byte
Alt
Alt
Ctrl
Alt
Shift
Alt
Ctrl
Shift
Ctrl
Shift
Shift
3. Byte
alone
alone
alone
alone
alone
alone
alone
alone
If the KCF_ S TRI NG flag is set, the long word is handled as a pointer
to a string descriptor (more on this later) instead of four individual
bytes. The following are a few examples from a German keymap:
RAWKEY-Nummer: OxOE
Ox80
KeyMapType:
This means that this RA WKEY number is not allocated because there
is no key that sends this number.
RAWKEY Number: Ox30
Ox01
0,0, '>','<'
KeyMapType:
KeyMap:
Capsable:
Repeatable:
0
1
This key usually sends the < character. If the <Shift> key is pressed in
addition, the result of the key is the> character. The <Caps Lock> key
does not react with this key, and for that reason it has a repeat function.
RAWKEY-Nummer: Ox45
Ox02
Reacts to the Alt key.
0,0, Ox9B, OxlB
KeyMapType:
KeyMap
Capsable:
Repeatable:
o
o
This key (ESCAPE key) usually delivers Oxlb (27). When <Alt> is
pressed at the same time, you get Ox9B. This key does not react to the
<Caps Lock> key and does not have a repeat function.
RAWKEY-Nummer: Ox01
Ox03
Reacts to the Shift and Alt keys.
, ! I, OxB9, 1 ! ., 111
KeyMapType:
KeyMap:
Capsable:
Repeatable:
o
1
528
7.4 KEYMAPS
ABACUS
time, you get the ! again. The key reacts to the <Caps Lock> key and
has a repeat function for this.
RAWKEY-Nurrmer:
KeyMapType:
KeyMap:
Capsable:
Repeatable:
Ox10
Reacts to Shift, A1t, Ctrl.
Ox07
OxC5,OxE5, IQI, 'q'
1
1
This key is a normal letter key. Without a qualifier you get a small
letter and with a qualifier you get a capital letter. When you press
<A1t>, you get a special character, OxC5 and with <Shift> (or with the
activated <Caps Lock> key) 0xE5. When you press <Ctrl> you get the
code of the character without a qualifier, but with the 5th and 6th bits
cleared, q = Ox71 => Ox71 & Ox9F = Oxll = IIQ. You always get this
code when you have pressed <Ctcl> at the same time, regardless of
whether you have also pressed <Shift> or <Alt>. This key reacts to
<Caps Lock> and has a repeat function.
The following keys supply strings, so that we should look at the
construction of a string descriptor. Just as each key can send different
characters, this can also send different strings. For each combination
with one allowable qualifier there is an entry in the string descriptor
made up of two bytes, just like normal keys. The first byte gives the
length of the string and the second gives the distance of the string from
the beginning of the string descriptor. Unlike normal keys, the order
here is exchanged, which means the string for the key without the
qualifier is described first, then for the key with <Shift>, then with
<A1t>, <Shift> plus <A1t>, etc.
RAWKEY-Nummer:
KeyMapType:
KeYMaP:
Stringdescr.:
Capsable:
Repeatable:
Ox5F
Ox40
String.
Pointer to string descriptor
Ox03,Ox02
Ox9B, Ox3F, Ox7E
o
o
This key Help supplies a string of length three: Ox9B Ox3F Ox7E.
RAWKEY-Nummer:
KeyMapType:
KeyMap:
Stringdescr.:
Capsable:
Repeatable:
Ox42
String, reacts to Shift.
Ox41
Pointer to String descriptor.
OxOl,Ox04
without shift (length: 1)
Ox02,Ox05
with Shift (Length: 2)
Ox09
String without Shift (distance: 4)
Ox9B,Ox5A
String with shift (distance: 5)
0
1
This key, the <Tab> key, usually sends a character with code 9. When
pressed with the <Shift> key, the <Tab> key sends the string Ox9B
Ox5A.
529
Complicated strings are not offered by the keymap. For these we must
access the dead keys. The following example does not work with the
USA keymaps, use SETMAP d to enable the German keymap. These
are especially interesting when used in conjunction with the equals key
(RAWKEY number OxOC, the apostrophe key in the German keymap).
If you press this key, nothing happens. If you press a vowel key
<e>, <i>, <0>, <U, <Space>, <y> or <n>, the system displays the
corresponding character with an accent (try this from the CLI).
a>,
Ail of these keys '>, vowels, <Space>, <y> and <n are marked as
dead keys in the KeyMapTypes. When a key is a dead key, the
key map long word contains a pointer that points to a dead key
descriptor. This consists of a row of 2 byte entries from which the first
byte gives how the second is handled:
The second byte is the character code that sends this key with
the corresponding qualifiers.
This key (DPF_DEAD) is the actual dead key. The second byte
contains an offset that designates which character is used from
the I8-byte field. This offset is noted in the operating system
until another key is pressed. When this key is handled as a
dead key, this offset is ignored. The offset itself is actually
divided into two nibbles. When the high nibble (bits 7
through 4) is unequal to zero, the value of this nibble is
multiplied by the low byte, and both are added together with
the previous offset. When the previous offset of the high
nibble was unequal to zero, only the low nibble is added. If no
previous offset exists, zero is added and only the product is
used.
530
Ox23
Ox27
Dead and Vanilla
pointer to dead key descriptor
O,'f'
without qualifier
0, 'F'
with Shift
8,Ox61
Alt (dead key)
8,Ox61
Alt+Shift (dead key)
0,Ox06
Ctrl
0,Ox06
Ctrl+Shift
0,Ox86
Ctrl+Alt
7.4 KEYMAPS
ABACUS
O,OxB6
Capsable:
Repeatable:
Ctrl+Alt+Shift
1
1
Ox24
Ox27
Dead and Vanilla
Pointer to dead key descriptor
O,'g'
without qualifier
0, 'G'
with Shift
B,Ox62
Alt (dead key)
Alt+shift (dead key)
B,Ox62
O,OxO?
Ctrl
O,Ox07
Ctrl+Shift
O,OxB?
Ctrl+A1t
O,OxB7
Ctrl+Alt+Shift
Capsable:
Repeatable:
1
1
This key reacts the same way as mentioned before. but it has a different
offset than the dead key (and also sends a different character). Let's take
a third dead key:
RAWKEY Number:
KeyMapType:
KeyMap:
Dead-Key-Des. :
Ox25
Ox27
Dead and Vanilla
Pointer to dead key descriptor
without qualifier
0, 'h'
with Shift
0, 'H'
8,Ox03
Al t (dead key)
B,Ox03
Alt+Shift (dead key)
O,OxOB
Ctrl
O,OxOB
Ctrl+Shift
O,Ox88
Ctrl+Alt
O,OxBB
Ctrl+Alt+Shift
Capsable:
Repeatable:
1
1
This key has a dead key offset where the high byte nibble is zero. Now
here is a key modified through the dead keys:
RAWKEY Number: Ox20
KeyMapType:
Ox2?
Dead and vanilla
KeyMap:
Pointer to dead key descriptor
Dead-Key-Des. :
l,OxlO
without qualifier (dead modified)
l,Ox22
Shift (dead modified)
O,OxE6
Alt
O,OxC6
Alt+Shift
O,OxOl
Ctrl
O,OxOl
Ctrl+Shift
O,OxBl
Ctrl+Alt
Ctrl+Alt+Shift
O,OxBl
531
7.
1
1
Now let's look at a few options offered by different field entries, and
which keys you must press:
A
Alt-F
A
Alt-G
Shift-A
Alt-H
Shift-A
Alt-F
Alt-G
A
Alt-G
Alt-F
A
Alt-G
Alt-H
A
Alt-H
Alt-F
A
Alt-H
Alt-G
Shift-A
532
7.4 KEYMAPS
ABACUS
hicaps:
de.b 0,0,0,0,0,0,0,0
lorepeat:
de.b $FF,$BF,$FF,$EF,$FF,$EF,$FF,$F7
hirepeat:
de.b $47,$F4,$FF,$7F,0,0,0,0
lotypes:
de.b $07,$03,$03,$03,$03,$03,$03,$03
de.b $03,$03,$03,$03,$03,$07,$80,$00
de.b $07,$07,$27,$07,$07,$07,$27,$27
de.b $27,$07,$07,$03,$80,$00,$00,$00
de.b $27,$07,$07,$27,$27,$27,$27,$27
de.b $07,$07,$07,$05,$80,$00,$00,$00
de.b $01,$27,$07,$07,$07,$07,$27,$07
de.b $03,$03,$07,$80,$00,$00,$00,$00
hitypes:
de.b $22,$00,$41,$00,$04,$02,$00,$80
de.b $80,$80,$00,$80,$41,$41,$41,$41
de.b $41,$41,$41,$41,$41,$41,$41,$41
de.b $41,$41,$05,$05,$00,$00,$00,$40
de.b $80,$80,$80,$80,$80,$80,$80,$80
de.b $80,$80,$80,$80,$80,$80,$80,$80
de.b $80,$80,$80,$80,$80,$80,$80,$80
lokeymap:
de. b
de.b
de.b
de.b
de.b
de.b
de.b
de.b
de.b
de.b
de.b
de. b
de.l
de.b
de.b
de.b
de.b
de.b
de.l
de.b
de.b
de.b
de.l
de.l
de.l
de.b
de.b
de.b
de.b
de.b
de.b
de.b
de.l
de.b
de.b
de.l
de.l
de.l
1 -' ,
.. , - ' I
.. I
$B2,'@','n','2'
'i',$B3,$A7, '3'
$A2,$BO,'$', '4'
'%',$Be,'%', '5'
'A',$BD,'&', '6'
'&',$BE, 'I', '7'
'*', $B7, , (' , '8'
'(', $AB, ') " '9'
')',$00,'=','0'
' ',' -' , , ? ' , $DF
deadapostroph
'I',' \', , I " '\'
$00,$00,$00,$00
$00,$00,$00, '0'
$C5,$E5,'Q','q'
$BO,$BO,'W', 'w'
deade
$AE,$AE, 'R', 'r'
$DE,$FE,'T', 't'
$A5,$A4, 'Z', 'z'
deadu
deadi
deado
$B6,$B6, 'P', 'p'
'{',' [' , $DC, $FC
'}',']','*','+'
$00,$00,$00,$00
$00,$00,$00, '1'
$00,$00,$00, '2'
$00,$00,$00, '3'
deada
$A7,$DF,'S', 's'
$DO,$FO, 'D', 'd'
deadf
deadg
deadh
533
dc.l
dc.l
dc.b
dc.b
dc.b
deadj
deadk
$A3,$A3, 'L', '1'
':',';', $D6, $F6
'''',$27,$C4,$E4
de. b ." 1 I
dc.b
dc.b
dc.b
dc.b
dc.b
dc.l
dc.b
dc.b
dc.b
dc.b
dc.l
dc.b
dc.h
dc.b
't I ,
,A I ,
1:# I
$00,$00,$00,$00
$00,$00,$00, '4'
$00,$00,$00, '5'
$00,$00,$00, '6'
$00,$00,'>','<'
deadz
$F7,$D7,'X', 'x'
$C7,$E7,'C', 'c'
$AA,$AA,'V', 'v'
$BA,$BA, 'B', 'b'
deadn
$BF,$BS, 'M', 'm'
'<' I ' I I I';
1, . ,
'>',$2E, ':',$2E
1_ 1
dc.b $00,$00,$00,$00
dc.b $00,$00,$00,$2E
dc.b $00,$00,$00, '7'
dc.b $00,$00,$00, 'S'
dc.b $00,$00,$00, '9'
hikeymap:
dc.l deadspace
dc.b $OO,$OO,$OO,$OS
dc.l strtab
dc.b $OO,$OO,$OO,$OD
dc.b $OO,$OO,$OA,$OD
dc.b $00,$00,$9B,$lB
dc.b $00,$00,$00,$7F
dc.l $00000000
dc.1 $00000000
dc.l $00000000
dc.b $00,$00,$00, '-'
dc.l $00000000
dc.l strcdown
dc.l strcup
dc.l strcright
dc.l strcleft
dc.l strfl
dc.l strf2
dc.l strf3
dc.l strf4
dc.l strf5
dc.l strf6
dc.l strf7
dc.l strfa
dc.l strf9
dc.l strflO
dc.b $OO,$OO,'{','['
dc.b $00,$00,' I', ']'
dc.b $00,$00,$00, 'I'
dc.b $00,$00,$00, '*'
dc.b $00,$00,$00, '+'
dc.l strhelp
dcb.l 24,0
;Strings and Dead-Keys
deadapostroph:
534
7.4
ABACUS
I{EVMAPS
N I ,IN' I
N1 ,
N' , I N I
NI
N'
deado:
dc.b $01,$10,$01,$22,$00,$F8,$00,$D8
dc.b $00,$OF,$00,$OF,$00,$8F,$00,$8F
dc.b 'o',$F2,$F3,$F4,$F5,$F6,$F2,$F2,$F4
dc.b $F2,$F2,$F2,$F3,$F4,$F3,$F3,$F3,$F3
dc.b 'O',$D2,$D3,$D4,$D5,$D6,$D2,$D2,$D4
dc.b $D2,$D2,$D2,$D3,$D4,$D3,$D3,$D3,$D3
deadu:
dc.b $01,$10,$01,$22,$00,$B5,$00,$B5
dc.b $00,$15,$00,$15,$00,$95,$00,$95
dc.b 'u',$F9,$FA,$FB, 'u',$FC,$F9,$F9,$FB
dc.b $F9,$F9,$F9,$FA,$FB,$FA,$FA,$FA,$FA
dc.b 'U',$D9,$DA,$DB, 'U',$DC,$D9,$D9,$DB
dc.b $D9,$D9,$D9,$DA,$DB,$DA,$DA,$DA,$DA
deadz:
dc.b $01,$10,$01,$22,$00,$B1,$00,$AC
dc.b $00,$19,$00,$19,$00,$99,$00,$99
dc.b 'y', 'y', $FD, 'y', 'y', $FF, 'y', 'y', 'y'
535
536
7.4 KEYMAPS
ABACUS
You can write your own keymap as a data block and assemble it. After
linking you have a keymap file which can be installed using the CLI
SetMap command. You define an Exec node in the assembler source
of the keymap, which is used later to link the keymap to the
keymap. resource structure. The KeyMap structure follows with
all of the tables. Remember to provide the names of the Exec nodes,
otherwise you cannot find the keymap after you have added it to the
system.
Here are two more structures. The flI'St comprises the entire structure of
the keymap fde, only you don't see the tables for the actual conversion
because these belong to the KeyMap structure. The second states the
structure of the keymap. resource. You can get this from the list
of all of the resources using the FindName function (execBase),
then search for a keymap of the same name with the same function.
struct
KeyMapNode
Oxoo 0
OxOE 14
};
struct
KeyMapResource
OxOO 0
OxOE 14
OxIC 28
};
When you want to change your keymap, use the disassembled keymap
listed above. Enter the listing, change the arrangement of the keys that
you want to change and save this keymap under an unusual name
(include an . asm extension if possible). For example, say you named
the file demo. a sm. You can assemble this file with:
as demo
These calls are for the Aztec assembler. They should work on other
assemblers. Above all, no library is linked to the keymap. The
following CLI entries copies this keymap to a boot disk:
copy demo to Devs:Keymaps
SetMap demo
If you want to access this keymap, you must add it to the startup
sequence of your boot disk. or from the tool (application program) that
should use this keymap. This could l()()k like the following example:
537
If you don't want to reassemble and relink the keymap every time you
want to change a key arrangement, use programs that let you change
the keyboard arrangement during program execution. This is helpful if
you want to change the arrangement more than once. You can find
many such programs available commercially as well as in the public
domain and shareware world.
If you want to know the current arrangement of your keyboard, use the
KeyToy tool usually located in the Tools directory of your Extras
diskette (your Key Toy may be in another directory--check with your
dealer). The Amiga 2000 KeyToy is called KeyToy2000, while the
Amiga 500 KeyToy is called KeyToySOO. When you start this tool,
it displays an image of a keyboard on the screen, and shows which
characters you get when you press the corresponding key on the real
keyboard.
By clicking on the <Shifl>, <All> or <Ctrl> keys you can see what
function the corresponding key has. While this tool cannot display
strings that are modified through a dead key, it shows your letters in
italics. The actual dead keys are displayed in orange, and the accent
indicates that this dead key was created using other keys.
To conclude, the console device functions are ready to get a pointer to
the current keymap, set the current key map and convert a RAWKEY
number into an ASCII string. The last function (RawKeyConvert) is
the most interesting of all for the programs that wait for RAWKEY
input and must convert these themselves.
538
ABACUS
Appendix A:
AbortIO ...................................... 269
Activate<Jadget ............................. 309
ActivateWindow ........................... 302
AddAnimOb ................................. 432
AddBob ............ 432
AddConfigDev .............................. 476
AddDevice ......................... 265
AddDosN"ode ....... 476
AddFont. .................................... 427
AddFreeList ................................. 370
AddGadget ....... 310
AddGList. .................................... 313
AddHeal ................................... 251
AddIntServer ................................ 245
AddLibrary ................................... 261
AddMemList ...................... 274
AddPort....................................... 258
AddResource ................................ 269
AddSemaphore .............................. 273
AddTail .................................. 251
AddTask ................................... 253
AddTime ..................................... 493
AddVSprite ................................. 432
Alert ........................................... 241
AllocAbs ..................................... 247
Allocate ...................................... 246
AllocBoardMem ............................ 477
AllocConfigDev ........................... 477
AllocEntry .................................. 248
AllocExpansionMem ..................... 478
AllocMem ................................... 247
AllocPotBits ................................ 472
AllocRaster.................................. 378
AllocRemember............................ 335
AllocSignai ................................. 257
AllocTrap .................................... 258
AllocWBObject ............................ 365
AndRectRegion ............................ 420
AndRegionRegion ........................ 420
Animate ...................................... 433
AreaCircle ................................... 389
AJeaI)raw .................................... 390
AreaEllipse .................................. 390
AreaEnd ...................................... 390
Function List
AreaMove ................................... .391
AskFont ......................................427
AskSoftStyle ................................427
AttemptLockLayerRom ..................420
AttemptSemaphore ........................272
AutoRequest. ............................... .321
AvailFonts ...................................446
AvailMem ....................................248
BeginRefresh ................................336
BeginUpdate ................................ .353
BehindLayer................................. .355
BltBitMap ................................... .401
BltBitMapRastPort ....................... .403
BltClear ...................................... .403
BltMaskBitMapRastPort ................ .404
BltPattern.....................................405
BltTemplate ................................. .406
BNDRYOFF ............................... .391
BuildS ysRequest. .......................... .322
BumpRevision ............................. .372
Cause ..........................................245
CBump ....................................... .411
CDInputlIand1er ........................... .489
CEND ........................................ .411
ChangeSprite ............................... .433
ChecldO ......................................268
ClearDMRequest .......................... .322
ClearEOL ..................................... 385
ClearMenuStrip ............................. 318
ClearPointer ................................ .332
ClearRectRegion ...........................421
ClearRegion' .................................421
ClearSa-een .................................. 385
ClipBlit. ......................................407
Close ..........................................278
CloseDevice ................................. 266
CloseFont ....................................428
CloseLibrary .................................262
CloseScreen ................................. .326
CloseWindow ............................... 302
CloseWorlcBench .......................... .326
CMove ........................................412
539
540
FauenLayerInfo ............................ .3 51
FFP ........................................... .454
FFP ........................................... .461
FindConfigDev ............................ .479
FindNaIDe ....................................253
FindPort ......................................261
FindResiden t. ................................241
FindSemaphore .............................273
FindTask ......................................255
FindTooIType .............................. .372
Flood .......................................... 392
Forbid .........................................243
FreeBoardMem ............................. .480
FreeColorMap ............................... 397
FreeConfigDev ............................. .480
FreeCopList ................................ .413
FreeCprList. ................................ .413
FreeDiskObject ............... , ............ .368
FreeEntry .....................................249
FreeExpansionMem ...................... .481
FreeFreeList ................................ .371
FreeGBuffers ................................ .435
FreeMem .....................................248
FreePotBits ................................. .473
FreeRaster .................................... 378
FreeRemember .............................. 336
FreeSignal. ...................................257
FreeSprite ................................... .435
FreeSysRequest ............................ .324
FreeTrap ......................................258
FreeVPortCopLists ....................... .413
FreeWBObject. .............................. 365
GetCC .........................................276
GetColorMap ............................... .397
GetCurrentBinding ........................ .481
GetI>efPrefs ................................. 338
GetDiskObject ............................. .369
GetGBuffers ................................. .436
GetIcon ....................................... .367
GetMsg .......................................260
GetPacket. ....................................296
GetPrefs ...................................... .338
GetRGB4 .................................... .397
GetScreenData .............................. .327
GetSprite .................................... .436
GetWBObject. .............................. .365
ABACUS
IsInteractive ..................................289
541
Request........................................325
RethinkDisplay ............................. 337
ScreenToBack .............................. .330
ScreenToFront ............................. .330
SerollLayer...................................358
SerollRaster................................. .388
SerollVPort ................................. .416
Seek ............................................280
SendIO ........................................268
SetAfPt ...................................... .394
SetAPen ......................................380
SetBPen ...................................... .380
SetCollision .................................440
SetComment ................................285
SetCurrentBinding ........................ .484
SetDMRequest ............................. .325
SetI>rMd ..................................... .381
SetDrPt ....................................... 381
SetExeept.....................................256
SetFont ...................................... .429
SetFunetion ..................................264
SetIntYector .................................244
SetMenuStrip .............................. .319
SetOPen ..................................... .395
SetPointer .................................... 334
SetPrefs ....................................... 343
SetProtection ................................286
SetRast....................................... .382
SetRGB4 .................................... .399
SetRGB4CM ............................... .399
SetSignal .....................................256
SetSoftS tyle ................................ .430
SetSR ......................................... 243
SetTaskPri .................................. .255
SetWindowTitles .......................... .307
SetWrMsk ................................... .382
ShowTitle ................................... .331
Signal .........................................257
SizeLayer .................................... .359
SizeWindow ................................ .307
SortGList. ....................................441
SPAbs ........................................ .451
SPAeos .......................................455
SPAdd ........................................ .451
SPAsin ....................................... .456
SPAtan ....................................... .456
SPCmp ...................................... .452
SPCos ........................................ .456
SPCosh ...................................... .457
SPDiv ........................................ .452
ABACUS
543
ApPENDIX B: BIBLIOGRAPHY
Appendix B:
Bibliography
544
INDEX
ABACUS
Index
8SVXchunk
8SVX IFF fonnat
233
233
AbortIO
ActivateGadget
ActivateWindow
Actual
actual character data
AddAnimOb
hkIBob
AddConfigDev
AddDevice
AddDa;Node
AddFont
AddFreeList
AddGadget
AddGList
MlHeal
AddIntServer
Additions lines
AddLibrary
AddMemList
AddPoct:
AddResource
AddSemaphore
AddTail
269
309
302
139
518
432
432
476
265
476
427
370
310
313
251
245
7
261
274
258
269
273
251
253
493
186
432
241
247
246
477
477
248
478
150
247
472
Addfask
Addfime
Addfime()
AddVSprite
Alert
AllocAbs
Allocate
AllocBoardMem
AllocConfigDev
AllocEntry
AllocExpansionMem
AllocKey
AllocMem
AllocPotBits
AllocRaster
AllocRemember
AllocSignal
AllocTrap
AllocWBObject
AndRectRegion
AndRegiooRegion
Animate
ANNO chunk
AreaCircle
ArelDraw
AreaEllipse
AreaEnd
AreaMove
ArgC (Argument Counter)
argument template
ArgV (Argument Vector)
AskFont
AskSoftStyle
Assembly language
Assign command
ATAKchunk
atoiO function
AttemptLockLayerRom
AttemptSemaphore
Audio channel allocation
audio device
AUTHchunk
AutoRequest
AvaiIFonts
AvailMem
Aztec C compiler
base address register
basic settings
basic structures
beam synchronized
BeginlO
BeginRefresh
BeginUpdate
378
335
257
258
365
420
420
433
231,234
389
390
390
390
391
22
23
22
427
427
12
14
234
34
420
272
146, 148
145
230,234
321
446
248
453
12
495
495
412
46
336
353
545
INDEX
BehindLayer
355
block movement operations
141
BltBitMap
401
BltBitMapRastPort
403
BltClear
403
BltMaskBitMapRastPort
404
BltPattem
405
BltTemplate
406
BMHD
216
BMHDreader
227
BNDRYOFF
391
BODY chunk
220, 222
Buffer parameter
139
BuildSysRequest
322
BumpRevision
372
Cdirectory
15
C handler routine
100
CAMG
221
Cause
245
CBump
411
CCRTchunk
219
CDInputHandler
489
CEND
411
ChangeSprite
433
channel allocation map
146
ChecklO
268
CHRS chunk
229
Chunks
216, 230,234
CIA timer
179
ClearDMRequest
322
OearEOL
385
ClearMenuStrip
318
ClearPointer
332
ClearRectRegion
421
ClearRegion
421
OearScreen
385
CLI commands
20
ClipBlit
407
clipboard device
141
clipping rectangles
347
Close
46
Close
278
Close_AlIO
9, 10
CloseDevice
266
CloseDeviceQ
44
CloseFont
428
546
45,226
OoseltO
262
OoseLibrary
326
OoseScreen
302
OoseWindow
326
CloseWorltBench
218
CMAP
228
CMAPchunk
CMD_READ
49,58,166,191
CMD_RESET
49
49, 58, 192
CMD_WRITE
412
CMove
493
CmpTime
186
CmpTimeO
228
Color cycling
218
color register
218
colormap
511
Command
commercial software developers
215
communication channels
8
Complicated strings
530
compression
218
ConfigBoard
478
479
ConfigChain
491
Console library
console device
111
113
control strings
85
controller types
ConUnit structure
138
cookie cut
409
CopyMem
275
275
CopyMemQuick
421
CopySBitMap
348
CreateBehindLayer
282
CreateDir
291
CreateProc
CreateUpfrontLayer
349
CRLF
511
CRNGchunk
219
CurrentDir
282
CurrentTime
337
CustomPrinter
498
412
CWait
Cycles
154
INDEX
ABACUS
data pointer
48
222
data report
DateS tamp
292
dead keys
530
Deallocate
246
242
Debug
decimal string
119
Delay
292
DeleteFile
283
DeleteLayer
361
Density
500
221
depth
234
dest
DestCols
73
DestRows
73
device
37
device block
191
device command
47
device request structures
39
device specific support routines
49
DeviceData
506
293
DeviceProc
16
devs directa:y
dfh_FileID
519
dfh_Name
519
dth_Node
519
dfh_Revision
519
dfh_Segment
519
dfh_TF
519
direction
220
242
Disable
203
disk editor
DiskFont library
449
407
DisownBlitter
227
Display screen size
DisplayAlert
323
DisplayBeep
327
447
DisposeFontContents
361
DisposeLayerInfo
421
DisposeRegion
DoCollision
434
267
DolO
47
DolOO
13,277
DOS library
double precision (IEEE) numbers
453
DoubleOick
338
DoubleOick structure
Draw
DrawBooJer
DrawCircle
DrawEllipse
DrawGList
DrawImage
DupLock
duration
497
385
332
386
386
435
333
287
234
emergency exit
Enable
EndRefresh
EndRequest
Enqueue
Error handling
enorcheck
EID_READ command
EID_WRI'IE
Examine
Exec functions
Exec support function
exec library
Execute
Execute command
Exit
ExNext
Expansion library
Expunge
extended commands
Extfunc
45
242
336
323
355
252
201
8
191
192
283
37
38
236
295
15
293
283
477
46
49
46
FattenLayerInfo
fc_FileName
FC_FLAGS
fc_Style
fc_YSize
fch_FileID
fch_NumEntries
FFP
FFP
File menu
File menu title
File standards
files
FindConfigDev
351
516
516
516
516
515
515
454
461
17
17
215
25
479
EndUtxJate
547
INDEX
FindName
FindPon
FindResident
FindSemaphore
FindTask
FindToolType
fIre button
Flags
floating-point numeric formats
Flood
FONS chunk
FontContentsHeader
Forbid
forbidden register
Forgotten chunks
formatting
FPF_DISKFONT (2)
FPF_PROPROTIONAL (32)
FPF_REMOVED (128)
FPF_ROMFONT (1)
FreeBoon1Mem
FreeColorMap
FreeConfigDev
FreeCopList
FreeCprList
FreeDiskObject
FreeEntry
FreeExpansionMem
FreeFreeList
FreeGBuffers
FreeMem
FreePotBits
FreeRaster
FreeRemember
FreeSignal
FreeSprite
FreeSysRequest
FreeTrap
FreeVPortCopLists
FreeWBObject
freq parameter
FSF_UNDERLINED (1)
FSF_BOLD (2)
FSF_ITALIC (4)
FTXTformat
Function headers
548
253
261
241
273
255
372
89
30
453
392
229
515
243
12
228
196
517
517
517
517
480
397
480
413
413
gamepondevice
85
OCR (Group Code Recording)
194
generic device support routines
49
GetCC
276
GetColorMap
397
481
GetCurrentBinding
GetDefPrefs
338
GetDiskObject
369
GetGBuffers
436
GetIeon
367
GetMsg
260
GetPacket
296
GetPrefs
338
GetRGB4
397
327
GetScreenData
GetSprite
436
GetWBObject
365
GPCT_ABSJOYSTICK
89
GPCT_MOUSE
88
GPCT_REUOYSTICK
89
GRAB chunk
220
Graphic printout settings
499
Graphics library
299, 376
greeting entry
5
368
hardcopy line
Irakr
Hikeymap
507
216
124
icon library
IEEEDPAbs
IEEEDPAcos
IEEEDPAdd
IEEEDPAsin
IEEEDPAtan
IEEEDPCeil
IEEEDPCmp
IEEEDPCos
IEEEDPCosh
IEEEDPDiv
IEEEDPExp
IEEEDPFieee
IEEEDPFix
IEEEDPFloor
IEEEDPFlt
IEEEDPLog
IEEEDPLoglO
364
462
467
462
468
468
463
463
468
468
464
468
468
464
464
464
469
469
249
481
371
435
248
473
378
336
257
435
324
258
413
365
172
516
516
516
229
6
ABACUS
IEEEDPMul
IEEEDPNeg
IEEEDPPow
IEEEDPSin
IEEEDPSincos
IEEEDPSinh
IEEEDPSqrt
IEEEDPSub
IEEEDPTan
IEEEDPTanh
IEEEDPTieee
IEEEDPTst
IFF (Interchange File Format)
ll...BMFORM
Info
InitAnimate
InitArea
InitBitMap
InitCode
InitGels
InitGMasks
InitLayers
InitMasks
InitRastPort
InitRequester
InitResident
InitSemaphore
InitStruct
InitTmpRas
InitView
InitVPort
Input
input device
input handler
input parameters
Input_Handler
INS 1
INSI chunk
Insert
InstallClipRegion
InterLeaved BitMap
interrupt
interrupt structure
IntuiTextLength
Intuition
Intuition library
INDEX
465
465
469
470
469
469
470
465
470
470
471
465
215
227
284
437
392
379
240
437
438
351
438
379
324
241
270
240
393
414
414
288
93
94
7
100
231
231
250
356
216
199
199
333
17
299
IOAudio SbUcture
IoErr
IOF_QUICK flag
IOReplyPort
IORequest Structure
iouCCount variable
IRevchunk
IsInteractive
ItemA~
39
288
48
39
37
190
230
289
318
528
528
18
107
81
KC_VANILLA
KCF_STRING
Key response
key repeat speed
keyboard device
keyboard shortcuts
keymap
keymap structure
KeyMapTypes
Keypresses
keyRptSpeed field
Keys element
Keys parameter
KeyToy
Keywords
Kickstart
527
124
527, 528
90
497
90
109
538
29
6
Ldirectory
label buffer
Lattice C compiler
Layexs
layers library
Length
library version
library version number
libs directory
Line
LineSpace
Lokeymap
LoadRGB4
LoadSeg
LoadView
Lock
LockIBase
LockLayer
LockLayerInfo
LockLayerRom
15
191
453,513
347
299, 347
139
6
6
16
511
511
124
398
295
414
289
342
356
357
422
17
549
INDEX
LockLayers
locks
loop
machine language routine
macro recorder
MainO
major version
MakeDosNode
MakeFunctions
MakeLibrary
MakeScreen
MakeVPort
Management systems
Masking
MatchTooIValue
math library
MathleeeDoubBas library
MathleeeDoubTrans library
MathTrans library
Maxima
menu line
menu titles
Menus
Message ports
MFM
minor version
mode parameter
ModifyIDCMP
ModifyProp
Mouse pointer
mouse port
mouse speed
mouth
Mouth_ExpungeO
Mouth_initO
Mouth_RoutineO
MoveLayer
MoveLayerInFrontOf
MoveScreen
MoveSprite
MoveWindow
MrgCop
multitasking operating system
NAME chunk
narrata device
550
357
25
21
100
101
11,20
5
481
262
263
327
415
8
217
373
453
464
469
458
75
17
17
17
40
194
5
171
303
314
497
109
108
169
172
172
172
357
358
328
439
303
415
8
230,234
168
NewFontContents
NewLayednfo()
NewModifyProp
NewRegion
Notepad flags
nPlanes
447
351
314
422
35
217
ObtainConfigBinding
ObtainSemaphore
ObtainSemaphoreList
482
271
272
315
319
264
315
319
46
279
9
266
37
448
428
264
37
270
328
304
330
5
30
422
423
290
511
227
407
0ftGadget
OtlMenu
OldOpenLibrary
OnGadget
OnMenu
Open
Open
Open_AlIO
OpenDevice
0penDevice()
OpenDiskFont
OpenFont
OpenLibrary
OpenLibraryO
OpeoResource
OpenScreen
OpenWindow
OpenWorlcBench
operating system version
Or charocter
OrRectRegion
OrRegiooRegioo
Output
OutPutBuffer
OverScan
OwnBlitter
Pal
Padl
pageHeight
pageWidth
PaperLength
PaperSize
Papetrype
parallel device
PARB_SHARED flag (32)
ParentDir
220
218,219
218
218
499
499
499
50
50
285
INDEX
ABACUS
partial functions
512
508
IXCPBothReady
507
IXCPrintBuf
507
IXCPWrite
pe(C8BitChars
513
508
pe(COose
pe<CColorClass
509
pe(CCommands
510
pecCCommandTable
510
ped,- DoSpeeial
511
ped_Expunge
508
ped_Init
506, 508
ped_MaxColwnns
509
ped_MaxXDots
509
ped_MaxYDots
510
IJe'CNwnCharStes
509
ped_NwnRows
509
508
ped-Open
ped_PrinterClass
509
ped_Reodel'
511
ped_TimeoutSecs
513
ped_XDotsInch
510
ped_YDotsInch
510
period calculation
152
Permit
243
phoneme codes
168
pitch parameter
171
planeMask
221
planePick
221
Pointennatrix field
497
PolyDraw
386
Potgo library
474
PRD_DUMPRPORT command
73
precedence nwnber
147
Preferences program
90
Preferences sttucture
496
PrintAspect
499
Printer settings
498
printer commands
72
printer device
68
printer driver
505
printer escape sequences
69
PrinterData
506
PrinterExtendedData structure
506
PrinterSegment
506
PrintFlags
499
PrintImage
PrintIText
PrintLeftmargin
PrintMaxHeight
PrintMaxWidth
PrintPitch
PrintQuality
PrintRightMargin
PrintShade
PrintSpacing
PrintThreshold
PrintXOffset
Program header
Project
PutDiskObject
PutIcon
PutMsg
PutWBObject
499
334
499
500
500
499
499
499
499
499
499
500
4
30
369
368
259
366
QBlit
QBSBlit
QueuePacket
Quotation marks
408
408
297
22
Rate
Raw data
RawDoFmt
RAWKEY number
RawKeyConvert
Real
Read ToolTypes
ReadEvent
ReadExpansionByte
ReadExpansionRom
Readlt()
ReadPixel
RectFill
RefreshGadgets
RefreshGList
RefreshWindowFrame
register
ReleaseConfigBinding
ReleaseSemaphore
ReleaseSemaphoreList
RemakeDisplay
RemBob
RemConfigDev
171,219
194
275
525
489
279
26
89
483
483
226
387
394
316
316
306
12,231
484
271
273
337
439
484
551
INDEX
RemDevice
RemFont
RernHead
Remffiob
RemIntServer
RernLibrary
Remove
RemoveGadget
RemoveGList
RemPort
RemResource
RemSemaphore
RemTail
RemTask
RemVSprite
Rename
Render
repeat threshold
repetition threshold
ReplyMsg
ReportMouse
Request
Requesters
reserved keyboard codes
reset routines
RethinkDisplay
return parameters
RLSE chunk
Rom Boot library
266
429
252
440
245
263
252
317
317
259
270
274
252
255
440
285
511
108
497
260
343
325
17
140
83
337
7
234
490
S directory
ScreenToBack
ScreenToFront
ScrollLayer
ScrollRaster
ScrollVPort
sector
SectorBuffer
Seek
SendIO
SendIOO
separator characters
Serial data transfer
Serial device errors
serial device
serial interfaces
15
330
330
358
388
416
190
191
280
268
47
21
500
64
57
60
552
SerParShk
SerRWBit
SerStopBuf
SetAfPt
SetAPen
SetBPen
SetCollision
SetComment
SetCurrentBinding
SetDMRequest
SetDrMd
SetDrPt
SetExcept
SetFont
SetFunction
SetIntVector
SetMenuStrip
SetOPen
SetPointer
SetPrefs
SetPrefsO
SetProtection
SetRast
SetRGB4
SetRGB4CM
SetSignal
SetS oftS tyle
SetSR
SetTaskPri
SetWindowTitles
SetWrMsk
sex parameter
SHDR chunk
ShowTitle
SID's SEvents
Signal
single precision (FFP) numbers
SizeLayer
SizeWindow
SMUS music format
SortGList
SPAbs
SPAcos
SPAdd
SPAsin
SPAtan
500
500
500
394
380
380
440
285
484
325
381
381
256
429
264
244
319
395
334
343
502
286
382
399
399
256
430
243
255
307
382
171
230
331
231
257
453
359
307
230
441
451
455
451
456
456
ABACUS
SPCmp
452
456
SPCos
SPCosh
457
SPDiv
452
SPECIAL_lRUSTME flag
80
SPExp
457
SPFieee
457
SPFix
452
SPFIt
453
SPLog
458
SPLoglO
458
SPMul
453
SPNeg
453
SPPow
458
Sprites
221
SPRT
221
SPSin
459
SPSincos
459
SPSinh
459
SPSqrt
460
SPSub
454
SPTan
460
SPTanh
460
SPTieee
461
SPTst
454
stack pointer (SP)
12
Standard device blocks
39
startup-sequence
15
status
197
Stealing
147
string descriptor
134,529
string packet
203
SubTime
494
186
SubTimeO
SumKickData
274
SumLibrary
265
243
SuperState
supervisor stack pointer (SSP)
12
SwapBitsRastPortClipRect
359
511
SWITCH construct
423
SyncSBitMap
SYS
16
14
system directories
system libraries
9
system structures
495
system support
14
INDEX
Tdirectory
tempo
terminators
Text
TextLength
tCAccessors
tCBaseline
tCBoldSmear
tCCharKem
tCCharSpace
tf_Flags
tCHiChar
tCLoChar
tf_Module
tf_Style
tCYSize
ThinLayerlnfo
time intervals
Timeout
Timeout parameter
Timer library
timer device
timeval
Tool
ToolTypes
trackdisk device
tracks
1RAKchunk
Transfer protocols
Transferring data
translate() routine
Translator library
TYPE
TypeOfMem
UCopperListInit
undefined keyboard codes
Unit parameter
UnLoadSeg
UnLock
UnlockIBase
UnlockLayer
UnlockLayerlnfo
UnlockLayerRom
UnlockLayers
UpfrontLayer
16
230
52
387
388
520
520
520
521
520
520
520,521
520,521
520
520
520
362
497
90
109
495
179
181
30
34
189
194
231
60
51
168
476
29,231
276
416
140
85, 179, 190
296
290
343
362
363
424
362
360
553
INDEX
user interaction
user stack pointer (USP)
User_Routine
UserState
VBeamPos
Version
version number
vertical blank
YHDRchunk
ViewAddress
ViewMode
ViewPortAddress
Wait
WaitBlit
WaitBOVP
WaitForChar
WaitIO
WaitPort
WaitTOF
WaveForm
WaveLength
WBtn:hToBock
WBenchToFront
WhichLayer
WindowLimits
WindowToBack
WindowToFront
wordperlod
Workbench
Workbench messages
Write
WriteExpansionByte
WritePixel
WritePotgo
19
12
100
244
416
8
5
179
234
344
221,228
344
256
409
417
293
269
260
417
154
154
331
331
360
308
308
309
152
6,498
34
281
485
389
473
xAspect
XDelta
XorRectRegion
XorRegionRegion
218
90, 109
424
424
yAspect
YDelta
218
90, 109
554
Companion Diskette
AMIGA
Advanced System
Programming
CompanIon dIskette
For your convenience, the program listings contained in this book are
available on an Amiga formatted floppy disk. You should order the
diskette if you want to use the programs, but don't want to type them
in from the listings in the book.
All programs on the diskette have been fully tested. You can change the
programs for your particular needs. The diskette is available for $14.95
plus $2.00 ($5.00 foreign) for postage and handling.
When ordering, please give your name and shipping address. Enclose a
check, money order or credit card information. Mail your order to:
Abacus Software
5370 52nd Street SE
Grand Rapids, MI49512
For fast service, call 616/698-0330
Credit Card orders only 1-800-451-4319
liHiHIHll1
No Optional Disk
Available
$14.95
1612
Save Time and Money!-Optional program disks are available for all our Amiga reference
books (except Amiga for Beginners and AmigasDOS Quick Reference) . Programs listed in
the book are on each respective disk and saves countless hours of typing! $14.95
3-~
IliiiliHIHI
$14.95
116n
IOptional Diskette
$14.95
11662
Save Time and Moneyl-Optional program disks are available for all our Amiga reference
books (except Amiga for Beginners and AmigasDOS Quick Reference). Programs listed in
the book are on each respective disk and saves collntless hours of typing! $14.95
$14.95
#617
$14.95
#607
Save Time and Money!-Optional program disks are available for all our Amiga reference
books (except Amiga for Beginners and AmigasDOS Quick Reference). Programs listed in
the book are on each respective disk and saves countless hours of typing! $14.95
~~a\\a\)\e 89
t-'
...
t1\bet
NO"~M4rH:::~=
:::::~::;:::.::
IOptional Diskette
$14.95
1697
IOptlonal Diskette
$14.95
1667
Save Time and Money!-Optional program disks are available for all our Amiga reference
books (except Amiga for Beginners and AmigasDOS Quick Reference). Programs listed in
the book are on each respective disk and saves countless hours of typing! $14.95
IOptlonal Diskette
$14.95
1672
IOptlonal Diskette
$14.95
1682
Save Time and Money!-Optional program disks are available for all our Amiga reference
books (except Amiga for Beginners and AmigasDOS Quick Reference). Programs listed in
the book are on each respective disk and saves countless hours of typing! $14.95
$14.95
1687
$14.95
1620
Save Time and Money!-Optional program disks are available for all our Amiga reference
books (except Amiga for Beginners and AmigasDOS Quick Reference). Programs listed in
the book are on each respective disk and saves countless hours of typing! $14.95
$14.95
'727
ISBN 155755-049-2
1-55755-021-2
$16.95
Vol. 2
0-916439-87-9
$24.95
Vol. 3
1-55755-044-1
$19.95
Vol. 4
1-55755-025-5
$19.95
Vol. 5
0-916439-88-7
$19.95
Vol. 6
1-55755-034-4
$34.95
Vol. 7
1-55755-047-6
$34.95
Vol. 8
1-55755-041-7
$19.95
Vol. 9
1-55755-042-5
$29.95
1-55755-045-X
$19.95
1-55755-046-8
$34.95
1-55755-051-4
$19.95
1-55755-052-2
$34.95
1-55755-057-3
$19.95
1-55755-049-2
9.95
Now
Presenting...
'A
.
'
,
All
.n
n
.. -r,. ,fa
rJrus rrotecfIon: ,DO.
Shipping
.. :' l
..
...,
'I~G : : : : : .. . ..... ~
m
'
,
' . _
.:Irna 160
Includes
page
I !!:.I~ guide to
Computer
I . Viruses!
AbacusllBl
5370 52nd Street S. E.
New Software
The Ideal AMiGA wordprocessor
TextPro
BeckerText
L -_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _~
AMIGA
TextPro AMIGA
sets a new standard
for word processing
packages in its price
range. So easy to
use and modestly
priced that any
AMiOA owner can
use it-so packed
with advanced
features, you can't
pass it up.
TextPro
ANIIGA
AMIGA
This is one program for ~ AMiOA owners.
BeckerText Amiga is more than a word processor. It
has alI the features of TextPro AMIGA, but it also has
features that you might not expect:
Fast WYSIWYG formatting
Calculations within a text-like having a spreadsheet
program anytime you want it
Templates for calculations in columns
Line spacing options
Auto-hyphenation and Auto-indexing
Multiple-coluIM printing, up to 5 coluIMS on a single
page
Online dictionary checks spelling in text as it's written
Spell checker for interactive proofmg of documents
Up to 999 characters per line (with scrolling)
Many more features for the professional
BeckerText AMIGA
is a vital addition for
C programmers-it's
an extremely flexible
C editor. Whether
you're deleting,
adding or duplicating
a block of C sourcecode, BeckerText
AMIGA does it alI,
automaticalIy.~d
---
Bec:lferText
AMIGA
---
Tho-...
$ 79.95
$150.00
Amiga
computers
Professional DataRetrieve
The Proressional Level
Database Management System
Professional DataRetrieve, for the Amiga 500/1000/2000,
is a friendly easy-to-operate professional level data management package with the features most wanted in a relational
data base system.
Professional DataRetrleve has complete relational data
mangagement capabilities. Define relationships between
different files (one to one, one to many, many to many).
Change relations without file reorganization.
Professional Data Retrieve includes an extensive programming laguage which includes more I1mn 200 BASIC-like
commands and functions and integrated program editor.
Design custom user interfaces with pulldown menus, icon
selection, window activation and more.
Professional DataRetrien can perform calculations and
searches using complex mathematical comparisons using
over 80 functions and consttmts.
Professional DatllRelrine is a friendly, easy to opera Ie
programmable RELATIONAL data base system. I'DR includes PROFIL, a programm ing language similar to BASIC.
You can open and edit up to 8 liIes simullancously and the
size of your data fields , records and files are limited only by
your memory and disk storage. You have complete interrelalion betwecn files which can include IFF graphics. NOT
COpy PROTECTED. ISBN 1-55755-048-4
MORE features of Professional DataRetrieve
Easily imporl daL.1 from other daL.1bases .... fiIe compatible
wilh standard Data Retrieve ....supports multitasking...design
your own custom forms with the completely integrated
printer mask editor....includes PROFIL programming language that allows the programmer to custom tailor his database requirements ...
MORE features of PROFIL include:
Open Amiga devices including the console, printer,
serial and the CLI.
Create your own programmable requestors
Complete error trapping.
Built-in compiler and much, much more.
$295.00
Th.
I'm/mi111
Iml
DnlnMu ...
Features
up to 8 files can be edited sirooltaneously
Maximum size 01 a data field 32,000 characters
(textlields only)
Maximum number 01 data fields limited by RAM
Maximum record size 01 64,000 characters
Maximum number 01 records disk dependent
(2,000,000,000 maximum)
Up to 80 index fields per file
Up to 6 field types - Text, Date, Time, Numeric,
IFF, Choice
Unlimited number of searches and subrange
criteria
Integrated list editor and lull-page printer mask
editor
Index accuracy selectable from 1-999 characters
Multiple file masks on-screen
Easily create/edit on-screen masks for one or
many files
User-programmable pulldown menus
Operate the program from the mouse or the key
board
Calculation fields, Data Fields
IFF Graphics supported
Mass-storage-oriented file organization
Not Copy Protected, NO DONGLE; can be in
stalled on your hard drive
ISBN 1-55755-047-6
90000