Overview Features Coding ApolloOS Performance Forum Downloads Products Order Contact

Welcome to the Apollo Forum

This forum is for people interested in the APOLLO CPU.
Please read the forum usage manual.
Please visit our Apollo-Discord Server for support.



All TopicsNewsPerformanceGamesDemosApolloVampireAROSWorkbenchATARIReleases
Questions and Answers for AMIGA Workbench or Coffin

Api2

Vojin Vidanovic
(Needs Verification)
Posts 1916/ 1
18 Nov 2019 00:23


Website
EXTERNAL LINK 
Download
EXTERNAL LINK 
Hardware and system requirements
The library and most of the demos require AmigaOS 3.x and up to 4MB RAM (most of demos require a lot less memory). MouseMove1, Panel3, CustomClass1, ProgressBar2 demos will work efficiently only on faster computers.

Additional information
The project is in the initial phase and certainly contains errors that can lead to the system crash, additionally it does not release all allocated resources. You should have it in mind when running the attached demos.

API2
Amiga systems need new programs immediately. Ports are not a solution because they do not work well with the operating system and are not consistent with its philosophy. With a limited number of programmers, a solution is needed that will make their work more efficient. AmigaOS when it was created was a modern, easy-to-program system, but since then technology has made a progress, nowadays some things can be done more simply and quicker.

The goal of the API2 project is to provide these modern solutions to Amiga programmers, which will allow them to create better and more advanced programs quicker. Maybe it can also encourage people from outside the community to program for amiga systems.

Nothing speaks as good as an example. Both of the following programs do exactly the same, wait one second and then display the words "Time is up!". The first one is written using API2, the second uses only standard AmigaOS functions.

Z API2
#include <api2/api2.h>
#include <stdio.h>

int main()
{
    var application = AFCreateApplication();
    var timer = AFCreateTimer();
   
    AFAddEventHandlerFunction(timer, AFTimeIsUp, NULL,
        func (void, () { printf("Time is up!\n"); }));
       
    AFSetTimeout(timer, 1000);
    AFSetEnabled(timer, true); 
    AFRunMainLoop(application);
   
    return 0;
}
Bez API2
#include <exec/types.h>
#include <devices/timer.h>
#include <clib/exec_protos.h>
#include <clib/alib_protos.h>
#include <stdio.h>
#include <stdbool.h>

int main()
{
    struct timerequest *timeRequest;
    struct MsgPort *timerMsgPort;
    struct Message *timerMessage;
    int result = 0;

    if ((timerMsgPort = CreatePort(0, 0)))
    {
        if ((timeRequest = (struct timerequest*) CreateExtIO
            (timerMsgPort, sizeof(struct timerequest))))
        {
            if (!OpenDevice( TIMERNAME, UNIT_MICROHZ,
                (struct IORequest*) timeRequest, 0L))
            {
                timeRequest->tr_node.io_Command
                    = TR_ADDREQUEST;               
                timeRequest->tr_time.tv_secs  = 1;
                timeRequest->tr_time.tv_micro = 0;

                SendIO((struct IORequest*) timeRequest);
               
                while (true)
                {
                    WaitPort(timerMsgPort);
                   
                    if ((timerMessage = GetMsg(timerMsgPort)))
                    {
                        printf("Time is up!\n");
                       
                        ReplyMsg(timerMessage);
                        break;
                    }
                }

                CloseDevice((struct IORequest*) timeRequest);
            }
            else
            {
                printf("Error: could not OpenDevice\n");
                result = 1;
            }

            DeleteExtIO((struct IORequest*) timeRequest);
        }
        else
        {
            printf("Error: could not create IORequest\n");
            result = 1;
        }

        DeletePort(timerMsgPort);
    }
    else
    {
        printf("Error: could not CreatePort\n");
        result = 1;
    }
   
    return result;
}
The program using the API2 is several times shorter, easier to read, it is much harder to make a mistake in it and it can be written without problems even by a novice programmer, in addition to understand what it does, you do not even have to look at the documentation.

API2 is not only about easier and quicker programming. There are also a lot of new components supporting the implementation of various aspects of the application. For example, user interface animations:

screenshots/Animation.gif
FAQ
Will API2 be released for AmigaOS3.x/AROS/MorphOS?
API2 is from the very beginning designed and developed with all AmigaOS like system in mind.

Will programs written with API2 be much larger than existing programs?
As the example above shows, programs using API2 are not bigger but much smaller then these using only AmigaOS functions.

Are programs using API2 slower than existing programs?
During the design and development of API2, great effort is done to make its components work faster than other solutions of this type intended for AmigaOS like systems.

Will the same program using the API2 be able to run on all AmigaOS like systems?
API2 provides compatibility at the source code level between all AmigaOS like systems, so it is enough to recompile the application for a given system.

What is already ready?
The most important and the most arduous work is done. Basic functionalities are ready and they are foundation on which other elements are build. Some components of the user interface are very advanced and other non-visual ones as well.

Is AmigaOS3.x really treated as just as important as NG systems in this project?
Yes.

When will API2 be ready?
To get the basic planned functionality about half a year of one full-time developer work is needed.

How can I support the work on API2?
We run crowdfunding campaign on Patreon so you can support project development there. If you want to do this, click here.

To keep development going quickly and to reduce time between successive editions from years to months, at least one person must work on this project full time. To make it possible, funding is needed to cover the costs of salary, social security and taxes. If you like this project and want it to progress, please support it at Patreon

There is also another option. If you have a software project that you want to create, you can outsource it to TRIFLE, which will invest some of the profits in the development of API2.

posts 1