www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/24/22:45:13

Message-ID: <32489A06.3E14@magna.com.au>
Date: Wed, 25 Sep 1996 12:33:42 +1000
From: Martin <beable AT magna DOT com DOT au>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
To: djgpp AT delorie DOT com
Subject: Inline assembler with parameters

Gidday,

	I am trying to get going using inline assembler with DJGPP and I have a
couple of problems/questions.

	Firstly, how do I represent HEX and binary numbers. Normally I would do
somthinge like 10h(for hex) and 1011001b(for binary). I also
tried creating a little routine, however it fails to compile :-(

void setvga(unsigned short mode)
{
    __asm__ __volatile__(" movw %0, %ax\n
                           movb $0, %ah\n
                           int $16 "
                           :
                           : "g" (mode)
                           : "ax" );

}

It comes up complaining about the letter following %. This is a little
confusing for me. Both the AX and AH registers are valid for this chip
and so I tried substituting %1 insead of %0 for the parameter but it
complained about being out of range(which I expected). I am out of ideas
why this is broken. Could someone please shed some light on this for me
please. 

   Thank you.

    Martin.....

- Raw text -


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