Not-so-simple, but check out tutorial 2 in the zip I attached in this post (http://www.masm32.com/board/index.php?topic=5001.msg37427#msg37427). It uses lines... if it is too complex, just say and I will provide a stripped down version to make it simpler.
Ossa
[edit] Simpler example now attached [/edit]
[attachment deleted by admin]
I would love to do that, HATEM, but I'm a bit busy just at the moment. Specific questions can be quite easily answered in a small amount of time, so I prefer that. Also, I think that you'll find it beneficial to find out some things for yourself. The other issue is that I would really encourage people to write 32-bit code, as it is so much easier. If and when I have more time in the future (and people still want it), I may write such tutorials.
Attached is an example of a simple "Hello World" application using the SMALL model, that some people might find interesting. Here is a little explaination of the code:
.MODEL SMALL, C
.386
.DOSSEG
.STACK 200h
These 4 lines set up the model (SMALL) and calling convention (C), the processor type (386) and the standard segments for DOS (DOSSEG). Finally it sets up the stack segment.
.DATA
DollarTerm db 0Dh, 0Ah, "Hello World", 0Dh, 0Ah, "$"
These lines begin the DATA section (where data is stored) and defined a dollar ($) terminated string. The string starts with a line feed and carriage return (new line) then has the words "Hello World" then another new line and finally the "$" terminator.
.CODE
.STARTUP
These two lines start the code section and inserts the default startup (defines entry point, etc).
In the next few sections, we will use INT 21h/AH=09h. From Ralf Brown's Interrupt List:
QuoteDOS 1+ - WRITE STRING TO STANDARD OUTPUT
AH = 09h
DS:DX -> '$'-terminated string
Return:
AL = 24h (the '$' terminating the string, despite official docs which state that nothing is returned) (at least DOS 2.1-7.0 and NWDOS)
; Setup the segment register
mov ax, DGROUP
mov ds, ax
mov es, ax
Next we set the segment registers to the correct values for the DATA section (really only DS is needed, because we use DS:DX, but I do both out of habit).
; Setup the String
mov dx, offset DollarTerm
This line makes DS:DX point to the string
; Display the string
mov ah, 09h
int 21h
Now setup the function (AH=09h) and call the correct interrupt (21h)
.EXIT
END
Finally we add the exit code (could use INT 21h/AH=00h instead) and tell MASM that that is the end of the file.
[edit] forgot to say - run this from the command prompt, as it won't pause at the end and the console will disappear if run under windows [/edit]
Thanks,
Ossa
[attachment deleted by admin]
tank you very mach ossa :thumbu i hope there is who want to learn 16bit too