delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/07/10:54:02

From: Matthew B Kennedy <q9522772 AT helios DOT usq DOT edu DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: Problem when assembling external function using "asmdefs.h"
Date: Mon, 7 Oct 1996 23:27:07 +1000
Organization: University of Southern Queensland
Lines: 46
Message-ID: <Pine.HPP.3.95.961007232355.1559A-100000@helios.usq.edu.au>
NNTP-Posting-Host: helios.usq.edu.au
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello.  I've finished reading the AS assembler tutorial/guide, so
I tried making a simple program in assembler (to be linked with C).

The exact files and compile commands I have used are below.  As you 
can see, I am using the "asmdefs.h" file to be able access the FUNC, 
ENTER and LEAVE macros.  The problem is, the assembler spits-chips 
when it comes across the FUNC macro (see the compilation result).


Thanks in advance, 
Matthew

===== ADD.C ============================
extern int _addint(int a, int b);

void main(void)
{
  int a, b, c;
  c = _add_int(a,b);
  printf("%d+%d=%d\n",a,b,c);
}

===== ADD.S ============================
#include "libc/asmdefs.h"
.file "add.c"

.text
  .align 4
  FUNC(__addint)
  ENTER
    movl ARG1, %eax
    addl ARG2, %eax
  LEAVE

===== COMPILATION COMMANDS ============
[1] C:\DJGPP >gcc add.c add.s -o add
add.s: Assembler messages:
add.s:6: Error: invalid character '(' in opcode
add.s:7: Error: operands given don't match any known 386 instruction

=======================================

(Line 6 corresponds to the FUNC(__addint) line)


- Raw text -


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