0

like we have format specifiers in C to display variable values in messages

int a=5,b=6;
printf("The value of A is %d and B is %d",a,b);

So how can we produce the same in MASM 615?

I want output like this reference image

  • 1
    format characters into a buffer yourself, call printf in asm, or call separate output functions for each part (that don't implicitly append newlines). The details depends on how you want to do I/O, and what libraries / APIs are available. (e.g. Windows with a C library, calling printf is easy and saves a lot of work.) – Peter Cordes May 02 '21 at 19:16
  • @PeterCordes I'm using Irvine32.inc library for the project and want to solve this problem in stdcall convention. Can you share the chunk of code required – Muhammad Adil May 03 '21 at 08:52
  • Ok, then you probably want to make a sequence of WriteString and WriteInt calls, same way as you usually would, but with separate pieces of the string between the two WriteInt calls. Or you *could* call _printf from the C library if you link it. You didn't say until now whether you were making a Windows or a DOS program. – Peter Cordes May 03 '21 at 09:07
  • DOS Program for college project – Muhammad Adil May 03 '21 at 09:15
  • Wait what? Irvine**32** only runs in 32-bit mode, not 16-bit DOS. There is an Irvine16 for 16-bit DOS, but Irvine32 runs natively under Windows. [What is the Irvine32 library and why do we use it?](https://stackoverflow.com/q/54386649) – Peter Cordes May 03 '21 at 09:18

0 Answers0