I am keen to know how it is done please? for example Simon's CHM has
Quote:
syscall 0x0003 : void DrawHourGlass( int HourGlassBitmapNumber );
Displays one of the four the HourGlassBitmaps (direct draw).
but it is not in my libraries I think or perhaps there will be some other currently undocumented syscalls I would like to try please - so what is the way to achieve this straight in the source code of an addin without recompiling libraries to begin with please.

I have found this
Tari wrote:
asm.h (moved to fxcg/syscall.h in my work which isn't mainline yet) provides macros for syscalls. Your inline assembly is still subject to the alignment issue you encountered earlier, as it happens.

Code:
__asm__("#include <asm.h>\n"
         "\tSYSCALL(_garbage_syscall, 0xFFFF)");

void garbage_syscall();

int main(int argc, char **argv) {
    garbage_syscall();
}
Disclaimer: I didn't test this, and it might not work.

In any case, adding syscalls to libfxcg is staggeringly easy- just add the prototype to the relevant header and create a new .S file for it.

but did not manage to make it work with addition of the below in my code please:

Code:

#include <asm.h>
__asm__("#include <asm.h>\n"
         "\tSYSCALL(_DrawHourGlass, 0x0003)");

void DrawHourGlass();


There is a possibility my compiler is not setup for this properly (only works successfully for certain but not all things for the moment) or maybe I should do something different for treatment of the argument for the system call I am testing above) but before I start going in the wrong direction looking for something what is not a problem I hoped you guys here could put me in the right direction to begin with please. Many thanks in advance.
I am not sure what the real cause of your issue is as you have not posted any error messages.
Here is some code from Gravity Duck that is known to work

Code:

   asm("mov.l syscall_adress, r2\n"
       "mov.l getTicks, r0\n"
       "jmp @r2\n"
       "nop\n"
       "syscall_adress: .long 0x80020070\n"
       "getTicks: .long 0x02C1");
Thanks, ProgrammerNerd, I get undefined reference when compiling a similar example, but thanks anyway
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement