Assembly in VC 6 ++

Started by
17 comments, last by Bruno 23 years, 6 months ago
Hi I''m tryng to make a little assembler function inside VC, and i keep getting a stupid compilation error. The error is: D:\diske\test.cpp(463) : error C2415: improper operand type being the line 463 the last assembler line. If i delete that line, then the compiler will go to the previous line, and so on, until i have no assembler code.. lol With _asm before each line, the result is the same., do i have to setup visual c, somewhere, so that i can compile asm inline code? thanks My code, is the following: void drawH(int ymin,int ymax,int y) { int i=ymin; __asm { um: mov ax,1 mov sbuffer[y],1 cmp i,ymax jne um } } thanks Bruno
Advertisement
If it''s anything like Borland, it should be like this:

void drawH(int ymin,int ymax,int y)
{
int i=ymin;
__asm {
um:
mov ax,1
mov sbuffer[y],1
cmp i,ymax
jne um
}

Notice the squigily bracket just after __asm
Um, that didn''t work, i just tried it.

I''m assuming we don''t have MASM.
Just a thought: do you have a ";" after it all?
like:
    __asm{//code};    

??

BTW, I have no experiense of assembler in VC++
It''s been a long time ago since I''ve done assembly, but I think this will compile:

    void drawH(int ymin, int ymax, int y){  int i=ymin;  __asm  {  um:    mov  ax, 1    mov  WORD PTR [sbuffer+y], 1    cmp  i, ymax    jne  um  }}    



btw. Just a question, why are you filling sbuffer with one byte at a time?
Hi
thanks for the replys.
I have just started assembler., i''m filling one byte at a time, because i still don''t know a fast way to do it

I still can''t compile, i tried everything you guys said, my compiler simply refuses any assembler command.. , any ideias ???
This works :D. I think it''s an endless loop though . I don''t know much asm at all. I learned just enough to understand adresses and values for pointers.

    __asm	{	um:	   mov ax, 1           add ax, 2	   jmp um	}    
sbuffer's global?

I don't think you can do a [][] in asm

You have to do it in multiple steps, [][] takes 2 derefences

Edited by - Magmai Kai Holmlor on October 7, 2000 8:29:29 PM
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
You have to use a break!

    __asm{}break;    


Good luck!




-=[ Lucas ]=-
-=[ Lucas ]=-
Hmm.. don''t the labels have to be outside the brackets?

like:

void drawH(int ymin,int ymax,int y)
{
int i=ymin;
um:
__asm
{
mov ax,1
mov sbuffer[y],1
cmp i,ymax
jne um
}

"Unintentional death of one civilian by the US is a tragedy; intentional slaughter of a million by Saddam - a statistic." - Unknown

This topic is closed to new replies.

Advertisement