English Amiga Board


Go Back   English Amiga Board > Support > support.FS-UAE

 
 
Thread Tools
Old 29 August 2016, 17:38   #1
arodgers
 
Posts: n/a
Best way to write native code?

Long time lurker, new member here. Thanks for FS-UAE, it's an amazing piece of software.

Enough kissing up though, I have a question about writing native code libraries.

I've looked at the uni-sdk and that seems good for a lot of tasks, but is there a way to call back into 68k code with it?

Also, does the emulation continue to run while my native code is running or does it pause?

Is the old complicated way of writing native code still the best way? What are the limitations there?

Thanks
 
Old 31 August 2016, 21:52   #2
FrodeSolheim
FS-UAE Developer
 
FrodeSolheim's Avatar
 
Join Date: Dec 2011
Location: Førde, Norway
Age: 43
Posts: 4,043
Quote:
Originally Posted by arodgers View Post
Long time lurker, new member here. Thanks for FS-UAE, it's an amazing piece of software.
Thanks

Quote:
Originally Posted by arodgers View Post
Enough kissing up though
Fair enough

Quote:
Originally Posted by arodgers View Post
I've looked at the uni-sdk and that seems good for a lot of tasks, but is there a way to call back into 68k code with it?
No, at least not currently. There is support for exposing UAE functions to the native libraries, but right now this is limited to getting the UAE and UNI versions. Exposing more functionality is possible in the future.

Quote:
Originally Posted by arodgers View Post
Also, does the emulation continue to run while my native code is running or does it pause?
Yes, the native code is run in a thread, the Amiga caller task is suspended while waiting for the native code to complete, and UAE continues emulation.

(If you call into uaenative.library more directly, e.g. via assembly, you can also choose to run the native code synchrously, pausing the UAE emulation until the native code returns. You can also pass more parameters via registers this way. The Amiga-side UNI C header presents simplified functionality, because in many cases you are better off using a struct to pass complex arguments).

Quote:
Originally Posted by arodgers View Post
Is the old complicated way of writing native code still the best way? What are the limitations there?
IF by "old way" you mean the older WinUAE implementation, then the differences are:
* The old way is WinUAE-only.
* It only works with 32-bit code, it isn't 64-bit safe.
* It gives you access to the WinUAE hwnd object (though this can be added to the new native code system if needed).

The uaenative.library hasn't really changed since the initial release, mostly since it hasn't (as far as I know) seen any real usage. The interface will not be extended until there is a known use-case for it
FrodeSolheim is offline  
Old 01 September 2016, 11:24   #3
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,515
I am starting to think that native support should use hardware level emulated board to make it much much easier to support in any Amiga compatible OS. No need for annoying UAE traps.

It can be normal Z2 or Z3 autoconfig board, that you find using usual library calls, then allocate it, for example by reading from single IO address, you get back offset to your IO region. (or null if nothing available). Write commands to some IO region, you get back something. Free the board when not needed anymore.
Toni Wilen is offline  
Old 02 September 2016, 18:53   #4
thellier
Registered User
 
Join Date: Sep 2011
Location: Paris/France
Posts: 274
Hello

>native support should use hardware level emulated board
Nice :-) is it planned for a next release ;-) soon ? :-)
BTW @Frode : native.library should be enhanced to be usable with OS4/WinUAE-ppc ...

Keep on the good works

Alain
thellier is offline  
Old 02 September 2016, 19:53   #5
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,515
OS4 support can become either really tricky or really slow because there is no 1:1 address mapping. Logical address sent to native side is useless under OS4.

Slow would equal "indirect" trap system where "bounce buffer" is needed, instead of directly using some memory address (which is not going to work because logical address won't be same as physical), data is first copied to hardware board address (because it is hardware board, it has logical == physical mapping), then "other side" can read it. And vice versa. Obviously it is much slower than direct access.
Toni Wilen is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
native x86 code in WinUAE? Falk support.WinUAE 20 21 January 2023 18:30
FS-UAE Native Code? jdog320 support.FS-UAE 2 26 July 2016 11:03
Native (UAE) DataTypes Roland007 request.UAE Wishlist 5 11 February 2013 05:44
How about Native Client? mc6809e request.UAE Wishlist 20 05 February 2012 12:49
3D code and/or internet code for Blitz Basic 2.1 EdzUp Retrogaming General Discussion 0 10 February 2002 11:40

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:12.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07027 seconds with 13 queries