Amiga-Development

Please login or register.

Login with username, password and session length
Advanced search  

News:

Created for developers of all Amiga camps

Author Topic: Documentation for amiga based units.  (Read 469 times)

0 Members and 1 Guest are viewing this topic.

asrael22

  • Newbie
  • *
  • Posts: 31
    • View Profile
Documentation for amiga based units.
« on: August 08, 2017, 06:46:36 PM »

Hi.

Where can I get API documentation of the Amiga based units?
I mean, I can look at the RKRM library docs but using that under FreePascal is different.
In particular, I was searching for how to open a console window using amigados Open() call on a new screen.
But couldn't really find this as an example in the distribution.
Where could I get more information on this kind of stuff?


Manfred
Logged

magorium

  • Full Member
  • ***
  • Posts: 221
  • Programming is an art form that fights back
    • View Profile
Re: Documentation for amiga based units.
« Reply #1 on: August 08, 2017, 07:05:51 PM »

For some reason we seem active both at the same time  :D

Ok, in basics you can follow rkrm for 3.x. The only difference is that for a pointer to a structure Pascal uses by default P<name of structure> and for structures itself T<name of structure>. It is just a convention used in Pascal language.

But, Free Pascal itself also has its own RTL. Sometimes the names used in the Free Pascal RTL collides with those from native Amiga API.

For example Open() and Close() functions are also present inside Free Pascal RTL. Therefor it is a bit difficult to distinguish between those function from RTL and Native platform API.

To make that a bit easier for the end-user we've decided to rename some of the native API calls. A collection of those changes can be found on this wikipage.

Edit:
Please also note that some of the units names (what c programmers name include files) are changed as Free Pascal RTL has it's own DOS and Graphics untis. e.g. resp. AmigaDOS and AGraphics for Amiga.

In addition to that: whenever c includes a specific includefile, for example, exec/interrupts.h, it is enough for Free Pascal to add the exec unit to your uses clause. This contains all header information that c has split-up in separated header files.
« Last Edit: August 08, 2017, 07:18:39 PM by magorium »
Logged

asrael22

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Documentation for amiga based units.
« Reply #2 on: August 08, 2017, 07:15:46 PM »

Alright, thanks. That's useful.

The BPTR, the result of the Open() call, do I just take a longint in Pascal?


Manfred
Logged

magorium

  • Full Member
  • ***
  • Posts: 221
  • Programming is an art form that fights back
    • View Profile
Re: Documentation for amiga based units.
« Reply #3 on: August 08, 2017, 07:19:59 PM »

The BPTR, the result of the Open() call, do I just take a longint in Pascal?
Use a BPTR.

It is a type that is declared in either Exec or AmigaDOS (sorry i do not even know that from memory :shame:).

Edit: BPTR type is declared inside unit exec.

In case you wish to have a quick overview have a look at the online units here.

For instance the exec unit can be viewed here.

The followng is a small excerpt from that unit, declaring the basic native API types
Code: [Select]
96 TYPE
97
98        STRPTR   = PChar;
99        ULONG    = Longword;
100        LONG     = longint;
101        APTR     = Pointer;
102        BPTR     = Longint;
103        BSTR     = Longint;
104        BOOL     = smallint;
105        UWORD    = Word;
106        WORDBITS = Word;
107        LONGBITS = longword;
108        PLONGBITS = ^LONGBITS;
109        UBYTE    = Byte;
110        PULONG   = ^longword;
111        PAPTR    = ^APTR;
112        PLONG    = ^LONG;

Note the P in front of a pointer to a specific type (which differs from c code which uses a circumflex).
« Last Edit: August 08, 2017, 07:29:22 PM by magorium »
Logged

asrael22

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: Documentation for amiga based units.
« Reply #4 on: August 08, 2017, 07:30:33 PM »

Yeps, that's great, thanks.


Manfred
Logged

ALB42

  • Moderator
  • Newbie
  • *****
  • Posts: 39
    • View Profile
Re: Documentation for amiga based units.
« Reply #5 on: August 08, 2017, 09:18:29 PM »

I mostly use
http://www.alb42.de/fpc-docu/
;)
In principle it's only for AROS but they share the same API, so they should be rather the same. the last difference then you can see in the source as magorium already pointed to.

mostly I use http://www.alb42.de/fpc-docu/index-8.html which is a list of all function types and constants and then I search with Ctrl+F ;)
Logged

magorium

  • Full Member
  • ***
  • Posts: 221
  • Programming is an art form that fights back
    • View Profile
Re: Documentation for amiga based units.
« Reply #6 on: August 11, 2017, 12:27:35 AM »

Aaargh !  :-[

I keep forgetting about those links. Thank you very much for mentioning those links ALB42 !

fwiw: the wiki-page with Aros (and Amiga) related specifics (here), was updated to (hopefully) reflect current FPC trunk status.
« Last Edit: August 11, 2017, 12:29:13 AM by magorium »
Logged