assemble load and execute rather than assemble link and execute

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
John
9/11/2004 11:10:24 AM
comp.lang.asm.x86 4984 articles. 0 followers. Post Follow

11 Replies
441 Views

Similar Articles

[PageSpeed] 32

> 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
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
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
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
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
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
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
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
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
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
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
Randall
9/14/2004 3:21:43 PM
Reply:

Similar Artilces:

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

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

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

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

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

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

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

Strange error when linking C to assembler in x86-64
Hello World! I'm playing with x86-64 assembler on a newbie level, using the tools from VS9. I have these files: === foo.asm ========================================================== ..data ..code foo proc movaps xmm0,[rcx] movaps xmm1,[rdx] mulps xmm0,xmm1 movaps [r8],xmm0 ret foo endp dot proc movaps xmm0,[rcx] movaps xmm1,[rdx] dpps xmm0,xmm1,11111111b movaps [r8],xmm0 ret dot endp getClock proc rdtsc or rax,rdx ret getClock endp END ; End of file. === main.c =========================================================== #include <stdio.h>...

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

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

Web resources about - assemble load and execute rather than assemble link and execute - comp.lang.asm.x86

Avengers Assemble (comics) - Wikipedia, the free encyclopedia
Avengers Assemble is an ongoing comic book series featuring the Marvel Comics superhero team the Avengers . Its initial release coincided with ...

Super Heroes Assemble on the App Store on iTunes
Get Super Heroes Assemble on the App Store. See screenshots and ratings, and read customer reviews.

Awesomenauts Assemble! - Flickr - Photo Sharing!
Explore PlayStation.Blog's photos on Flickr. PlayStation.Blog has uploaded 24346 photos to Flickr.

Marvel's Avengers: Age of Ultron and Samsung Mobile present 'Assemble' Part 2 - YouTube
Part 2! Lionel Messi, Eddie Lacy, John John Florence, Fabian Cancellara and two lucky super fans suit up as Avengers in the big finale of our ...

Iraqi Kurds feel sidelined as US assembles anti-ISIL coalition
They were once considered the one domestic force that could stop the Sunni terrorist group's onslaught, but recent battlefield losses are calling ...

Cate Campbell flies as superstars assemble for Pan Pacs sprint showdown
In the midst of the return of Michael Phelps to international competition and the showdown between Nathan Adrian and James Magnussen, it was ...

A-list cast assembles for The Secret City’s, Foxtel’s hotly anticipated six-part political drama series ...
Even when posing for Insider’s exclusive first look at The Secret City’s impressive A-list cast, popular Australian actor Anna Torv could barely ...

The struggle is real: watch new dad Ryan Reynolds attempt to assemble IKEA cot
Ryan Reynolds may play a superhero on the big screen, but he has found his kryptonite.

Ask LH: How Can I Assemble A Bucket List?
Dear Lifehacker, How might I go about making a ‘bucket-list’? I know it should have all the things I want to do/see/experience. But what a... ...

Climate protest assembles outside Cairns G20
A peaceful protest has gathered in Cairns to bring attention to clean energy to the G20 finance meetings.

Resources last updated: 2/5/2016 11:33:22 AM