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 4876 articles. 10 followers. Post

11 Replies
282 Views

Similar Articles

[PageSpeed] 6


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

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

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

calculation of execution time of assembly code in a realtime program with large number of tasks
Hi, I have some 20 lines of code in assembly . I have various tasks running. How to calculate the total time of execution of the code in assembly alone in Vxworks ? Since any task might get invoked due to various reasons , Is putting one printf that prints the current time at the start of assmbly and another printf at the end of assmbly code that prints the current time the only way for caculating the assmbly code execution time ? Any other ideas. Thx in advans, Karthik Balaguru On 04/01/2007 karthikbg wrote: > Hi, > > I have some 20 lines of code in assembly . > I have var...

Help, Visual DSP 5.0 crashes when executing inline assembly function.
Hello, I have an inline assembly program that keeps crashing. I had it working in Visual DSP4.5 but when upgraded to 5.0 it crashes. I can't figure it out. If you see why it crash could you please let me know. I'm using the TS101 DSP from Analog Devices. /*************************************************/ // Example: Poll_IRQ(INT_IRQ0_P); /*************************************************/ void Poll_IRQ(unsigned int IRQ) { // clear interrupt request asm volatile ("#include<defts101.h>;; " "Poll_IRQ: "\ "\n\txr0 = ILATH;; " // ...

how to ensure that just one single instance of a dll is loaded and linked by several executables
I need to be positive that one and only one instance of my DLL is dynamically loaded and linked at run time by four different .exe files. I have four executing programs, each of which does (I guess) a LoadLibrary() of my DLL. But there must be only one single instance of that DLL in memory, and I expect that each executable's LoadLibrary() call will link that single DLL instance into his local addr space. Why I need to link in this way: my DLL is the central mediator and coordinator of a bunch of interactions among my four executables. How do I accomplish such linkage? Thanks...

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

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

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

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

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

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

Display 'loading' message when scripts are executed and page is still loading
Hi all, Im trying to figure out how to display a 'loading' message when scripts are being executed, ie when the page is still not ready for interaction. This is for a web app which relies on javascript to insert dom elements and do stuff, so the user must know when everything is ready to interact with. I tried using an interval which checks for a specific variable (page_loading) and when its set to false then the 'loading' message is removed (its appended on page load). This requires that I set the variable to true at the start of each of my functions (at least the most time ...

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 happens when linking and execution?
Let's say I have a shared library (libmyFile1.so) that contains a function myFunc1 and it is called by a application myApp1. I build and link the application.... cc -o myApp1 myApp1.o -L/usr/source/lib -lmyFile1 Question 1 ------------------ What does this linking actually do? Does it copy the location of myFunc1 within the libmyFile1.so? I know if doesn't copy the actual code from the shared library unless I am linking statically. This leads me to my next question. Lets say I make numerous changes to the underlying code within libmyFile1.so, but no changes to the function name my...

Linking to properties of assembly
How can I add a linked note that references the sub-assy instead of the component? For example, I'm adding a note in an assembly. This assembly has several parts and sub-assys. I want to show the description of a sub-assy with a note but since I have to click on the sub-assy (and therefore a specific component within that sub-assy) my note always links to the component. I'm running an older version but I don't think this property linking has changed. Even if it has, how do you do it in 2005? in short You can't do it. I run into the same problem. I was creating a parts...

How to have a key execute a link
I have these links on a page <a href="dsc_0447.htm">[Prior]</a> &nbsp; <a href="dsc_0449.htm">[Next]</a> and I would like to have the right arrow and left arrow do the same as the links. How can I do that? Todd On Sun, 17 Oct 2004 20:57:58 GMT, Todd Cary wrote: > <a href="dsc_0447.htm">[Prior]</a> > &nbsp; > <a href="dsc_0449.htm">[Next]</a> > > and I would like to have the right arrow and left arrow do the same as > the links. How can I do that? That sounds like a bad i...

Error when assembling a link
Hi, I am assembling navigation links for an online article. The code works fine for WIN IE 6 users, but not for NN4, or Mac IE5 users. When it works, the resulting link looks like this: http://www.mydomain.com/pr3/article2.php On the machines with trouble, we get this: /pr3/\\\\www.mydomain.com\\pr3\\article2.php (Sorry for the dummy URL - I can't share the page yet) As you can see, the link is now relative, and the slashes are working out poorly. Is there a rule or technique I am missing that could make this calculation work for the older browsers? Thanks, Matt The relevant code...

[9fans] assembly loading
9fans, In this mips assembly code, R5 is not receiving the value of array. Am I doing something wrong? TEXT main+0(SB),0,$0 MOVW array<>+0(SB), R5 DATA array<>+0(SB)/8,$"Plan 9\z\z" GLOBL array<>+0(SB),$8 END , thanks, iru ...

Auto Execute on load
Hi Guys: I am having trouble finding information that will allow a program that I write to execute on loading. I am writing a very simple routine that will look for a very specific file in a named directory and if found, rename it. This routine will be scheduled to load and execute at 3:00 a.m., thus, I need the routine to handle the event without operator intervention, hence the auto execute on load. I am using Visual Basic Professional Edition, Revision 4.0. Any ideas will be appreciated, Craig Create a sub called Main. Specify the startup (Project properties) to be sub Main() Or pu...