Dmitry,

I'm curious...how do you pass parameters to the functions you are calling?  How
are the types and values specified, and how are they pushed onto the stack?

That aside, I think that you can do the following to call your functions:

void CallTrap (UInt16 trapWord)
{
     // Write a small code stub that invokes the Palm OS function
     // and then returns.

     UInt16    code[3];

     code[0] = 0x4E4F;   // TRAP $F opcode
     code[1] = trapWord; // System function selector
     code[2] = 0x4E75;   // RTS opcode

     // Get a pointer to the code we created, and cast it as a function pointer.

     typedef void (*FnPtr) (void);
     FnPtr     fn = (FnPtr) &code[0];

     // Call the "function" we created.

     fn();
}

-- Keith Rollin
-- Palm OS Emulator engineer





Dmitry Yakimov <[EMAIL PROTECTED]> on 02/17/2001 04:40:39 AM

Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>

Sent by:  Dmitry Yakimov <[EMAIL PROTECTED]>


To:   "Palm Developer Forum" <[EMAIL PROTECTED]>
cc:    (Keith Rollin/US/PALM)
Subject:  Hmm, the puzzle



Hello Palm,

  Try to imagine - I have got some data in some resource.
  This data is 2-bytes words and they mean trap codes to call palmAPI.
  Then in code I need to write a cycle, that get this numbers from the
  resource and call palmAPI functions with this numbers.

  Motorola did not make command trap reg, and I'm confused :(
  And palm do not allow me for example to compile trap #xxxx, and
  then, before of each call change #xxxx because it is protected
  storage and dwWrite works too long.

  What may I do? Please help if you know something - it is live
  important question for me.

--
Best regards,
 Dmitry Yakimov




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to