Tech Support > Microsoft Windows > Drivers > How to solve the error: operand size conflict
How to solve the error: operand size conflict
Posted by Eva on September 12th, 2005


Hi all

I am the new to assembly.
I need to handle the error of the following code.
Does anyone have an idea how to slove the eorror of operand size conflict?

_asm{
push ds
push es
push si
push di
lea di,buffer
push ds
pop es
mov cx,bytes
mov ax,c000h
mov ds,ax // error C2443: operand size conflict
xor si,si
rep movsb
pop di
pop si
pop es
pop ds
}

Thank you so much!

Regards,
Eva



Posted by Calvin Guan on September 12th, 2005


"Eva" <Eva@discussion.microsoft.com> wrote in message
news:%23Dt6kT1tFHA.3252@TK2MSFTNGP10.phx.gbl...

pay attention to this. It doesn't work for 32-bit code.

What is "bytes"? It has to be 16bit variable such as USHORT,SHORT,WORD...


You must say 0c00h


This one is perfectly fine. You must be reading the line# wrong.

--
Calvin Guan (Windows DDK MVP)
NetXtreme Longhorn Miniport Prime
Broadcom Corp. www.broadcom.com



Posted by Eva on September 12th, 2005


Hi Calvin

Thanks for your reply.

You are right. I make a mistake.
I read the line number again.
The wrong line is "mov ax,0c000h".
The error message is "error C2443: operand size conflict".

If the instruction "lea di,buffer " did not work for 32-bit code, which
instruction do I use to replace it?

In the original code, the type of "bytes" is "int".

Could I use memcpy to replace this assembly code, like memcpy(buffer, (const
void *)0xC000, bytes)?

And I have to do it make this part of code could be work both on x86
plarform and x64 platform.
Do I need to write two version; one is for x86 plarform, and the other is
for x64 platform?

Thank you.

Regards,
Eva


"Calvin Guan" <hguan@nospam.broadcom.com> ¼¶¼g©ó¶l¥ó·s»D:e9tE692tFHA.3548@TK2MSFTNGP10.phx.g bl...


Posted by Eva on September 12th, 2005


Hi Calvin

I have modified the type of bytes to fit the type of 16bit variable.
Now the compile error is fixed.
But there is a runtime error.
It fails on that line "mov ds,ax".
The exception message is "0xc0000005: Access Violation".
Is there anything wrong to execute that line "mov ds,ax"?

Thank you.

Regards,
Emily


"Calvin Guan" <hguan@nospam.broadcom.com> ¼¶¼g©ó¶l¥ó·s»D:e9tE692tFHA.3548@TK2MSFTNGP10.phx.g bl...


Posted by Ivan Brugiolo [MSFT] on September 12th, 2005


Getting the BIOS version of a video card by reading from the physical
address where
the video memory would be mapped is not recomended,
since it's non portable and machine dependent.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"Eva" <Eva@discussion.microsoft.com> wrote in message
news:%23Dt6kT1tFHA.3252@TK2MSFTNGP10.phx.gbl...


Posted by Eva on September 13th, 2005


Hi Ivan

Thank you fro your reply.
I am new to this field, so I want to ask more.
I need to read the BIOS data of the video card.

Are there any possible ways to do that?

Thank you.

Regards,
Eva





"Ivan Brugiolo [MSFT]" <Ivan.Brugiolo@online.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D:eMD4ng7tFHA.3336@TK2MSFTNGP10.phx.g bl...


Posted by Eva on September 13th, 2005


Hi all

Could I get the BIOS data of video card from registry?

Thank you.

Regards,
Eva

"Ivan Brugiolo [MSFT]" <Ivan.Brugiolo@online.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D:eMD4ng7tFHA.3336@TK2MSFTNGP10.phx.g bl...



Similar Posts