🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #42317

Re: Assembly code in GNU C++ for DOS

#42317
From: Jean-Marc CHALLIER
Date: Tue, 12 Dec 1995 00:00
63 lines
2770 bytes
I presume you are using djgpp... If not, some of my statements may be
wrong.

Brea Torremocha (cur2n9) wrote:
: I have a problem with the assembly code.
: When I try  to send a pointer as an argument of an assembler
: function, this function ignores the argument.

You have prototyped your function in a header file, haven't you ?
something like :

extern void flip(void* ptr);

: movl 8(%ebp),%esi   /* Here is the problem. The function don't take
:                        the pointer */

Are you sure about the '8' ? I often program in asm, but often
without frame pointers - I use a number of special macros I wrote for
gas that free me of the word-counting. If you want them, they are on
DJ's ftp server. Or I can mail you the latest versions.

: pushw %ds

performance remark : you'd better use "pushl %ds". I KNOW ds is only
16 bits long, but it IS a valid asm instruction (I don't know and
don't give a damn about what tha x86 does with the 16 higher
bits. Maybe it sets them to 0). That would prevent the stack pointer
from being mis-aligned - You never now when an interrupt occurs, that
will extensively use the stack, or if you call go32's services.

: If somebody knows something, please tell me.


I'd say the best thing to do is :

1st try) write your function in a separate C-file, as close as
possible to your asm-source, and compile it with -S. Take a look at
the result. You'll see if you '8' is valid or if something unexpected
happens.

2nd try) Define a string "%d\n", push your argument, call _printf
(yes, close graphics FIRST) you take a look at the value of your
argument.

By the way, be careful : some VGA don't take 32-bits acces to their
video memory. Only the 16 lower bits would be transfered.

Good luck


BTW : could you provide a valid e-mail address when you post ?
thanx...

CU

                        Igx, The dreaming drummer...

-----------------------------------------------------------------------------
Igx, The dreaming drummer... in real(???) life : Jean-Marc CHALLIER
email : challier@irit.fr                | J-M CHALLIER,
pmail : IR1-17, UPS, 18 rte de Narbonne | 18, Bd Griffoul Dorval
        31000 Toulouse - FRANCE         | 31400 Toulouse - FRANCE
phone : (33) 61-55-63-57                | Tel : (33) 62-16-35-92
Technical Details
Message-ID: <4ajt9t$nad@orphee.irit.fr>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <4a1m27$2aq@acebo.sdi.uam.es>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,9fad1beb500fc472
X-Google-Attributes: gid11318c,public
From: challier@news.irit.fr (Jean-Marc CHALLIER)
Subject: Re: Assembly code in GNU C++ for DOS
Date: 1995/12/12
Message-ID: <4ajt9t$nad@orphee.irit.fr>
X-Deja-AN: 121609987
references: <4a1m27$2aq@acebo.sdi.uam.es>
organization: IRIT-UPS, Toulouse, France
reply-to: challier@irit.fr
newsgroups: gnu.gcc.help