delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/02/18:07:11

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: String output using AT&T
Date: Thu, 02 Sep 1999 13:29:07 -0700
Organization: Harvey Mudd College
Lines: 36
Message-ID: <37CEDE13.63CA84F5@hmc.edu>
References: <7qmho2$56c$1 AT tron DOT sci DOT fi>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 936304161 62390 134.173.45.219 (2 Sep 1999 20:29:21 GMT)
X-Complaints-To: usenet AT nntp1 DOT interworld DOT net
NNTP-Posting-Date: 2 Sep 1999 20:29:21 GMT
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.12pre4 i586)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

stefan fröberg wrote:
> 
> Hello everyone !
> 
> How is the following MASM code translated to AT&T inline assembly ?
> 
> data    seg
>     message    db    "Hello there !$"
> data    ends
> 
> code    seg
>     mov    ax,data
>     mov    ds,ax
>     mov    dx,offset message
>     mov    ah,09H
>     int    21H
> 
>     mov    ax,4C00h
>     int    21H
> code    ends

Translating it directly won't work.  You have not only a different
syntax, but a different processor mode and a different memory model.

Personally, I would translate it

printf("Hello there !");
exit(0);

Since this snippet involves passing a buffer to DOS, it's a bit
complex.  But if you really want to make it work, see FAQ sections 18.2
and 18.13.
-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019