Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-01

location modifier

8 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner

Hi,

I can't find the 'location' modifier in the docs. Is it missing?

For example:

function bsd_socket(Domain: LongInt location 'd0'; Type_: LongInt
location 'd1'; Protocol: LongInt location 'd2'): LongInt; syscall
SocketBase 30;

See for example packages/rtl-extra/src/amiga/sockets.pp

Mattias

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote
Hi, I can't find the 'location' modifier in the docs. Is it missing?

I didn't even know this modifier existed.
Let alone that I know what it does....
(although I can take an educated guess)

Michael.

Karoly Balogh (Charlie/SGR
to Mattias Gaertner: I can't find the 'location' modifier in the docs. Is it missing? For example: function…

Hi,

Mattias Gaertner wrote 9 lines
I can't find the 'location' modifier in the docs. Is it missing? For example: function bsd_socket(Domain: LongInt location 'd0'; Type_: LongInt location 'd1'; Protocol: LongInt location 'd2'): LongInt; syscall SocketBase 30; See for example packages/rtl-extra/src/amiga/sockets.pp

This modifier only exist for Amiga-library ABI syscalls, therefore only available on m68k-amiga and powerpc-morphos (where it's called the legacy library ABI). It's there to help the compiler to know which value to put into which register, before a library call happens. These registers are explicitly defined in C/assembly, without any common ABI, and it's is heavily macroed when using a a C compiler. On Amiga, we used umpzillion asm-written/generated wrappers before syscalls existed (1.0.x times and before), which was very ugly, slow, and bloated.

The location modified is only valid together with the syscall modifier. It actually exists since 2005, or so, when I refused to reinvent the umpzillion asm wrappers stunt for MorphOS, so Florian helped me to come up with this solution.

And there's no need to take educated guesses, it's all documented in the wiki:

http://wiki.freepascal.org/Amiga#Introduction_to_SysCalls http://wiki.freepascal.org/MorphOS#Introduction_to_SysCalls

From syntax PoV, the argument is always a two character string, and can

contain 'd0'-'d7', and 'a0'-'a6', which are the 68k CPU's data and address registers, respectively.

Syscalls also exist on AROS/i386 and AROS/x86_64 (for now), but there the locations are defined by the ABI, without the need to be specified explicitly. In the future, I plan to reuse syscalls and the location syntax for a possible Atari port too.

If there are any more questions, I'm happy to answer.

Charlie

Mattias Gaertner
to Michael Van Canneyt: I didn't even know this modifier existed. Let alone that I know what it does....…
Show quoted text 11 lines
On Mon, 18 Jan 2016, Mattias Gaertner wrote: > Hi, > > I can't find the 'location' modifier in the docs. Is it missing? I didn't even know this modifier existed. Let alone that I know what it does.... (although I can take an educated guess)

Yes, me too.
But to fix
http://bugs.freepascal.org/view.php?id=29350
I need scope and order.

Is it Amiga only?

Mattias

Mattias Gaertner
to Karoly Balogh (Charlie/SGR: This modifier only exist for Amiga-library ABI syscalls, therefore only available on…
Show quoted text 17 lines
[...] And there's no need to take educated guesses, it's all documented in the wiki: http://wiki.freepascal.org/Amiga#Introduction_to_SysCalls http://wiki.freepascal.org/MorphOS#Introduction_to_SysCalls From syntax PoV, the argument is always a two character string, and can contain 'd0'-'d7', and 'a0'-'a6', which are the 68k CPU's data and address registers, respectively. Syscalls also exist on AROS/i386 and AROS/x86_64 (for now), but there the locations are defined by the ABI, without the need to be specified explicitly. In the future, I plan to reuse syscalls and the location syntax for a possible Atari port too. If there are any more questions, I'm happy to answer.

Thanks.

Mattias

Karoly Balogh (Charlie/SGR
to Sven Barth

Hi,

Sven Barth wrote 5 lines
Am 18.01.2016 17:00 schrieb "Karoly Balogh (Charlie/SGR)" : > In the future, I plan to reuse syscalls and the location > syntax for a possible Atari port too. Who are you and what have you done with Charlie? :P

Haha! :D I have eaten him! :D

Nah, seriously, at a recent demoparty I negotiated with an Atari guy who sits on a pile of Atari Falcon 030s, so I could get one from him in exchange of getting FPC, or at least FPC-compiled programs working on it... :)

And it just seemed "easy enough" to get some basic stuff working in exchange of such a rare beast of a machine... :) And one can never know, maybe other 68k-guys would be interested, if their platform was supported... And there's the ColdFire-based FireBee computer with Atari-origins, which would be then the fastest 68k for us to run on... (Aside from emulation based solutions.)

Charlie

Sven Barth
to Karoly Balogh (Charlie/SGR

Am 18.01.2016 18:19 schrieb "Karoly Balogh (Charlie/SGR)" <

Show quoted text 26 lines
: Hi, On Mon, 18 Jan 2016, Sven Barth wrote: > Am 18.01.2016 17:00 schrieb "Karoly Balogh (Charlie/SGR)" < : > > In the future, I plan to reuse syscalls and the location > > syntax for a possible Atari port too. > > Who are you and what have you done with Charlie? :P Haha! :D I have eaten him! :D Nah, seriously, at a recent demoparty I negotiated with an Atari guy who sits on a pile of Atari Falcon 030s, so I could get one from him in exchange of getting FPC, or at least FPC-compiled programs working on it... :) And it just seemed "easy enough" to get some basic stuff working in exchange of such a rare beast of a machine... :) And one can never know, maybe other 68k-guys would be interested, if their platform was supported... And there's the ColdFire-based FireBee computer with Atari-origins, which would be then the fastest 68k for us to run on... (Aside from emulation based solutions.)

Oh, cool. I have Atari support as a very long term point on my ToDo list, so you're welcome to do get this working before me :)

Regards,
Sven