delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/22/08:44:57

From: boylesgj AT lion DOT cs DOT latrobe DOT edu DOT au (Gregary J Boyles)
Newsgroups: comp.os.msdos.djgpp
Subject: Inline asm macro problem.
Date: 22 Apr 1997 08:59:44 GMT
Organization: Comp.Sci & Comp.Eng, La Trobe Uni, Australia
Distribution: world
Message-ID: <5jhum0$575@lion.cs.latrobe.edu.au>
NNTP-Posting-Host: lion.cs.latrobe.edu.au
Lines: 30
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I have the following macro which I am using in an ISR.

#define INPORTB(Port,Byte) asm volatile ( \
                                          "\ninb %1,%%al\n" \
                                          "movb %%al,%0\n" \
                                          : "=g"(Byte) \
                                          : "g"(Port) \
                                          : "memory","al" \
                                        )
Inside the ISR I have two variables : KeyBoardPort and ScanCode.

I want to call the macro as follows  : INPORTB(KeyBoardPort,ScanCode).

The problem is that the macro expands to : inb -4(%ebp),%al; movb %al,-9(%ebp);
and the first argument of inb ends up as a non literal which causes the error
messages below.

There must be a way around this because I can happily pass KeyBoardPort to
the dos library function inportb(...).

Can any one help me out?


inputisr.s: Assembler messages:
inputisr.s:1290: Error: operands given don't match any known 386 instruction
inputisr.s:1922: Error: operands given don't match any known 386 instruction
inputisr.s:2052: Error: operands given don't match any known 386 instruction
inputisr.s:2077: Error: operands given don't match any known 386 instruction
inputisr.s:2103: Error: operands given don't match any known 386 instruction
inputisr.s:2142: Error: operands given don't match any known 386 instruction

- Raw text -


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