K
K
Korifa2021-05-05 12:38:24
C++ / C#
Korifa, 2021-05-05 12:38:24

How to pass an argument to an assembler insert in C?

How to pass string parameter to asm insert?

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

void testt(char *n);

void main() {
  char *str;
  printf("\nEnter string: ");
  str = (char *) malloc(10+1);
  scanf("%s",str);
  printf("\nString is : %s",str);
  
  testt(str);
}

void testt(char *n) {
  __asm {
      push bp
      mov  bp, sp
      
      mov  dx,[bp+4]
      mov  ah,09h
      int 21h
  }
  
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question