News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Creating a batch file with VBScript, JScript, MS Windows Script Host (WSH)

Started by LiaoMi, March 18, 2021, 12:46:01 AM

Previous topic - Next topic

LiaoMi

Hi,

what tricks do You use in batch scripts to make the assembly process more productive? Does it make sense to create an AsmMake configuration generator, like CMake for C++, to generate batch files? There could be some kind of instrumentation for dynamically replacing variables in the source code (Compile time instrumentation).


jj2007


HSE

Hi LiaoMi!

Quote from: LiaoMi on March 18, 2021, 12:46:01 AM
what tricks do You use in batch scripts to make the assembly process more productive? Does it make sense to create an AsmMake configuration generator, like CMake for C++, to generate batch files?
Scripts in qEditor make that.

Quote from: LiaoMi on March 18, 2021, 12:46:01 AMThere could be some kind of instrumentation for dynamically replacing variables in the source code (Compile time instrumentation).
With option /D you can assign a textequ at assembly time.

Regards. HSE
Equations in Assembly: SmplMath

Vortex

Hi LiaoMi,

Like Jochen, I received the same warning message, it's the Chrome web browser reporting about the content of the zip archive.

I guess you have large projects to maintain. Nidud's asmc package is providing a make utility. Such tool could be useful for you.

LiaoMi

Hi jj2007, HSE, Vortex,

Quote from: jj2007 on March 18, 2021, 12:51:02 AM
Firefox warns me that your archive contains dangerous malware :greensml:

:sad: there is nothing like that, I have eset nod antivirus and google chrome, both did not report anything.

Quote from: HSE on March 18, 2021, 01:45:33 AM
Hi LiaoMi!

Quote from: LiaoMi on March 18, 2021, 12:46:01 AM
what tricks do You use in batch scripts to make the assembly process more productive? Does it make sense to create an AsmMake configuration generator, like CMake for C++, to generate batch files?
Scripts in qEditor make that.

Quote from: LiaoMi on March 18, 2021, 12:46:01 AMThere could be some kind of instrumentation for dynamically replacing variables in the source code (Compile time instrumentation).
With option /D you can assign a textequ at assembly time.

Regards. HSE

From the batch file directly? I think I've seen something like this somewhere.

Read multiple variables from file:

for /f "delims== tokens=1,2" %%G in (param.txt) do set %%G=%%H

where param.txt:

PARAM1=value1
PARAM2=value2

FindRepl.bat:New regex utility to search and replace strings - https://www.dostips.com/forum/viewtopic.php?f=3&t=4697

Quote from: Vortex on March 18, 2021, 01:51:41 AM
Hi LiaoMi,

Like Jochen, I received the same warning message, it's the Chrome web browser reporting about the content of the zip archive.

I guess you have large projects to maintain. Nidud's asmc package is providing a make utility. Such tool could be useful for you.

What does this module do? There seems to be no description for it in the documentation.


Another utility for string replacement:
JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets  - https://www.dostips.com/forum/viewtopic.php?f=3&t=6044
JREPL8.6.zip - https://www.dostips.com/forum/download/file.php?id=605&sid=4de08eefca07bf44b2c2ab3066037189

A small collection of scripts - Batch script utils and examples by npocmaka - https://github.com/npocmaka/batch.scripts

Biterider

Hi LiaoMi
I'm using a sort of preprocessor that I integrated in the build chain.
In this case, I translate an .inc file to .rc to automatically share the equates and set up build variables like date, time, release date, build number, etc.
There are all .cmd files that can be customized, or at least used as a reference for your own work.
If you have a copy of ObjAsm, check the files in this folder "ObjAsm\Build\Tools"


Biterider

daydreamer

some ml versions complain if I write xmm regs in lower case,must change to uppercase to work would be interesting to see that done with batch file

batch file for have maintest already compiled and while working on .inc file library of macros/proc might be possible to link in precompiled part in batch file instead of ml assemble it
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

Vortex

Hi LiaoMi,

