Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi all,
What should I do to read a simple text file in assembly?
should I use interrupts in such a program?
I know that by 'import' you can use another code in another file. but for text, no!

I don't know the assembler API for Windows systems, but I can assure you have no need to set up an interrupt driven code to accomplish a so easy task. Just refers to the API calls to open and read a text file, the simplest of archives.

The "assembler API" for Windows is generally the same one C programs use -- though there are often two versions of any function that touches strings (an ANSI (8-bit) and a Wide (utf-16) version). For instance, there's a MessageBoxA and MessageBoxW. (C hides this little detail with macros.)
Semi obviously, since you're not using C, the C library probably isn't automatically available to you. However, if you have an assembler or linker that knows how to read DLL and EXE files, or have inc files that declare the functions within, you can probably link with msvcrt.dll and use that...
Or, you could just use the Windows functions. The API has functions for just about everything Windows lets you do. Look in MSDN for functions like CreateFile and ReadFile. :) Just mind your calling conventions; Windows usually prefers to clean up its own stack (see this description of Windows calling conventions), and keep in mind that the "standard" (__stdcall) convention is what most of the API uses. Hence the name. :)

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |