assemble load and execute rather than assemble link and execute

  • Permalink
  • submit to reddit
  • Email
  • Follow


I am an IBM SYS/390 sys prog, getting interested in x86 assembler.  In the
IBM world, there are programs, depending on the language the program was
written in, that would assemble (or compile), load the program into memory
and execute, rather than assembling the program, linking the object code
into an executable lib and then executing the program.

Is there in x86 assembler a way to assemble code, load it and execute it
without the linking, etc.

Inquiring minds want to know.

Thanks.
JR

0
Reply John 9/11/2004 11:10:24 AM

See related articles to this posting


> Is there in x86 assembler a way to assemble code, load it and execute it
> without the linking, etc.

COM programs can be just assembled, loaded into memory and executed. They 
don't require linking if the source consists of one file. IIRC nasm can 
produce .com immediately, without generating .obj

-- 
Ivan

e-mail me at: korotkov2 at ztel dot ru

0
Reply Ivan 9/11/2004 12:14:04 PM

On Sat, 11 Sep 2004 11:10:24 +0000 (UTC), "John F. Regus"
<spamtrap@crayne.org> wrote:

>I am an IBM SYS/390 sys prog, getting interested in x86 assembler.  In the
>IBM world, there are programs, depending on the language the program was
>written in, that would assemble (or compile), load the program into memory
>and execute, rather than assembling the program, linking the object code
>into an executable lib and then executing the program.
>
>Is there in x86 assembler a way to assemble code, load it and execute it
>without the linking, etc.

I'm not sure I understand the problem.  With a typical 'make' utility
(or a simple batch file) the assembly and linking are a single
invocation from your standpoint.  With a batch file you can even
include the execution as well as assembly and link.  If you are
really bothered by the separate linker, note that current versions
of MASM include a built-in linker, but I seem to recall that there is
some limitation or awkwardness in using it.  I suspect most
folks still use a separate linker.


Bob Masta
dqatechATdaqartaDOTcom
 
            D A Q A R T A
Data AcQuisition And Real-Time Analysis
           www.daqarta.com

0
Reply NoSpam 9/11/2004 2:07:22 PM

On Sat, 11 Sep 2004 11:10:24 +0000 (UTC), John F. Regus wrote:

> Is there in x86 assembler a way to assemble code, load it and execute it
> without the linking, etc.

I'd recommend FASM - www.flatassembler.net. It can directly generate
executables without the need of linker, import libraries and the like.

-- 
Vulnerant omnes, ultima necat.
http://ry.pl/~omega/
Looking for a job.

0
Reply Omega 9/11/2004 5:47:17 PM

"John F. Regus"  <spamtrap@crayne.org> �crivait
news:KkrVc.28801$9Y6.4635@newsread1.news.pas.earthlink.net: 

> I am an IBM SYS/390 sys prog, getting interested in x86 assembler.  In
> the IBM world, there are programs, depending on the language the
> program was written in, that would assemble (or compile), load the
> program into memory and execute, rather than assembling the program,
> linking the object code into an executable lib and then executing the
> program. 
> 
> Is there in x86 assembler a way to assemble code, load it and execute
> it without the linking, etc.
> 
> Inquiring minds want to know.


RosAsm does it for PEs.


Betov.

< http://betov.free.fr/RosAsm.html >


0
Reply Betov 9/11/2004 9:12:40 PM

"John F. Regus"  <spamtrap@crayne.org> wrote in message news:<KkrVc.28801$9Y6.4635@newsread1.news.pas.earthlink.net>...
> Is there in x86 assembler a way to assemble code, load it and execute it
> without the linking, etc.
'octasm' can assemble and execute a source file without writing any
file to disk,it runs with DOS.

0
Reply spamtrap 9/12/2004 1:11:13 PM

[snip]

If you think not only about x86 ASM, then older Turbo Pascal compilers 
come to mind where you could set the destination of the compiler to 
"Memory" instead of "Disk" and it would not produce an EXE-File but you 
would run the program for testing directly from this memory-compile.

Is this what you ask for?

Greetings

Markus

0
Reply Markus 9/13/2004 5:56:16 PM

"John F. Regus" <spamtrap@crayne.org> wrote in message
news:KkrVc.28801$9Y6.4635@newsread1.news.pas.earthlink.net...
> I am an IBM SYS/390 sys prog, getting interested in x86 assembler.  In the
> IBM world, there are programs, depending on the language the program was
> written in, that would assemble (or compile), load the program into memory
> and execute, rather than assembling the program, linking the object code
> into an executable lib and then executing the program.
>
> Is there in x86 assembler a way to assemble code, load it and execute it
> without the linking, etc.
>
> Inquiring minds want to know.

"Compile, Load, and Go" doesn't exist in any meaningful fashion
under Windows. There were some DOS tools that did this, but
nothing really, for Windows.

OTOH, most assemblers automatically run the linker for you,
so who cares about the linker stage?  Consider the High Level
Assembler (HLA), a simple command line like:

hla hw.hla

automatically compiles the sources, links it, and produces
an executable, ready to run.  Usually in less than a second
or two.  Other assemblers have similar processes.

About the closest to "compile, load, and go" you're going
to get in assembly language is the little built-in assemblers
that accompany debuggers. However, they are too
painful to even consider.

Cheers,
Randy Hyde

0
Reply Randall 9/13/2004 9:36:57 PM

I vaguely remember something on the sourceforge site that was a tool
that assembled assembler code and loaded it into memory to run. From
memory it was nothing like as powerful as a modern windows assembler
but apparently it worked.

Its generally been the case on x86 PCs to build the file as a binary
file then run it from disk. The linking stage is usually one of the
faster ones in building the complete file, its assembly time that is
the slowest in most cases.

What you can get will depend on the platform you have in mind, there
are dedicated assembler for both Windows and Linux and a couple that
will work on both.

Regards,

hutch at movsd dot com

0
Reply spamtrap 9/14/2004 3:58:10 AM

"John F. Regus"  <spamtrap@crayne.org> wrote in message news:<KkrVc.28801$9Y6.4635@newsread1.news.pas.earthlink.net>...
> I am an IBM SYS/390 sys prog, getting interested in x86 assembler.  In the
> IBM world, there are programs, depending on the language the program was
> written in, that would assemble (or compile), load the program into memory
> and execute, rather than assembling the program, linking the object code
> into an executable lib and then executing the program.
> 
> Is there in x86 assembler a way to assemble code, load it and execute it
> without the linking, etc.
> 
> Inquiring minds want to know.


Probably the closest you'll get is if you use an IDE like Visual
Studio*.  While you've got your project open, hit F5, and it'll
compile and run the program (and, if it crashes, toss you right into
the debugger).  Under the hood it'll actually generate an executable,
but...


*You will have to fiddle a bit to convince VS to allow an assembler
mainline project - it's not one of the default project types - for a C
or C++ program you can just start a new project of that flavor.  If
you don't mind writing a trivial C mainline, it's fairly easy to add
an assembler subroutine to a C project.


Frankly, though, the suggestion to just do the compile/link/execute in
a batch file is simpler for a small project.

0
Reply spamtrap 9/14/2004 7:24:05 AM

On Tue, 14 Sep 2004 03:58:10 +0000 (UTC), spamtrap@crayne.org
(hutch--) wrote:

>I vaguely remember something on the sourceforge site that was a tool
>that assembled assembler code and loaded it into memory to run. From
>memory it was nothing like as powerful as a modern windows assembler
>but apparently it worked.
>
>Its generally been the case on x86 PCs to build the file as a binary
>file then run it from disk. The linking stage is usually one of the
>faster ones in building the complete file, its assembly time that is
>the slowest in most cases.
>
>What you can get will depend on the platform you have in mind, there
>are dedicated assembler for both Windows and Linux and a couple that
>will work on both.
>
>Regards,
>
>hutch at movsd dot com
>

Hutch, isn't there an IDE in your MASM32 package
that does pretty much what the OP asks?  (I use
MASM32 without the IDE because I'm attached to
my old DOS-based TSE editor.)

Just a thought...



Bob Masta
dqatechATdaqartaDOTcom
 
            D A Q A R T A
Data AcQuisition And Real-Time Analysis
           www.daqarta.com

0
Reply NoSpam 9/14/2004 12:06:40 PM

"Bob Masta" <NoSpam@daqarta.com> wrote in message
news:4146db5d.271317@news.itd.umich.edu...
> On Tue, 14 Sep 2004 03:58:10 +0000 (UTC), spamtrap@crayne.org
> (hutch--) wrote:
>
> >I vaguely remember something on the sourceforge site that was a tool
> >that assembled assembler code and loaded it into memory to run. From
> >memory it was nothing like as powerful as a modern windows assembler
> >but apparently it worked.
> >
> >Its generally been the case on x86 PCs to build the file as a binary
> >file then run it from disk. The linking stage is usually one of the
> >faster ones in building the complete file, its assembly time that is
> >the slowest in most cases.
> >
> >What you can get will depend on the platform you have in mind, there
> >are dedicated assembler for both Windows and Linux and a couple that
> >will work on both.
> >
> >Regards,
> >
> >hutch at movsd dot com
> >
>
> Hutch, isn't there an IDE in your MASM32 package
> that does pretty much what the OP asks?  (I use
> MASM32 without the IDE because I'm attached to
> my old DOS-based TSE editor.)
>
> Just a thought...

The IDE (e.g., RadASM) still does file-to-file and
linking. It just automates the process (much like a
makefile).

Then again, as I said earlier, who really cares? If you
type "ml file.asm" and you get an executable, does it
really matter that the linker ran somewhere in there?

"Compile-load-and-Go" systems were very popular
in the days of mainframes, card punches, and
$150/hour CPU-time systems because they were
very fast and cost less to operate. Those savings
just don't apply on PCs. Even when linkage, most
assemblers complete the full assembly and link process
before the human operator can react.

Cheers,
Randy Hyde

0
Reply Randall 9/14/2004 3:21:43 PM
comp.lang.asm.x86 4890 articles. 10 followers. Post

11 Replies
328 Views

Similar Articles

[PageSpeed] 50


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Executing the executable
Using Microsft Visual Studio C++ 6.0, I have compiled my code and I need to execute this executable by specifying my input file and my output file, eg. ./DMDC2 input > output. Input file is a separate normal file and not a visual C++ file. "Vikram" <vikram3@hotmail.com> wrote in message news:d57dd844.0407230046.67352135@posting.google.com... > Using Microsft Visual Studio C++ 6.0, I have compiled my code and I > need to execute this executable by specifying my input file and my > output file, eg. ./DMDC2 input > output. Input file is a separate > normal file...

Execute an executable by my own
Hello everybody ! I want to load an executable in virtual memory by my own, it means without calling any Windows function like CreateProcess(), ShellExecute(), ..... Once in memory, I want to execute it by jumping to its entry point, for example : DWORD EntryPoint = 0x00400CBE; _asm { jmp EntryPoint; } I mapped my executable in memory, I moved some piece of code, as said in the section headers of the PE file, then I jumped, then I crashed. I traced execution with a debugger, and I noticed that error is due to an invalid address access, around 50 instructions after t...

what is fast dynamically linked executable or statically linked executable ?how to decide?
Could someone clarify how could one reduce the size of an executable code during compile time. Could one use specific compile time flag with makefile or is it advisable to go for dynamic linking. The idea here is that smaller the code size the faster is the code. Is Dynamically linked executable really faster than a single executable file which is not linked dynamically.? Is there any performance measuring metrics on gcc version 3.2.2 pratap wrote: > Could someone clarify how could one reduce the size of an executable > code during compile time. > Could one use specific compile ti...

Assembler code execution
Hi all, Can someone please tell me how to execute an assembler code. Is it the normal way of using EXEC PGM=ASMPROG with an appropriate STEPLIB or is there any other way to execute the code. I am stating this because when i use an EXEC PGM=ASMPROG with an appropriate STEPLIB i am getting a U 4038 Abend. I dont know the exact cause of this abend. Is it that there is a logical glitch in the code or is there a problem with method of executing the Assembler program? Also do we need some special libraries to point to ...

assemblies within assemblies
I nested an assembly within an assembly and I'm not able to move the parts in the nested assembly (sliding motion). It acts like it's a solid part. Is there a way around this? A nested assembly, or sub-assembly is resolved as either 'rigid' or 'flexible' in the context of the assembly that you've inserted it into. To allow it's own components to move, right click on the sub-assembly in the feature manager and select properties, on the right you will see 2 radio buttons, one flexible, the other rigid. Zander Zander wrote: > A nested assembly, or sub-as...

Exception occured While loading dynamically EXE assembly in C++/CLI (Could not load file or assembly ', Version=1.0.3836.39802, Culture=neutral, PublicKeyToken=null' ...)
I am facing an exception in C++/CLI while dynamically loading assembly which itself an EXE created in C++/CLI managed mode using Assembly.Load. It successfully loads a dll assembly, but fails to load EXE assembly and generates following exception: An unhandled exception of type 'System.IO.FileLoadException' occurred in TestManager.dll Could not load file or assembly 'testAssembly, Version=1.0.3836.39802, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS se...

Problem forging assembly code and executing it
Hello all, I used to have a program which worked well on x86 but does not work anymore on x86_64. The problem can be broken down to the following piece of code: <code> #include <stdio.h> #include <string.h> int main () { unsigned char code[32]; void (*sub)(); memset (code, 0x90, sizeof (code)); /* nop */ code[31] = 0xc3; /* ret */ sub = (void (*)())code; sub (); printf ("returned from sub\n"); return 0; } </code> The code array contains 31 nop instructions followed by a return ins...

Display Messages depending on executing assembly
Hello, I have a printf statement in S-Function, like printf("Process Completed"); But i want to display the message depending on the executing assembly language.(English, Japanese, French etc). How can this be done? Regards ...

Need to execute an assembly instruction from C
Hi, I am implementing an exception handler in vxWorks to issue a warning whenever unaligned access happens. Unfortunately I just cannot stop as VxWorks uses unaligned access in a lot of different places and it becomes virtually useless to stop execution. I have code in place to detect unaligned access and issue warning. Now I need to continue executing as if nothing happened. For this I need to disable alignment fault, execute the same instruction (PC at fault), reenable it and continue execution. I need to know how to execute the instruction that created the fault? I know the PC...

Error Executing Assembler Program from a Stored Procedure
Hello, I have created a stored procedure using SPUFI. The stored procedure is defined to execute an external Assembler routine. There was no error while creating the stored procedure. While calling the stored procedure from a Java program I am getting the following error: Exception: java.sql.SQLException: [IBM][CLI Driver][DB2] SQL0444N Routine "GETMODDT" (specific name "") is implemented with code in library or path "", function "" which cannot be accessed. Reason code: "". SQLSTATE=42724 Any help would be greatly appreci...

Deviation in execution time of assembly routines on Power5.
Hi, I have implemented mathematical functions in Power5's assembly language. I have a Power5 which is a 1.65 GHz 2 way machine (AIX 5.3). These assembly routines have to be optimised for performance. I am using a FORTRAN tool(a simple Timer) for measuring the execution times. I am facing a problem. There is a difference in execution time of the routines when run together and separately. Also, there is no consistency in the execution times when the routines are exeuted on separate Power5 machines (though the environment and tool is same). Can anyone help sorting this out? Ch...

how to parse an executable in C and find out if there is any return(RET in assembly) or not
Hi, I was wondering if we could parse or do something in the executable( whose source language was C). How can I use some scripting language like perl/python to find out the information about the executable ? Is it possible ? Also, how does the compiler add inling to the program ? I know that whenever it sees"inline" in front of the procedure name, it inlines it. But if we give the -finline options, it inline all the procedures ? How does it do that ? does it parse ? Is there any good book or article that I can refer to ? I need to build a small compiler ? Can I build it ? Thanks ...

Running an Executable Before Executable JAR
Is it possible to run an executable prior to the execution of a JARfile? Currently, I am doing this via a batch file, but, my customeronly wants to click on the JAR file and have everything run(additional external executable first, then JAR).I haven't found anything online, although I'm not sure I'm searchingfor the correct terminology.Thanks for any help. Jason Cavett wrote:> Is it possible to run an executable prior to the execution of a JAR> file? Currently, I am doing this via a batch file, but, my customer> only wants to click on the JAR file and have everything run...

ASSEMBLY PERFORMANCE: Poisoned Assembly
I have an assembly that: 1. Will rebuild in under 2 minutes. 2. Seems normal in all other respects 3. Can take up to 2hours 30 minutes to save. This isn't a network issue, I have gigabit and bandwidth isn't being used The CPU is running 100% for the whole time during the save punctuated by blips of network access. I figure something has "poisoned" the assembly. Any thoughts or questions (even the obvious) on what to look at would be appreciated. TOP any patterns? Yup, 3. I know, they have to go. Add external references too. But, why at save and not on a CTRL-Q rebu...

Create executable from executable with py2exe
Hello, Is there any example how can I create executable from executable with py2exe.For example if I create main executable with some TextEntry ( wxpython ) and then when i write this code into this entry: import os print os.getcwd() print "ok" ....to main executable convert this code into executable with py2exe. Sorry for my english! Regards, Vedran ...

Problem executing an exe executable!
Hello I'm trying to run a exe file named butil.exe from within a java application. This is my code: Process p = run.exec("d:\\modec160\\p_21\\butil.exe"); BufferedReader err =new BufferedReader(new InputStreamReader(p.getErrorStream())); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String line; while ((line = in.readLine()) != null) { System.out.println(line); } while ((line = err.readLine()) != null) { System.out.println(line); } int exitValue = p.waitFor(); Syste...

Call Execute Does not conditionally execute
Hi All, I have some code where I parse a .sas file into a data set. I then apply some recoding rules to flag whether it is the start of a statement, the input dataset, the output dataset etc. I am using this as a basis to develop a code documentation tool. What I want to do is to combine the rows of code that I parse into rows back into a field based on the code block (ie: I want line 1 which has 'Proc printto log=mylog new;' and line 2 'run;' to become field 1 in a new table. I wrote the following code to do this. combining is based on a col called start_pos which is a numb...

linking executables
Hi all, I bet this question has been asked a thousand times. Is it in any way possible to link to an executable. Platform: Linux What would like to do: I have a binary, say mybin, I don't have the sources. I would like to dlopen it and execute the main() function. Is this, or a workaround possible. I don't want to "exec()"-it in a forked process. I bet this must sound like blasphemy ;-) Regards, Evert Evert Carton <me@you.he> spoke thus: > I bet this question has been asked a thousand times. > Is it in any way possible to link to an executable. > I w...

ADO Execute or command execute?
Hi there The below code executes some queries. As newbie I was wondering weather you are better of using connection execute or command execute to execute queries? I am asking as Gcnndoh.Execute "AppendDataEntrySummaryLevel2" causes a Run-time error '-2147217900 (80040e14). If I execute the query from the query editor it's working ok!! No messages!!! "*****code snipple******** Set Gcnndoh = CurrentProject.Connection 'append missing data entered "=Querynames" Gcnndoh.Execute "CreateTempdatacheck" Gcnndoh.Execute "AppendDataEntrySummaryLevel...

linking the executable
hello friends, i have at last created a wonderful code that has 3 executable in 3 directory. to run the code, i actually have to run this three seperately in 3 procs. seperately. is there any way of linking the executable ? rudra wrote: > hello friends, > i have at last created a wonderful code that has 3 executable in 3 > directory. to run the code, i actually have to run this three > seperately in 3 procs. seperately. > is there any way of linking the executable ? "Linking" is what you normally do to create an executable. If you already have three executable progr...

Assembling retroforth with a Forth assembler
I have indeed managed to disassemble retroforth to a source that I can reassemble. I mean really reassemble. I can put an XCHG|AX, AX| ( NOP, ) in the first definition and reassemble, and rf still runs. This shifts all addresses around. This is a fragment of how the source looks like with all the accumulated information incorporated: H_ are the header addresses, where the link points to. N_ are the name addresses, and X_ are the code addresses (In this forth execution tokens.) ( 0804,875D ) :H_last dl H_cmove X_last ( 0804,8765 ) :N_last d$ 4 "last" ( 0804,876A )...

Exploding sub-assembly in a assembly
Hi, After exploding the assembly, when I try to edit the placement of a sub-assembly in a particular computer at school the placement of the sub-assembly is edited. But on a another computer when I try to do the same only one component of the sub-assembly at a time is moved. In the assembly I would like to specify that I want to edit the placement of the whole assembly or for a particular part of the sub-assembly, can someone tell me how to specify this, thanks. I'm using WF2 on both computers. Thanks. > "Pablo" <pablo_vasquez213@hotmail.com> wrote ...

Assembly and Sub-Assembly BOM
Is there any way to show an exploded assembly (with its sub-assemblies exploded too) and have a bill of material in a repeat region list EVERY part and be able to show individual index numbers and balloons for all of them? "Jason L �" <tectranbrake@yahoo.com> wrote in message news:ixfXf.34$I55.9@fe10.lga... > Is there any way to show an exploded assembly (with its sub-assemblies > exploded too) and have a bill of material in a repeat region list EVERY > part and be able to show individual index numbers and balloons for all of > them? > sor...

Constructor assembly NET &quot;could not load file or assembly 'xxx, Version=1.0, Culture=...' &quot;
Hi, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A co-worker has provided an assembly (DLL) for use under LabVIEW (right now I'm using LV7.1) I can browse the namespaces and objects of the DLL, but, after selecting an object and running the VI, the constructor throws the following error: " Could not load file or assembly 'MydotNETDLLname, Version=1.0.1234.12345, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. in MydotNETDLLTest.vi " It looks like LabVIEW is trying to resolve a CSV string of values as a f...