www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/21/12:10:17

Xref: news2.mv.net comp.os.msdos.djgpp:7717
From: root AT ursa DOT smsu DOT edu (Tony O'Bryan)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: assembly
Date: 21 Aug 1996 03:25:19 GMT
Organization: Axiom Enterprises
Lines: 44
Message-ID: <4vdviv$mbe@ursa.smsu.edu>
References: <32177794 DOT 5CA AT unm DOT edu>
NNTP-Posting-Host: huwawa.smsu.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

strider7 AT unm DOT edu wrote:

> .file "junk.s"                          # new logical file

> .data

>    string:
>       .ascii "hello there!\r\n$"

> .text

> .global _main
> _main:

>       movl $string, %dx                 # move string into dx
        ^^^^

According to the DJGPP documentation, the assembler does not 
automatically generate code dependant on what size register you use.  
Although you used the %dx (16-bits) register, movl is trying to use a 
32-bit offset.  To correct this (I hope.  I've only read the docs once), 
use movw instead of movl.

> it works under win95, but doesnt under dos (with cwsdpmi v2), it prints out 
> junk on the screen.  am i doing this right, if im not, how come it works 
> under win95?

It's probably due to some idiosyncratic difference between the two DPMI 
hosts. 

> another question, what does '.align' do and why do i need it?

..align probably aligns the code on a boundary:

          .align 1     align code on a byte boundary
          .align 2     align code on a word boundary
          .align 4     align code on a dword boundary
            .
            .
            .

--

I support the fight against "Look and Feel" patents.

- Raw text -


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