Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
48 user(s) are online (32 user(s) are browsing Forums)

Members: 0
Guests: 48

more...

Support us!

Headlines

 
  Register To Post  

How to use EmulateTags() call
Just popping in
Just popping in


See User information
I'm trying to use the EmulateTags() function to access a 68K-only library.

I'm getting a crash reported when the following line executes:

BoardInfoPtr = (struct BoardInfo*) EmulateTags((APTR) (BoardsBase - 0x24), ET_RegisterD0, SB_DISABLE_CUSTOMCHECK, TAG_DONE);

The library is already open and its address is in BoardsBase. The function I want to access in this case is AllocBoardInfo() which has an offset of $24.

The 68K version works fine even on OS4 so it seems to be an issue with how I am calling EmulateTags() rather than with boards.library itself. I assume I don't need to use GetInterface() as it's a 68K-only library.


Edited by Minuous on 2013/8/14 21:24:07
Go to top
Re: How to use EmulateTags() call
Not too shy to talk
Not too shy to talk


See User information

If you call the library like this, you expect that there never will be a ppc native version of boards.library. Is this what you want? Otherwise you should rather create a boards.l.main and use the ppc native interface.

Regarding EmulateTags, I guess you have to add ET_RegisterA6,BoardsBase.


Go to top
Re: How to use EmulateTags() call
Just popping in
Just popping in


See User information
>Regarding EmulateTags, I guess you have to add ET_RegisterA6,BoardsBase.

Still has the same problem even when using that tag...

Go to top
Re: How to use EmulateTags() call
Just can't stay away
Just can't stay away


See User information
When doing LVO library calls with EmulateTags() you can specify the LVO offset using ET_Offset.

This is from the source code of a xpkmaster.l.main file:
LONG _Xpkmaster_XpkExamine(  
  
struct XpkmasterIFace *Self,
  
struct XpkFib fib,
  
struct TagItem tags)
{
  
struct Library *LibBase Self->Data.LibBase;
  
struct ExecIFace *IExec = (struct ExecIFace *)Self->Data.IExecPrivate;
  
LONG retval;
  
ULONG *regs = (ULONG *)(((struct ExecBase *)(IExec->Data.LibBase))->EmuWS);
  
ULONG save_a6 regs[14];

  
retval = (LONG)IExec->EmulateTags((APTR)LibBase,
    
ET_Offset,     -36,
    
ET_RegisterA0fib,
    
ET_RegisterA1tags,
    
ET_RegisterA6LibBase,
    
TAG_DONE);

  
regs[14] = save_a6;
  return 
retval;
}


You can get the full source here:
http://os4depot.net/index.php?functio ... sc/xpkmaster-gluefile.lha

The "(BoardsBase - 0x24)" you have in your code likely doesn't do what you want because the BoardsBase variable points to a struct Library so you are subtracting 0x24 * sizeof(struct Library) bytes from the pointer rather than just 0x24 bytes. In order to get the result you want you would have to change it to "((uint8 *)BoardsBase - 0x24)".

Go to top
Re: How to use EmulateTags() call
Just popping in
Just popping in


See User information
OK, many thanks.

Go to top
Re: How to use EmulateTags() call
Home away from home
Home away from home


See User information
Quote:

thomas wrote:

If you call the library like this, you expect that there never will be a ppc native version of boards.library. Is this what you want? Otherwise you should rather create a boards.l.main and use the ppc native interface.


True. However, if you still want to use EmulateTags(), then the best thing to do would be to call IExec->IsNative(funcPtr) first to check if it's native or 68K, and then either call directly, or use EmulateTags().

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: How to use EmulateTags() call
Not too shy to talk
Not too shy to talk


See User information

Actually it should be sufficient to try GetInterface(LibBase,"main"). If it fails, call the 68k functions with EmulateTags and if not, call the functions from the interface.


Go to top

  Register To Post

 




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




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project