News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

What is this code doing

Started by Warlock, December 11, 2009, 01:16:55 AM

Previous topic - Next topic

Warlock

I have reach a resources for assembly language and find the following resource code.
This is a very simple hello world program.

Quote
.model small
.stack
.data
message   db "Hello world, I'm learning Assembly !!!", "$"

.code

main   proc
   mov   ax,seg message
   mov   ds,ax

   mov   ah,09
   lea   dx,message
   int   21h

   mov   ax,4c00h
   int   21h
main   endp
end main

Ok !!! can anyone tell me why need to mov ah,09.Is there any purpose.  :8)

dedndave

lol - there sure is
INT 21h is the DOS function dispatcher - sometimes called the services dispatcher
the requested function number is placed in AH
function 9 displays the '$' terminated string at DS:DX

If you intend to continue writing 16-bit programs, I suggest you download Ralf Brown's Interrupt List:

http://www.cs.cmu.edu/~ralf/files.html

The list is organized in 6 ZIP files (inter61a.zip-inter61f.zip). This is the most complete list of interrupts available.
Most of the information you will need is in the first 2 ZIP files (inter61a.zip and inter61b.zip).

The files are fairly large text files. If you look down the list a little further, there is a program for viewing them.
It is called Ralf Brown Interrupt List Viewer, or simply RBIL Viewer (rbilv21.zip).

The individual text files have names like INTERRUP.A, INTERRUP.B, and so on.
You may want to rename them to something like INT_A.TXT, INT_B.TXT, etc. to make them easier to use.

Ralf's List has a lot of information you may never use, because they try to make it complete.
On the other hand, it is full of useful tables and structure definitions that are hard to find elsewhere.

this thread belongs in the 16-bit sub-forum

Warlock

Thanks you denddave.You have help me a lot and I will download the resource to refer.

Ya,this thread is belong to 16 bits programming.I have misplace the post.Sorry.