• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

TFile2ASM - Makes your data into PB-Code

Started by Theo Gottwald, June 12, 2009, 12:08:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Theo Gottwald

Many will know Hutch popular PB-Tools from


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.]

Steve Hutchesson

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 ?

Theo Gottwald

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.



Aslan Babakhanov

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

Theo Gottwald

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