Results 1 to 2 of 2

Thread: passing command line arguements in asm thru C !

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    166

    passing command line arguements in asm thru C !

    hello
    i'm writing this C program to run a asm. i want to pass command line arguements to this asm.
    but when i use mov cx,argv[1], it says operand size conflict. may be because mov requires 1 byte and argv[1] is sending 2 bytes. what is the possible solution ?? i need to use command line arguements only, what is the other way out to do this ?

    i'm also including a sample program. pls suggest me how to go abt it.

    waiting for a quick response.

    thanks
    shruti !!




    #include <stdio.h>
    #include <conio.h>
    #include<string.h>

    void main(int argc,char *argv[])
    {

    FILE *fptr;
    printf("in func\n");


    _asm
    {
    MOV CX,0FF20H
    MOV DX,3F8H

    }


    getch();
    }

  2. #2
    Hyperactive Member
    Join Date
    Jun 2002
    Posts
    299
    are you sending the address of argv[1] or the actual value? if you are sending the address you need a 32 bit register, because all addresses are 32 bits long. if you're sending the value, i assume a char value, it should be perfectly fine... is that what you mean? another way to do this... command line arguments go to the stack.not sure if when a C program runs, and puts them in argv[] if it clears it, but you could push them on the stack somehow and pop them in the asm.
    If I agree with you today, don't get used to it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width