www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/31/16:19:49

Message-ID: <000801be4d5f$66931660$9fbc98ce@waldroni>
From: "Isaac Waldron" <waldroni AT lr DOT net>
To: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Cc: <djgpp AT delorie DOT com>
Subject: Re: Accessing Constants in Assembly Code
Date: Sun, 31 Jan 1999 16:19:33 -0500
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
Reply-To: djgpp AT delorie DOT com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

- -----Original Message-----
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Isaac Waldron <waldroni AT lr DOT net>
Cc: djgpp AT delorie DOT com <djgpp AT delorie DOT com>
Date: Sunday, January 31, 1999 2:42 AM
Subject: Re: Accessing Constants in Assembly Code


>
>On Sat, 30 Jan 1999, Isaac Waldron wrote:
>
>> C:\waldroni\projects\graphics>gxx -o testc.exe testc.cc -lgraphics
>> c:/djgpp/lib/libgraphics.a(blit.o)(.text+0x4):../src/blit.s:
undefined
>> reference to `VideoRAM'
>
>Use the `nm' program (it's part of Binutils and should be already in
>your `bin' subdirectory) to see how does the compiler mangles the
name
>of VideoRAM, then make sure the assembly source references the
mangled
>name.
>
>Alternatively, declare VideoRAM ``extern "C"'', which disables
>mangling.

I executed this command:

gxx -S mode13.cc

and looked at the resulting mode13.s.

Here's the block from mode13.s that appears to define VideoRAM:

LFE3:
.lcomm _VideoRAM,4
    .section .ctor
    .long   __GLOBAL_$I$_screen_width
.text
    .p2align 2
.globl __GLOBAL_$I$_screen_width
__GLOBAL_$I$_screen_width:
LFB4:
    pushl %ebp
LCFI124:
    movl %esp,%ebp
LCFI125:
    pushl $40960
LCFI126:
    call ___dpmi_segment_to_descriptor
    movl %eax,_VideoRAM
    leave
    ret

So, the symbol _VideoRAM (which points to a 4-byte area of the data
segment) should be able to be accesed from my assembler code as
_VideoRAM, right?

Thanks again,
Isaac Waldron

-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.0.2

iQA/AwUBNrTI5FvPBN9ggn+IEQIQJgCePRIpRrPEsFPLexHARKil9VR8trcAoMuR
8oP2mus3uPEh3KE+qgu6HVg3
=afHr
-----END PGP SIGNATURE-----


- Raw text -


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