;   DOSWIN.COM  --  Simple MASM example program for MS-DOS or MS-Windows.
; It can be run in a DOS-box as others usually are, or executed from the
; Windows Shell (Explorer.exe) *without* disappering!
;
;  Copyright(C)2004 by Daniel B. Sedory.
;
;  Assemble using MASM's 16-bit assembler/linker ( \MASM>ml DOSWIN.ASM ).
;
; Many optional switches exist under MASM; for example:
;	/Fl[file] -- To generate a listing
;	/Sa       -- To maximize source listing
;	/WX       -- To treat 'warnings' as errors
;   Enter "ml /?" for a full list.  So, "ml /Fl /Sa /WX" would be good for
; catching any warnings and creating a detailed listing of your program.
;
;   The specific code used here is to show beginning MASM programmers that
; data bytes (as seen in the first message here) can be inserted inside of
; a .code section and jumped over. Also that any labels used inside of the
; .code section to define a location must end with a colon (:) *whereas*
; those inside of a  .data section do not end with a colon.
;

.MODEL	TINY
.286

.code

.startup

	jmp	ToStart	  ; Jump over data we placed in .code section.

Message:

	db	13, 10, 13, 10
	db	"   This .COM program runs under MS-DOS or MS-Windows."
	db	13, 10, 24h		;  $-sign-terminated string

ToStart:

	mov	dx, OFFSET Message	; Offset of our Message
	mov	ah, 9			; Function 9 of INT 21
	int	21h			; Display $-String

	mov	dx, OFFSET WinMsg
	mov	ah, 9
	int	21h

	mov	ah, 0		; Function 0 of INT 16
	int	16h		; Wait for a keypress

	mov	ax, 4c01h	; Function 4C01 of INT 21
	int	21h		; Normal Program Termination

.data

WinMsg	db	13, 10, 13, 10
	db	"   Press any key to exit program . . ."
	db	13, 10, 24h	;  $-sign-terminated string

END

;
; Example of how to assemble and link of the DOSWIN.COM source code:
; =======================================================================
; C:\theStarman\asm\jkirwin\MASM>ml /Fl /Sa /WX  DOSWIN.ASM
; Microsoft (R) Macro Assembler Version 6.15.8803
; Copyright (C) Microsoft Corp 1981-2000.  All rights reserved.
;
;  Assembling: DOSWIN.ASM
;
; Microsoft (R) Segmented Executable Linker  Version 5.60.339 Dec  5 1994
; Copyright (C) Microsoft Corp 1984-1993.  All rights reserved.
;
; Object Modules [.obj]: DOSWIN.obj /t
; Run File [DOSWIN.com]: "DOSWIN.com"
; List File [nul.map]: NUL
; Libraries [.lib]:
; Definitions File [nul.def]:
; =======================================================================
