Mail Archives: djgpp/2002/01/28/11:01:06
Joel Saunders <jbs30000 AT aol DOT com> wrote:
> __asm__("
> movw My_Name, %si
> movw Screen_PTR, %di
> movw $7, %ecx
> movsb
> -[_]--------------------------- Message Window --------------------
> Creating: nptest.exe
> Error: nptest.o: In function `main':
> nptest.cpp(6) Error: undefined reference to `My_Name'
> Error: nptest.cpp(.text+0xd): undefined reference to `Screen_PTR'
> What did I do wrong?
1) You put your inline asm into a C++ program. Bad idea because
2) external names seen by the assembler are not exactly the same as
C object names, and for C++ that's quite a lot worse again.
Inspect gcc -S output to see what the C++ compiler actually used
as the names of those objects.
3) You didn't use extended inline assembly. Would have saved you quite
some grief here, if only because it knows about name mangling.
4) You didn't read enough of the documentation to know that a Screen_PTR,
as defined by you, doesn't exist in protected mode programs. You
have to use a different selector in the ss register.
5) You almost definitely want to use %esi and %edi, not %si and %di.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -