I need to make an .asm program to save some values in a .txt file. Using C would be much easier, although I cant use it this time. Any idea how to do it?
Let the C compiler produce an assembly listing. Wow - so quick to get the code into assembler.
Question is - will it actually fulfill the requirements your teacher expected?
Have you even understood the comments you have receied in this thread?
Yes it is.
You really need to consider the question more.
#include <stdio.h>
FILE *f1;
main()
{ int cont = 00;
int address = 30;
f1 = fopen ("out.txt", "wt");
for (cont = 0;cont <= 10; cont = cont + 1) { fprintf (f1, "%d\t%d\n", cont, address); address = address + 1; } fclose (f1); }
I need this program in assembly, is it possible?
You haven't stated what tools you're using - so it's impossible to give a specific answer!
But you can search the manuals yourself for terms like "Calling Convention" and "Parameter Passing", etc...
Which FM?
Please read the manual: Your compiler Manuals will describe the calling conventions & data representation
Okay I will reconsider it. How can I send some values to a C program?
How can I declare that I want to make a txt with the name specified?
But you've not said what platform, what processor, what operating system you are using.
For all we know you might still have access to a C runtime libraries or an operating system. You could make calls to such facilites equally well from both C and assembler.
Would you like to try another rephrase of the question?
Aseembler code will not magically save any data in any text file.
To have a text file, you must first have a file. To have a file, you must have a file system. To have a file system, you must have some form of drive. That drive is very hardware-specific - something you haven't mentioned anything about.
Take 100 steps back. Reconsider. Do something else.
Yes thanks.
You might want to consider rephrasing your question.
View all questions in Keil forum