There is also Pelles' tool, Pomake. Reading the Pelles C manual :

QuotePOMAKE works by comparing the time stamps of a "target" file and its "dependent" files. A target file is usually a file you want to create, such as an executable file, though it could be a label for a set of commands you want to execute. A dependent file is usually a file from which a target is created, such as a source file. A target is "out-of-date" if any of its dependents has a later time stamp than the target or if the target does not exist.

When you run POMAKE, it reads a "makefile" that you supply. A makefile (sometimes here called a project file) is a text file containing a set of instructions that POMAKE uses to build your project. The instructions consist of dependency description blocks, macros, directives, and inference rules. Each description block typically lists a target (or targets), the target's dependents, and the commands that build the target. POMAKE compares the time stamp on the target file with the time stamp on the dependent files. If the time stamp of any dependent is the same as or later than the time stamp of the target, POMAKE updates the target by executing the commands listed in the description block.


POMAKE's main purpose is to help you build programs quickly and easily. However, POMAKE is not  limited to compiling and linking; it can run other types of programs and can execute operating system commands.


When POMAKE runs, it performs the following tasks (roughly in this order):

Check the environment variable MAKEFLAGS for any default command-line options.

Check the command line for options.

Initialize predefined macros and rules, unless the /R option was specified.

Define all macros specified on the command line (for preprocessing).

Read all project files specified through the /F option, or use the default name makefile.

Define all macros specified on the command line (for compatibility).

If present, execute commands from the pseudotarget .INIT.

Build all targets specified on the command line, or use the default first target.

If present, execute commands from the pseudotarget .DONE.

The time stamp comparaison is very important here. This avoids the recompilation of the umodified source files.

HSE

Perhaps not very clear  :biggrin:

Scripts in qEditor can generate batch files easily.

With Assembler(ML, AsmC,UAsm) command line option /D you can assign a textequ at assembly time (of course you can call assembler from .bat or .cmd).
Equations in Assembly: SmplMath

LiaoMi

Quote from: Biterider on March 18, 2021, 05:24:17 AM
Hi LiaoMi
I'm using a sort of preprocessor that I integrated in the build chain.
In this case, I'll translate an .inc file to .rc to automatically share the equates and set up build variables like date, time, release date, build number, etc.
There are all .cmd files that can be customized, or at least used as a reference for your own work.
If you have a copy of ObjAsm, check the files in this folder "ObjAsm\Build\Tools"


Biterider

Hi Biterider,

сool, thanks  :thup:, I will look at it!


Quote from: daydreamer on March 18, 2021, 05:24:56 AM
some ml versions complain if I write xmm regs in lower case,must change to uppercase to work would be interesting to see that done with batch file

batch file for have maintest already compiled and while working on .inc file library of macros/proc might be possible to link in precompiled part in batch file instead of ml assemble it

Hi daydreamer,

this is how you can do it using the above script

< Temp_result.txt FindRepl "xmm1" "XMM1" > windowsFile.txt

@Vortex already started reading, thanks!:azn:

LiaoMi

Quote from: HSE on March 18, 2021, 05:49:37 AM
Perhaps not very clear  :biggrin:

Scripts in qEditor can generate batch files easily.

With Assembler(ML, AsmC,UAsm) command line option /D you can assign a textequ at assembly time (of course you can call assembler from .bat or .cmd).



I have an old version, because the new ones were packed with a "harmful" :biggrin: packer, the antivirus always deleted this file. It would be better to take a simple UPX packer. So you can make your own configuration to generate a batch file?

HSE

Quote from: LiaoMi on March 18, 2021, 06:11:17 AM
So you can make your own configuration to generate a batch file?
It's the way qEditor create batchs, code, includes, data, even icons files and full projects.

They are included in menus.ini to call them from qEditor's menu.

Old format scripts have .qsc extension, new format have .qse extension. You can find them in \masm32 and \masm32\script directories.


:biggrin: Just make an exception in antivirus!
Equations in Assembly: SmplMath