Forum

Usage of itoa() to ...
 

Usage of itoa() to generate CPU opcodes.  

  RSS

anthk
(@anthk)
New Member
Joined: 1 month ago
Posts: 2
15/06/2019 1:40 pm  

Hello there.

I've seen you are using itoa() to print x86 CPU opcodes used by all the

code if -DGENERATE_SOURCE is set.

The problem is nowadays that function is not available in any modern C

library implementation. (I use OpenBSD and is not available).

Could all the functions calling itoa() be replaced by "sprintf(dst, "format", src);" ?

 

This topic was modified 1 month ago by anthk

Quote
Topic Tags
James Bryant
(@admin)
Member Admin
Joined: 1 year ago
Posts: 31
16/06/2019 12:57 am  

I think I ran into that same problem when testing on other platforms too.  I switched a lot of them to SDL_itoa. 

 

As for GENERATE_SOURCE, that will not work if you are using the cpp code.  I switched from c to cpp a while back and all new development is with the cpp code folder.  GENERATE_SOURCE was an experiment to help speed things up for the web/emscripten build.   But I will probably abandon that in favor of dynamic code generation in web/emscripten code.


anthk liked
ReplyQuote
anthk
(@anthk)
New Member
Joined: 1 month ago
Posts: 2
16/06/2019 12:06 pm  

> But I will probably abandon that in favor of dynamic code generation in web/emscripten code.

That's nice, but do not abandon the c/c++ projects, please. They will run faster than the emscripten versions, for sure.

Also, did you check the DOSBox-X recompiler? It may speed up things a bit.


ReplyQuote
James Bryant
(@admin)
Member Admin
Joined: 1 year ago
Posts: 31
16/06/2019 5:42 pm  

What do you mean by the DOSBox-X recompiler?  I'm familiar with Dosbox and its CPU cores, I didn't see anything new in DOSBox-X.

Dynamic recompilers need to be specific to platform they run on.  One day I would like to have one for Emscripten, but that might be a ways off.  For the last 6 months I'm working on an x64 dynamic recompiler (binary translator).  It is multi-threaded so each emulated thread will get it's own host thread. 

https://sourceforge.net/p/boxedwine/code/HEAD/tree/trunk/boxedwine/cpp/source/emulation/cpu/x64/

So far the results are looking pretty good, for Quake 2, the 32-bit normal build of Boxedwine gets about 25 fps for 640x480 in software rendering mode, the x64 binary translator gets about 100 fps.  Currently I'm just trying to get rid of a few remaining bugs with some games that work in the 32-bit normal build of Boxedwine but not in the x64 binary translator build.

The main x86 to x64 translation should work on other platforms, but each platform will need some of its own work with exceptions and threads.  Currently I'm developing this on Windows and once it works on Windows, I will then bring it up on Mac and Linux.


ReplyQuote
Share:
  
Working

Please Login or Register