Powerbasic Museum 2020-B

General Category => Third-Party Add-Ons => Topic started by: Theo Gottwald on June 12, 2009, 12:08:46 PM

Title: TFile2ASM - Makes your data into PB-Code
Post by: Theo Gottwald on June 12, 2009, 12:08:46 PM
Many will know Hutch popular PB-Tools from

Hutch's Site (http://www.movsd.com/)

one of them is his "File2ASM".

Its worth a look!

I used it quite often, but had the need for something that would work without an surface and had no Limitation on 1.5 MB.
So I made my own, based on his.

I have added Hutchs "File to ASM Tool" as an alternative.


It will look in its EXE.PATH$ for a INI-File like this:

TFile2ASM.ini
[CustomData]
Input-Filename=Neu Textdatei.txt
Output-Filename=YourFunc.inc
Func-Name=b2b_()


and then just generate the code using Hutch's original idea - with a minor improvement (One JMP less then in Hutch's code!  ;D).


If i take the same RAW-Data, here is what both programms generate:


Here is the Output from TFile2ASM:


FUNCTION b2b_() AS STRING

   LOCAL S01 AS STRING
   LOCAL T01 AS LONG

   S01 = SPACE$(54)
   T01 = CODEPTR(L43543_9686)

   ! cld
   ! mov ecx,54
   ! mov esi, T01
   ! mov edi, S01
   ! rep movsb

FUNCTION = S01
EXIT FUNCTION

L43543_9686:

  ! db 49,50,51,52,53,54,55,56,57,49,50,51,52,53,54,55,56,57,49,50,51,52,53,54,55,56,57,49,50,51,52,53,54
  ! db 55,56,57,49,50,51,52,53,54,55,56,57,49,50,51,52,53,54,55,56,57

END FUNCTION   


Code from Hutch's File2ASM


FUNCTION Read_BC0A9E5() as STRING

  ' ~\Neu Textdatei.txt 54 bytes(decimal)

  ! jmp end_BC0A9E5

start_BC0A9E5:
  ! db 49,50,51,52,53,54,55,56,57,49,50,51,52,53,54,55
  ! db 56,57,49,50,51,52,53,54,55,56,57,49,50,51,52,53
  ! db 54,55,56,57,49,50,51,52,53,54,55,56,57,49,50,51
  ! db 52,53,54,55,56,57
end_BC0A9E5:

    LOCAL Dest  as STRING
    LOCAL lpLbl as LONG

    Dest  = space$(54)
    lpLbl = CodePtr(start_BC0A9E5)

      ! cld
      ! mov ecx, 54
      ! mov esi, lpLbl
      ! mov edi, Dest
      ! rep movsb

    FUNCTION = Dest

END FUNCTION


[Update-Notice:Updated the attached file on 14.06.2009, due to speed improvements.]
Title: Re: TFile2ASM - Makes your data into PB-Code
Post by: Steve Hutchesson on December 07, 2009, 02:33:02 AM
Hi Theo,

I got it to work once I understood the INI file, runs fine and seems to be fast enough. Tell me this much, why do you use the INI file instead of a normal command line or alternatively in an interface ?
Title: Re: TFile2ASM - Makes your data into PB-Code
Post by: Theo Gottwald on December 07, 2009, 06:37:30 AM
Quotewhy do you use the INI file instead of a normal command line or alternatively in an interface ?

In my project the pathes are too long. A command line has a limited lenght.
As i always use the same input files, a fixed INI File was the best sollution in that case.
Also its possible to write error-messages back into the ini-file.

Think of a (CPU-uOps-)Pipeline. On the left side is all the source code and binaries.
On the right side is the complete result, even the tests run automatically.

This tool has been designed, to work as an integrated and invisible part of a production "pipeline", not as a standalone Sollution.
Thats why i have choosen an INI.

And that was the only reason why i had to replace your smart tool. Your tool was designed as a standalone sollution.


Title: Re: TFile2ASM - Makes your data into PB-Code
Post by: Aslan Babakhanov on July 26, 2013, 11:54:09 AM
Theo,

You might be interested in CCI (Common Conversion Interface) tool.
http://www.powerbasic.com/support/pbforums/showthread.php?t=46389

You can add your own conversion functions and use one GUI
Title: Re: TFile2ASM - Makes your data into PB-Code
Post by: Theo Gottwald on July 27, 2013, 02:42:36 PM
Hallo Aslan,

thats  good idea, to put all that stuff in one bag. So we do not need to have so many utilities around.

Download CC-Tool (http://www.powerbasic.com/support/pbforums/attachment.php?attachmentid=3019&d=1297811250)

(http://postimg.org/image/2k4m8vquc/)