You know that in a protected mode OS, outside of a kernel mode device driver, direct assignment of an address to a pointer us highly unlikely to work much less be correct?
I am not surprised. You had two problems, the one you asked about was a syntax problem. I have little experience with the in-line assembler syntax, so I posted a link. Your syntax remains incorrect.
The problem I referred to was a technical problem. It looks like you were trying to address the DOS video memory. MinGW GCC is not a DOS compiler and will not create DOS programs. Even if you did generate a DOS program, on Windows it would be virtualised, so any benefit that may have resulted from direct VRAM access in MS-DOS is entirely lost on a modern platform. In x86 protected mode (which Windows utilises) any attempt to access that memory will fail.
There are few reasons to ever use assembler, so you may be better off describing what you are trying to achieve. There may be a better solution.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
i am having trouble using AT&T syntax..i keep getting "undefined reference to NEW".
Here's my code:
[code]
void stdcall pa(void)
{
void p = (void)0xB49DC4;
asm("mov (p),%ecx");
}
[/code]
Related
Code: code
Hi,
Sorry for double post, i meant "Undefined reference to p"
You know that in a protected mode OS, outside of a kernel mode device driver, direct assignment of an address to a pointer us highly unlikely to work much less be correct?
That said, for general in-line assembler this may be useful: http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html GNU in-line assembler syntax is extraordinarily arcane.
I am still willing to bet however that whatever you are doing, it will crash.
Clifford
Hi,
even if i do:
int p = 1;
__asm("mov p,%eax");
i still get undefined reference to "p".
I am not surprised. You had two problems, the one you asked about was a syntax problem. I have little experience with the in-line assembler syntax, so I posted a link. Your syntax remains incorrect.
The problem I referred to was a technical problem. It looks like you were trying to address the DOS video memory. MinGW GCC is not a DOS compiler and will not create DOS programs. Even if you did generate a DOS program, on Windows it would be virtualised, so any benefit that may have resulted from direct VRAM access in MS-DOS is entirely lost on a modern platform. In x86 protected mode (which Windows utilises) any attempt to access that memory will fail.
There are few reasons to ever use assembler, so you may be better off describing what you are trying to achieve. There may be a better solution.
Clifford