;  A 16-bit DOS HelloWorld program originally by RedOx.  Produces a small model .EXE executable.

; To assemble and link from within WinAsm Studio, you must have a special 16-bit linker, 
; such as the one in the archive at this URL- http://win32assembly.online.fr/files/Lnk563.exe
; Run the archive to unpack Link.exe, rename the Link.exe file to Link16.exe and copy it
; into the \masm32\bin folder.

.MODEL	small
.stack	100h

.data 
x	dw	0
y	dw	?
a	dw	4

.code
start:
		mov		ax,@data		; Get the address of the data segment
		mov		ds,ax			; Set the DS segment
     
		mov		AH,0
		mov		AL,10h
		int		10h
		fild	a
		mov		CX,400
line:	push 	CX
		fild	x
		fsqrt
		fmul	ST,ST(1)
		fistp   y
		mov		AH,0Ch
		mov 	AL,4
		mov		BH,0
		mov   	cx,x
		mov		DX,100
		sub		DX,y
		int		10h
		inc		x
		pop		CX
		loop 	line
		mov		ah,0
		int		16h
		mov		AH,0
		mov		AL,3h
		int		10h
	
		mov		ax, 4C00h		; the exit fuction  [4C+no error (00)]
		int		21h				; call DOS interrupt 21h
		end 	start