View Single Post
Old 30 December 2013, 18:04   #32
FrodeSolheim
FS-UAE Developer

FrodeSolheim's Avatar
 
Join Date: Dec 2011
Location: Førde, Norway
Age: 36
Posts: 3,368
Current low-level interface, temporarily using the ahi_winuae demuxer. I don't mind at all the interface being moved to a memory-resident library instead afterwards.

Open library: d0 = 199
* a0 - pointer to name of native library
* a1 - pointer to 32-bit result value (library handle or error)
* d1 - minimum required native library version

The returned library handle is not an address, but an opaque handle. If the high bit of of the result is set, the operation failed and the 32-bit value represents an error code.

Get function address: d0 = 198
* a0 - pointer to name of function
* a1 - pointer to 32-bit result value (function handle or error)
* d1 - library handle

The result in a1 is similar to the open library call.

Call function: d0 = 197
* a0 - function handle
* d1 .. d6 - 6 32-bit parameters
* d7 - function call flags
* a7 - pointer for error result (to indicate an invalid function call, or invalid flags, etc)? - Not implemented yet, but could be useful, at the expense of the caller must always provide a valid pointer or 0 here. Optionally, a flag in d7 could be used to specify if the error register pointer is valid or not to avoid one register write if one is not interested in the error (should really not be necessary if the native interface is used correctly).

Close library: d0 = 196
* d1 - library handle

The register usage is somewhat random and can easily be changed at this point. Please suggest other register usage where that is more optimal. For examlpe, is it generally more useful to the Amiga side to pass the parameters using address registers instead? (For example for cases where the parameters are struct pointers? Or perhaps to optimize register usage for a certain "standard" C calling convention as mentioned earlier.

And of course, more than 6 parameters could be used - but I guess that if you need much more than that, you'll probably be passing structs already...
FrodeSolheim is offline  
 
Page generated in 0.06322 seconds with 9 queries