delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/23/08:54:49

From: "Michael Duxbury" <M DOT R DOT Duxbury AT btinternet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: assembler probs
Date: Fri, 23 Mar 2001 13:32:19 -0000
Organization: BT Internet
Lines: 100
Message-ID: <99fj5s$lvq$1@neptunium.btinternet.com>
References: <99dc06$p3b$1 AT uranium DOT btinternet DOT com> <83snk5d1sy DOT fsf AT mercury DOT st DOT hmc DOT edu>
NNTP-Posting-Host: host62-7-34-89.btinternet.com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Sorry about this as I am totally new to this assembler and C in a way.

I have tried using the line hello:  .ascii "Hello, world!", but still get
same error:- Parse error before 'hello'

I presume that it is the same line thats bringing the error.

The other stuff you mentioned I don't really want to go there yet. Will I
not be able to get a clean compile till I have fixed them other areas?

thanks for your patience.

#include <stdio.h>

void drawline(int x1,int x2, int y, char color);


int main()
{
  drawline(23,34,56,12);
  }

void hello() {
    asm ("movb  %ah,ox09;
        movb     %dx,$hello;
        intb     0x21;
        movb     5ax,0x4c00;
        intb     0x20;"

 hello: .ascii "Hello, world!"$ )
 }


void drawline(int x1,int x2, int y, char color)
{
  asm (" movb %ax , 0xa000");
}


"Nate Eldredge" <neldredge AT hmc DOT edu> wrote in message
news:83snk5d1sy DOT fsf AT mercury DOT st DOT hmc DOT edu...
> "Michael Duxbury" <M DOT R DOT Duxbury AT btinternet DOT com> writes:
>
> > I am trying to compile this but get a slight problem with the hello:
db
> > 'Hello, world!'  line.
> >
> > I can't seem to find an example of how the gcc compiler handles this
part of
> > assembly
>
> info as (the assembler manual).  It should look like
>
> hello:  .ascii "Hello, world!"
>
> However, this won't work, because the int 21h functions need their
> buffers in conventional memory, not in the upper-memory address space
> of your program.  See FAQ chapter 18.  Your drawline function has a
> similar problem.
>
> Also, you've forgotten the terminating $.  And use either int 20h (no
> special registers needed) or int 21h / ah=4ch (preferred), but not a
> mix like you have; it's confusing.
>
> > #include <stdio.h>
> >
> > void drawline(int x1,int x2, int y, char color);
> >
> >
> > int main()
> > {
> >   drawline(23,34,56,12);
> >   }
> >
> > void hello() {
> >     asm ("movb  %ah,ox09;
> >         movb     %dx,$hello;
> >         intb     0x21;
> >         movb     5ax,0x4c00;
> >         intb     0x20;"
> >
> >  hello:   db    'Hello, world!' )
> >  }
> >
>
> > void drawline(int x1,int x2, int y, char color)
> > {
> >   asm (" movb %ax , 0xa000");
> > }
> >
> > Anyone help me out please?
> >
> >
>
> --
>
> Nate Eldredge
> neldredge AT hmc DOT edu


- Raw text -


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