This is the 8th look at writing a tool that can handle most syntax level conversions from Blitz BASIC into PlayBasic compatible syntax.
In this episode we take a quick look at the results of the optimization pass applies to the freshly converted BlitzBASIC code. In this video; the code is set up to perform the optimization pass upon pressing the enter key. We test various source codes from one with than less than a hundred lines through to the Xlnt GUI source code which is over 8500 lines and it barely impacts the frame rate.
Here's revision K of PlayBasic2DLL V0.99 package. This update address a few minor issues with the machine code generation and includes a few new command sets that were overlooked in previous builds.
This tool is intended for use with PlayBasic V1.64P3 retail updates !
2014 was the year of conversion for PlayBasic, as will be 2015.
Last year we introduced PlayBasic2DLL, a tool at allow PlayBasic programmers produce high quality, compact and very fast machine code binaries directly from PlayBasic source code.
This year we'll be doing much the same, but focusing on our web translation technologies. Although very different targets, the principal approach remains the same, the user (you the programmer) writes code in PlayBasic once, which is passed through a translation tool for create the output code for the target. The method doesn't require plug in's or bulky interpreters written for target platform/client, so it's about as direct a translation of your code as you can get.
PlayBasic-Pic-2-Map V0.07 - Released - 22nd,Jan,2015
Here's the latest build of the picture to map conversion tool. For those that are not familiar this tool loads a picture (BMP / PNG format recommended) and converts this picture into a series of unique tiles with an accompanying PlayBasic level file. The user can pick the size of the block and even the alpha masking applied to the image before conversion.
For this release we've update the conversion method and converted some of the conversion routines machine code via PlayBasic2DLL. So in other words, we took the main work horse routines out and compiled them as a DLL, then just linked them back into our program. The result gives much faster conversion when the user selects tiny block sizes, such as 2*2 or 4*4 the source image is very large.
History
CODE:
V0.07 - 19th,Jan,2015 - 21st,Jan,2015
- Changes
- replace the typed tile array with typed pointer structure
to cut down on type allocated when converting images with lots
and of tiles
- Exported most of conversion functions to a separate PBA
for creation to DLL
- Added
- History dialog from PlayBASUC2DLL
- ARGB pixel masking to block conversion
V0.06 - 14-01-2015 - 18th,Jan,2015
- Changes
- replaced conversion method
- removed PlayDialogs and replaced with WindowsFileDialog include
Download
Download PlayBasic Pic2Map and other free tools from PlayBasic Tools page
Here's revision I of PlayBasic2DLL V0.99 package. This revision features even more improvements to the machine code generation as well as continuing to iron any hidden instructions that weren't supported by the translation engine.
In terms of code generation this update focuses mainly on pointer operations, in particular when reading / writing from a user defined typed pointer is used within an expression, as well as arithmetic and assignment operations on between pointers or between a pointer and integer.
Example:
PlayBasic Code:
type TestType
x#,y#,z#
EndTYpeDim Src as testtype pointerDim Dest as testtype pointer
Src =new testtype
Dest =new testtype
; write some integer values into these float fields..; this type of type mismatch is now auto recast at compile time
Src.x =1111
Src.y =2222
Src.z =3333; copy a field to another within the same type; The op
Src.x=Src.Y
; copy fieldds between different types
Dest.x=Src.x
; copy a field and add 100 to it
Dest.y=Src.y+100; copy a field and mult it by 2
Dest.z=Src.z*2print Dest.x
print Dest.y
print Dest.z
Syncwaitkey
The new changes allow the code builder to produce faster leaner machine code from such operations as well as when they appear in expressions, which generally can be solved on the cpu without having to hit memory with temp values like previous editions.
This tool is intended to be used with PlayBasic V1.64P2 retail updates. !
PlayBasic To Dll - Breaking the one second mark for fractal render
After tweaking the floating point code generator just a little, we get an even more staggering result from the previous fractal test, which now is rendering inside a second for a 640*480 screen on my test machine AMD FX64 (3000+). The result gives us about 150 millisecond improvement over the initial test, so even the first versions of PB2DLL are surprisingly optimal, in particular when you compare those results to the primary competitors. PB2DLL is consistently 3.5 times faster than one and 5.2 times faster than another..
In this particular example the routine has a lot of dependency, by that i mean, calculations need to be done in a set order. I suspect if the generator could interleave some of the FPU instructions around integer instructions, we could go even further though. This is possible as the integer and float (FPU) sides of your CPU can actually run in unison. Instruction operations on either side can generally overlap other instructions also, providing the following instructions don't rely upon the result of a previous instruction. So we could interleave instructions that take a long time to execute around other instructions as long as they don't rely upon the result.
Note: The original code/demo is attached to an earlier post in the PB2DLL WIP thread, it's exactly the same code.
PlayBasic To Dll V0.99g Released and Available For Download (30th,June,2014)
Here's revision G of PB2DLL V0.99 package. This revision is focuses on bugs and the more improvements to code generation engine. The main bug that this update fixes is the possible freeze when attempting to load a PBA that's has no exportable functions in it. It was a strange issue caused by the Replace$() function in PB, but that's been solved now. So if you select a source that has no exports, you should get an error message, rather than it hanging.
Code Generation:
Just like the previous build i've been working on improving it's detection and abilities to solve sequences of byte code operations in order and with in CPU registers. The solver can support integer and float data types mainly. SO it's looking for sequences of integer or float operations that stack up in sequence. When it finds one, it short cuts this series of instructions.
The Integer solver has three main additions, it support equality tests (= and <>) , Compare/Branches as well as better support for Left/Right hand operators. The latter allows it to better track where which side of the temp data came from, then remap the operator accordingly.
On the float side, the changes are a little different, the float solver can handle recasting results and some limited single parameter functions like Sqrt(), ABS() as well as the normal addition/subtraction/Divide/Multiplies.
Yes it's here... Finally...after more than few marathon nights the first fully fledged version of PlayBasic2DLL is available to the community. PlayBasic2DLL brings the power of native code to the PlayBasic developer, all we can say is welcome back to the machine code age.
This initial release has been discounted for the community down to $27.50 (US) from it's regular $49.99 US
What's PlayBasic2DLL ?
It's a companion tool to the PlayBasic programming language. The tool converts PlayBasic Source code into machine code DLL's. Allowing the programmer to fully harness the process of their computers cpu.
The tool has been in development for the best part 8 months now so rather than me crudely attempt to paraphrase the blogs, I recommend you read the PlayBasic2DLL blogs and check out some of the examples. ( 1,000,000 Vertex cube - Water Demo )
Order
You can order the product through shareit who provide all major payment processing methods from bank card, paypal, cheque, money order and more.