In this thread, Kerm mentions he did implement setjmp and friends when developing LuaZM: http://www.cemetech.net/forum/viewtopic.php?t=8093&start=0

I'm trying to port code to the Prizm which heavily needs setjmp and longjmp (it's not something I can rewrite to get rid of them). I already posted a topic at Casiopeia and I'm posting another here...

I suppose that maybe Kerm's implementation is on the LuaZM source code, but I'm having trouble finding it too (was it ever published?).

Can someone help?
Conceptually it's not too hard to write (snapshot the processor and stack state and save it to memory), but a pain to debug (especially on this platform where we don't have any kind of debugging tools).

I don't think I've seen this implementation either, but it would be a good one to add to libfxcg, so I second the request for source.
Otherwise, newlib appears to have a reasonable implementation to crib from.
Please enjoy this implementation that I use in LuaZM with my complements.


Code:
   .global __mylongjmp, __mysetjmp
__mylongjmp:
   mov.l   @r4+, r8
   mov.l   @r4+, r9
   mov.l   @r4+, r10
   mov.l   @r4+, r11
   mov.l   @r4+, r12
   mov   r5, r0
   tst   r0, r0
   bf/s   nonzero
   mov.l   @r4+, r13
   mov   #1,r0
nonzero:
   mov.l   @r4+, r14
   mov.l   @r4+, r15
   lds.l   @r4+, pr
   rts
   ldc.l   @r4+, gbr
 
__mysetjmp:
   add #40, r4
   stc.l   gbr, @-r4
   sts.l   pr, @-r4
   mov.l   r15, @-r4
   mov.l   r14, @-r4
   mov.l   r13, @-r4
   mov.l   r12, @-r4
   mov.l   r11, @-r4
   mov.l   r10, @-r4
   mov.l   r9, @-r4
   mov.l   r8, @-r4
 
   rts
   mov   #0, r0
 
.END
Implementation added to libfxcg and tested for correct compilation.
Thanks for all your help, right now it isn't needed anymore - but I'm sure I'm going to need it later, and we're still in need of proper implementations of math functions. Read on.

I'm cross-posting this from Casiopeia:
Quote:
I ended up solving my library problems. I took some ideas and information out of http://www.kpitgnutools.com/Interoperab ... _GNUSH.pdf
namely the existence of a tool called convrenesaslib.
Then I went here http://jsdkk.net/download/jde/jde5x/JDE ... h-elf/bin/ to download that tool (a build for Windows, but that ran fine with Wine). I figured out ar was also needed so I downloaded it too. Then I ran the fxCG_library.lib, from Simon's zip, past the convrenesaslibtool. It gave me a .rlib file which already was in a format readable by GCC (it converted not only the lib container but the object files too, which was what I needed). I only needed to rename it to something recognizable by the Makefile and put it in the libs dir.

Now I no longer get errors for math functions or for setjmp. Unfortunately this also means my program uses proprietary code from Renesas/Casio for these functions (not sure how well it bounds with the licensing of the engine I'm porting, but I think it's OK), but that's something I may take care of later.

Right now I only get errors for two functions called "jn" and "yn". These are some math functions but they don't appear to be from stdlib. I'll have to solve that in some way and then I can get to the GUI part of my project Smile


Basically right now I'm using some library Simon built out of what's available for the fx9860 and out of what he knows about the fxCG. This means I now have math functions and setjmp working, without the source code for them - just object files included in a library I converted to the format supported by GCC.

Later I'd like to replace this solution with a cleaner one which uses libfxcg and nothing else, once it gets all the stdlib functions it deserves...
  
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