EmbeddedRelated.com
Forums

Programs compiled with Intel's ASM86 won't run under DOS operating system

Started by PISZCZ, Bogdan March 30, 2004
Hi,


I have written a simple assembler source code. I let it pass through 
Intel's ASM86 assembler, linker, locator and oh86 (without any command 
line options respectively) - without any error massages output. The file 
resulting of passing the locator doesn't run under DOS. Neither does the 
.hex file (made of the latter with the oh86). I also tried renaming the 
.hex file to an .exe file - the result was (as expected) the same, so that 
I don't know, how to run my programs under DOS or how to make executables, 
which I could launch on my PC under MS DOS operating system. Can anyone 
tell me how can I do it? Or did I possibly make any mistake(s), omitting 
any command line options or in the source code itself?

I'm a newbie and I would just prefer learning assembler with Intel's ASM86 
because I have a voluminose, very good elaborated and very precise Intel's 
original educational documentation (programming and hardware manuals), 
with several complex programming examples. Unfortunately, other assemblers 
- for example A86 by Eric Isaacson or Borlands TASM - are not compatible 
to Intel's ASM86's original syntax.



Some more questions:

1. When I invoke any executable .com or .exe file under DOS, at which 
address in the memory is it loaded? Can this memory address be in anyway 
affected by the source code?

2. What's the difference between an ordinary binary file and a hexadecimal 
one?


Thanks.



And the following is the mentioned before source code:



name		hello
assume	cs:cod_seg, ds:dat_seg, ss:st_seg


dat_seg	segment

message	db	'Hello',13,10,'$'

dat_seg	ends


st_seg	segment

		DW 10 dup(?)
stack_top	label word

st_seg	ends

cod_seg	segment

start:	mov	ax,dat_seg
		mov	ds,ax
		mov	ax,st_seg
		mov	ss,ax
		mov	sp, offset stack_top
		
		mov	ah,9h
		mov	dx,offset message
		int	21h

		mov	ah,4ch
		int	21h
cod_seg	ends


end		cs:start, ds:dat_seg, ss:st_seg

"PISZCZ, Bogdan" <b.piszcz@t-online.de> wrote in message
news:opr5nubpxyetom66@news.individual.de...
> Hi, > > > I have written a simple assembler source code. I let it pass through > Intel's ASM86 assembler, linker, locator and oh86 (without any command > line options respectively) - without any error massages output. The file > resulting of passing the locator doesn't run under DOS. Neither does the > .hex file (made of the latter with the oh86). I also tried renaming the > .hex file to an .exe file - the result was (as expected) the same, so that
You're take too many steps here. You only need to run the assembler and the linker. The linker will produce an .exe file which you can execute in DOS. The locator is a tool that fixes the relative locations of an exe to fixed ones, for programming in an eprom on an embedded system, while oh86 makes a hex file of the output of the locator to be able to be read by a programmer. Meindert
PISZCZ, Bogdan <b.piszcz@t-online.de> wrote:

> I'm a newbie and I would just prefer learning assembler with Intel's ASM86 > because I have a voluminose, very good elaborated and very precise Intel's > original educational documentation (programming and hardware manuals), > with several complex programming examples.
If that tutorial stuff really is so brilliant, how come you couldn't find the answers to you questions in it and had to come here to ask? The example code you showed seems completely unaware of the existence of MS-DOS. That's "raw iron" code, i.e. stuff you would run on an special-purpose processor evaulation board or embedded hardware, not on a DOS PC. With all due respect, I suggest you get yourself a set of tutorials actually teaching you DOS assembly programming, not just ix86 processor manuals.
> 1. When I invoke any executable .com or .exe file under DOS, at > which address in the memory is it loaded? Can this memory address be > in anyway affected by the source code?
Usually at the lower end of free memory, but the program calling your .com or .exe can change that. And no, your source code can't usually affect that process.
> 2. What's the difference between an ordinary binary file and a hexadecimal > one?
The difference is that the .hex file isn't a binary file at all. It's a pure ASCII text file that contains a specially formatted hex dump. Unless you're going to burn your program into some kind of ROM, you don't want to know about .hex files. -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
On 30 Mar 2004 11:25:45 GMT, Hans-Bernhard Broeker 
<broeker@physik.rwth-aachen.de> wrote:

> The example code you showed seems completely unaware of the existence > of MS-DOS. That's "raw iron" code, i.e. stuff you would run on an > special-purpose processor evaulation board or embedded hardware, not > on a DOS PC.
I would disagree, as "int 21h" is clearly DOS interrupt, with ah=09h being `dump a string to stdout' and ah=4ch being `exit program'. The OP's error seems to be "The file resulting of passing the locator doesn't run under DOS." To run a thingy under DOS only assemble and link are necessary. Not to say "renaming the .hex file to an .exe file" ... Vadim
Vadim Borshchev <vadim.borshchev@127.0.0.1> wrote:
> On 30 Mar 2004 11:25:45 GMT, Hans-Bernhard Broeker > <broeker@physik.rwth-aachen.de> wrote:
> > The example code you showed seems completely unaware of the existence > > of MS-DOS. That's "raw iron" code, i.e. stuff you would run on an > > special-purpose processor evaulation board or embedded hardware, not > > on a DOS PC.
> I would disagree, as "int 21h" is clearly DOS interrupt, with ah=09h being > `dump a string to stdout' and ah=4ch being `exit program'.
Hmm..., yeah, now that you mention it. But the absence of any ORG statement still feels wrong. If he's trying to make a .COM program, there should be .ORG 0100h or similar, somewhere. -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
"Hans-Bernhard Broeker" <broeker@physik.rwth-aachen.de> wrote in message
news:c4brtr$4hd$3@nets3.rz.RWTH-Aachen.DE...
> Hmm..., yeah, now that you mention it. But the absence of any ORG > statement still feels wrong. If he's trying to make a .COM program, > there should be .ORG 0100h or similar, somewhere.
An .exe program starts at 0000h. And this is default when no .ORG is given. Only a .com needs to be a 0100h. Meindert
Bogdan, try this:

ASM86 FILE.C

LINK86 FILE.OBJ TO FILE.EXE EXE

Intel's tools where thought to develop embedded programs, with iRMX or
no OS support at all. DOS support is an after-thought, and is done via
the "EXE" option of the linker (not available in all the options).

Good luck.

--
Ignacio G.T.
On 30 Mar 2004 13:15:39 GMT, Hans-Bernhard Broeker 
<broeker@physik.rwth-aachen.de> wrote:


> Hmm..., yeah, now that you mention it. But the absence of any ORG > statement still feels wrong. If he's trying to make a .COM program, > there should be .ORG 0100h or similar, somewhere. >
I tried org 0100h, with and without the preceding period &ndash; the period causes an error massage. Assembling the source code without the preceding period doesn't produce any error massage, but neither the linker output file nor the locator output file can be executed. I also tried with #make_COM# (with all possible modifications, like #make COM, #make_COM, make COM, make_COM) which causes asm86 to produce error messages ("illegal character" or "undefined instruction or illegal variable definition" or "syntax error"). Being a beginner, I have no idea, what else I could take as a "similar" instruction. Bogdan
On 30 Mar 2004 11:25:45 GMT, Hans-Bernhard Broeker 
<broeker@physik.rwth-aachen.de> wrote:


> If that tutorial stuff really is so brilliant, how come you couldn't > find the answers to you questions in it and had to come here to ask? >
1. Intel's ASM86 Development System was primarily intended for microprocessors without any OS, that's why the tutorials don't deal the question of running programs under DOS, I suppose. 2. There is no documentation, which would be absolutely perfect 3. There is no student, who would be absolutely perfect &ndash; the most probably case :-)
> The example code you showed seems completely unaware of the existence > of MS-DOS. That's "raw iron" code, i.e. stuff you would run on an > special-purpose processor evaulation board or embedded hardware, not > on a DOS PC.
It's nice to know, what's the cause for the failure, but it would be much nicer to know, how to make it properly, i.e. how to make it aware of running under DOS.
> The difference is that the .hex file isn't a binary file at all. It's > a pure ASCII text file that contains a specially formatted hex dump. > Unless you're going to burn your program into some kind of ROM, you > don't want to know about .hex files. >
I compared both, an .exe and a .hex file with an hex-editor. You seem to be right. But the .hex file is loaded into memory and launched on an embedded system. What I don&rsquo;t understand: how can an ASCII file run on a processor, with or without OS? Bogdan
On Tue, 30 Mar 2004 15:33:45 +0200, Meindert Sprang 
<mhsprang@NOcustomSPAMware.nl> wrote:

> An .exe program starts at 0000h. And this is default when no .ORG is > given. > Only a .com needs to be a 0100h. > > Meindert
I was also before aware of the fact, that an .exe at 0h and a .com at 100h starts. But what causes the program to start at the one or at the other one address? Is it only the .exe or the .com extension or are there other mechanisms? Are there more differences between them? Do you know a web site or a paper printed documentation about this item? Could you mail it to me (the latter as scanned picture, for instance, or the author and title) ? &ndash; Thanks Bogdan