Microsoft (R) Macro Assembler Version 6.11		    04/16/01 15:27:19
survey.asm						     Page 1 - 1


				;	This is a demonstration program that surveys people who might
				;	come to an exibition or a conference.
				;	It is only a demonstration program for the iomacros and serves
				;	no bigger purpose.

				;	Written by Jim Wolfe		for COSC 300

						.model		small
						.386
						.stack		100h
						.nolist
						.list
 0000						.data
 0000 00			age		db			?			; Respondent's age
 0001 00			sex		db			?			; Respondent's sex (M or F)
 0002  0015 [			pname	db			21 dup(?)	; Respondent's first name
        00
       ]
 0017  0015 [			sname	db			21 dup(?)	; Respondent's last name
        00
       ]
 002C 0000			miles	dw			?			; Number of miles respondent traveled
 002E 00000000			profit	dd			?			; Profit of respondent's company
						
						; Following are the survey prompts

 0032 0D 0A 57 68 61 74		p1		db			13,10,"What is your age? ", 0
       20 69 73 20 79 6F
       75 72 20 61 67 65
       3F 20 00
 0047 0D 0A 57 68 61 74		p2		db			13,10,"What is your sex (M/F)? ", 0
       20 69 73 20 79 6F
       75 72 20 73 65 78
       20 28 4D 2F 46 29
       3F 20 00
 0062 0D 0A 57 68 61 74		p3		db			13,10,"What is your first name? ", 0
       20 69 73 20 79 6F
       75 72 20 66 69 72
       73 74 20 6E 61 6D
       65 3F 20 00
 007E 0D 0A 57 68 61 74		p31		db			13,10,"What is your last name? ",0
       20 69 73 20 79 6F
       75 72 20 6C 61 73
       74 20 6E 61 6D 65
       3F 20 00
 0099 0D 0A 48 6F 77 20		p4		db			13,10,"How many miles did you travel to get here? ", 0
       6D 61 6E 79 20 6D
       69 6C 65 73 20 64
       69 64 20 79 6F 75
       20 74 72 61 76 65
       6C 20 74 6F 20 67
       65 74 20 68 65 72
       65 3F 20 00
 00C7 0D 0A 57 68 61 74		p5		db			13,10,"What is your company net profit? ",0
       20 69 73 20 79 6F
       75 72 20 63 6F 6D
       70 61 6E 79 20 6E
       65 74 20 70 72 6F
       66 69 74 3F 20 00

 00EB 20 63 6F 6D 70 61		last	db			" company.",13,10,0		; Ending string for display
       6E 79 2E 0D 0A 00
 0000						.code
						extern		writelong:proc, writestring:proc, writeint:proc
						extern		readlong:proc, readstring:proc, readint:proc 
						extern		writeint_signed:proc, waitchar:proc, readkey:proc
						extern		crlf:proc
 0000				main	proc
 0000  B8 ---- R				mov			ax, @data
 0003  8E D8					mov			ds, ax
 0005  BA 0005					mov			dx, 5			; Set loop limit
 0008				top:
						cout		s, p1			; Ask for age and read it
 0008  52		     1				push	dx
 0009  BA 0032 R	     1						mov		dx, offset p1
 000C  E8 0000 E	     1						call	writestring
 000F  5A		     1			pop			dx
						nin			age
 00F7			     1			.data
 00F7 00000000		     1	??0001		dd			?
 0010			     1			.code
 0010  66| 50		     1			push		eax
 0012  E8 0000 E	     1			call		Readlong
 0015  66| A3 00F7 R	     1			mov			??0001, eax
 0019  A0 00F7 R	     1					mov		al, byte ptr ??0001
 001C  A2 0000 R	     1					mov		age, al
 001F  66| 58		     1					pop		eax
 0021  80 3E 0000 R 00				cmp			age, 0			; If age is negative, terminate
 0026  0F 8E 01A5				jle			finish
						cout		s, p2			; Ask for person's sex and read it
 002A  52		     1				push	dx
 002B  BA 0047 R	     1						mov		dx, offset p2
 002E  E8 0000 E	     1						call	writestring
 0031  5A		     1			pop			dx
						cin			c, sex
 0032  50		     1				push	ax
 0033  B4 01		     1				mov		ah, 1
 0035  CD 21		     1				int		21h
 0037  A2 0001 R	     1				mov		sex, al
 003A  58		     1				pop		ax
 003B  80 26 0001 R DF				and			sex, 0DFh		; Force uppercase
 0040				again:
						cout		s, p3			; Ask for first name and read it
 0040  52		     1				push	dx
 0041  BA 0062 R	     1						mov		dx, offset p3
 0044  E8 0000 E	     1						call	writestring
 0047  5A		     1			pop			dx
						cin			s, pname, 20
 0048  51		     1					push	cx
 0049  52		     1					push	dx
 004A  50		     1					push	ax
 004B  B9 0014		     1					mov		cx, 20
 004E  BA 0002 R	     1					mov		dx, offset pname
 0051  E8 0000 E	     1					call	readstring
 0054  58		     1					pop		ax
 0055  5A		     1					pop		dx
 0056  59		     1					pop		cx
 0057  80 3E 0002 R 00				cmp			pname, 0		; Try again, if accidental Enter
 005C  74 E2					je			again
						cout		s, p31			; Ask for last name and read it
 005E  52		     1				push	dx
 005F  BA 007E R	     1						mov		dx, offset p31
 0062  E8 0000 E	     1						call	writestring
 0065  5A		     1			pop			dx
						cin			s, sname, 20
 0066  51		     1					push	cx
 0067  52		     1					push	dx
 0068  50		     1					push	ax
 0069  B9 0014		     1					mov		cx, 20
 006C  BA 0017 R	     1					mov		dx, offset sname
 006F  E8 0000 E	     1					call	readstring
 0072  58		     1					pop		ax
 0073  5A		     1					pop		dx
 0074  59		     1					pop		cx
						cout		s, p4			; Ask how far traveled and read it
 0075  52		     1				push	dx
 0076  BA 0099 R	     1						mov		dx, offset p4
 0079  E8 0000 E	     1						call	writestring
 007C  5A		     1			pop			dx
						nin			miles
 00FB			     1			.data
 00FB 00000000		     1	??0006		dd			?
 007D			     1			.code
 007D  66| 50		     1			push		eax
 007F  E8 0000 E	     1			call		Readlong
 0082  66| A3 00FB R	     1			mov			??0006, eax
 0086  A1 00FB R	     1					mov		ax, word ptr ??0006
 0089  A3 002C R	     1					mov		miles, ax
 008C  66| 58		     1					pop		eax
						cout		s, p5			; Ask for profit and read it
 008E  52		     1				push	dx
 008F  BA 00C7 R	     1						mov		dx, offset p5
 0092  E8 0000 E	     1						call	writestring
 0095  5A		     1			pop			dx
						nin			profit
 00FF			     1			.data
 00FF 00000000		     1	??0008		dd			?
 0096			     1			.code
 0096  66| 50		     1			push		eax
 0098  E8 0000 E	     1			call		Readlong
 009B  66| A3 00FF R	     1			mov			??0008, eax
 009F  66| A3 002E R	     1					mov		profit, eax
 00A3  66| 58		     1				pop		eax
 00A5  E8 0000 E				call		crlf			; Make blank lines
 00A8  E8 0000 E				call		crlf
 00AB				results:
						cout		s, sname		; Display all info in sentence form
 00AB  52		     1				push	dx
 00AC  BA 0017 R	     1						mov		dx, offset sname
 00AF  E8 0000 E	     1						call	writestring
 00B2  5A		     1			pop			dx
						cout		l, <!, >		; as:  LASTNAME, FIRSTNAME (SEX) is AGE
 0103			     1				.data
 0103 2C 20 00		     1	??000A		db		", ",0
 00B3			     1				.code
 00B3  52		     1				push	dx
 00B4  BA 0103 R	     1				mov		dx, offset ??000A
 00B7  E8 0000 E	     1				call	writestring
 00BA  5A		     1			pop			dx
						cout		s, pname		;          traveled MILES miles, and is 
 00BB  52		     1				push	dx
 00BC  BA 0002 R	     1						mov		dx, offset pname
 00BF  E8 0000 E	     1						call	writestring
 00C2  5A		     1			pop			dx
						cout		l, < !(>		;		    with a $PROFIT company.
 0106			     1				.data
 0106 20 28 00		     1	??000C		db		" (",0
 00C3			     1				.code
 00C3  52		     1				push	dx
 00C4  BA 0106 R	     1				mov		dx, offset ??000C
 00C7  E8 0000 E	     1				call	writestring
 00CA  5A		     1			pop			dx
						cout		c, sex
 00CB  52		     1				push	dx
 00CC  50		     1					push	ax
 00CD  B4 02		     1					mov		ah, 2
 00CF  8A 16 0001 R	     1					mov		dl, sex
 00D3  CD 21		     1					int		21h
 00D5  58		     1					pop		ax
 00D6  5A		     1			pop			dx
						cout		l, <!)  is >
 0109			     1				.data
 0109 29 20 20 69 73 20	     1	??000E		db		")  is ",0
       00
 00D7			     1				.code
 00D7  52		     1				push	dx
 00D8  BA 0109 R	     1				mov		dx, offset ??000E
 00DB  E8 0000 E	     1				call	writestring
 00DE  5A		     1			pop			dx
						nout		age
 0110			     1			.data
 0110 00		     1	??000F	db		?
 0111 00000000		     1	??0010	dd		?
 00DF			     1			.code
 00DF  66| 50		     1			push		eax
 00E1  53		     1			push		bx
 00E2  C6 06 0110 R 20	     1			mov			??000F, ' '
 00E7  80 3E 0000 R 00	     1			cmp			age, 0
 00EC  7D 09		     1			jge			??0011
 00EE  C6 06 0110 R 2D	     1			mov			??000F, '-'
 00F3  F6 1E 0000 R	     1			neg			age
 00F7			     1	??0011:
 00F7  A0 0000 R	     1					mov		al, age
 00FA  66| 0F BE C0	     1				movsx	eax, al
 00FE  66| A3 0111 R	     1			mov			??0010, eax
 0102  52		     1			push		dx
 0103  B4 02		     1			mov			ah, 2
 0105  8A 16 0110 R	     1			mov			dl, ??000F
 0109  CD 21		     1			int			21h
 010B  5A		     1			pop			dx
 010C  BB 000A		     1			mov			bx, 10
 010F  66| A1 0111 R	     1			mov			eax, ??0010
 0113  E8 0000 E	     1			call		writelong
 0116  80 3E 0110 R 2D	     1			cmp			??000F, '-'
 011B  75 04		     1			jne			??0012
 011D  F6 1E 0000 R	     1			neg			age
 0121			     1	??0012:
 0121  5B		     1			pop			bx
 0122  66| 58		     1			pop			eax
 0124  E8 0000 E				call		crlf
						cout		l, <     traveled >
 0115			     1				.data
 0115 20 20 20 20 20 74	     1	??0013		db		"     traveled ",0
       72 61 76 65 6C 65
       64 20 00
 0127			     1				.code
 0127  52		     1				push	dx
 0128  BA 0115 R	     1				mov		dx, offset ??0013
 012B  E8 0000 E	     1				call	writestring
 012E  5A		     1			pop			dx
						nout		miles
 0124			     1			.data
 0124 00		     1	??0014	db		?
 0125 00000000		     1	??0015	dd		?
 012F			     1			.code
 012F  66| 50		     1			push		eax
 0131  53		     1			push		bx
 0132  C6 06 0124 R 20	     1			mov			??0014, ' '
 0137  83 3E 002C R 00	     1			cmp			miles, 0
 013C  7D 09		     1			jge			??0016
 013E  C6 06 0124 R 2D	     1			mov			??0014, '-'
 0143  F7 1E 002C R	     1			neg			miles
 0147			     1	??0016:
 0147  A1 002C R	     1					mov		ax, miles
 014A  66| 0F BF C0	     1				movsx	eax, ax
 014E  66| A3 0125 R	     1			mov			??0015, eax
 0152  52		     1			push		dx
 0153  B4 02		     1			mov			ah, 2
 0155  8A 16 0124 R	     1			mov			dl, ??0014
 0159  CD 21		     1			int			21h
 015B  5A		     1			pop			dx
 015C  BB 000A		     1			mov			bx, 10
 015F  66| A1 0125 R	     1			mov			eax, ??0015
 0163  E8 0000 E	     1			call		writelong
 0166  80 3E 0124 R 2D	     1			cmp			??0014, '-'
 016B  75 04		     1			jne			??0017
 016D  F7 1E 002C R	     1			neg			miles
 0171			     1	??0017:
 0171  5B		     1			pop			bx
 0172  66| 58		     1			pop			eax
						cout		l, < miles!, and is with a $>
 0129			     1				.data
 0129 20 6D 69 6C 65 73	     1	??0018		db		" miles, and is with a $",0
       2C 20 61 6E 64 20
       69 73 20 77 69 74
       68 20 61 20 24 00
 0174			     1				.code
 0174  52		     1				push	dx
 0175  BA 0129 R	     1				mov		dx, offset ??0018
 0178  E8 0000 E	     1				call	writestring
 017B  5A		     1			pop			dx
						nout		profit
 0141			     1			.data
 0141 00		     1	??0019	db		?
 0142 00000000		     1	??001A	dd		?
 017C			     1			.code
 017C  66| 50		     1			push		eax
 017E  53		     1			push		bx
 017F  C6 06 0141 R 20	     1			mov			??0019, ' '
 0184  66| 83 3E 002E R	     1			cmp			profit, 0
       00
 018A  7D 0A		     1			jge			??001B
 018C  C6 06 0141 R 2D	     1			mov			??0019, '-'
 0191  66| F7 1E 002E R	     1			neg			profit
 0196			     1	??001B:
 0196  66| A1 002E R	     1					mov		eax, profit
 019A  66| A3 0142 R	     1			mov			??001A, eax
 019E  52		     1			push		dx
 019F  B4 02		     1			mov			ah, 2
 01A1  8A 16 0141 R	     1			mov			dl, ??0019
 01A5  CD 21		     1			int			21h
 01A7  5A		     1			pop			dx
 01A8  BB 000A		     1			mov			bx, 10
 01AB  66| A1 0142 R	     1			mov			eax, ??001A
 01AF  E8 0000 E	     1			call		writelong
 01B2  80 3E 0141 R 2D	     1			cmp			??0019, '-'
 01B7  75 05		     1			jne			??001C
 01B9  66| F7 1E 002E R	     1			neg			profit
 01BE			     1	??001C:
 01BE  5B		     1			pop			bx
 01BF  66| 58		     1			pop			eax
						cout		s, last
 01C1  52		     1				push	dx
 01C2  BA 00EB R	     1						mov		dx, offset last
 01C5  E8 0000 E	     1						call	writestring
 01C8  5A		     1			pop			dx
 01C9  4A					dec			dx
 01CA  74 03					je			finish			; Stop if counted down to 0
 01CC  E9 FE39					jmp			top
 01CF				finish:
 01CF  B8 4C00					mov			ax, 4c00h
 01D2  CD 21					int			21h
 01D4				main	endp

				end		main

Microsoft (R) Macro Assembler Version 6.11		    04/16/01 15:27:19
survey.asm						     Symbols 2 - 1




Macros:

                N a m e                 Type

cin  . . . . . . . . . . . . . .	Proc
cout . . . . . . . . . . . . . .	Proc
nin  . . . . . . . . . . . . . .	Proc
nout . . . . . . . . . . . . . .	Proc


Segments and Groups:

                N a m e                 Size     Length   Align   Combine Class

DGROUP . . . . . . . . . . . . .	GROUP
_DATA  . . . . . . . . . . . . .	16 Bit	 0146	  Word	  Public  'DATA'	
STACK  . . . . . . . . . . . . .	16 Bit	 0100	  Para	  Stack	  'STACK'	 
_TEXT  . . . . . . . . . . . . .	16 Bit	 01D4	  Word	  Public  'CODE'	


Procedures,  parameters and locals:

                N a m e                 Type     Value    Attr

main . . . . . . . . . . . . . .	P Near	 0000	  _TEXT	Length= 01D4 Public
  top  . . . . . . . . . . . . .	L Near	 0008	  _TEXT	
  again  . . . . . . . . . . . .	L Near	 0040	  _TEXT	
  results  . . . . . . . . . . .	L Near	 00AB	  _TEXT	
  ??0011 . . . . . . . . . . . .	L Near	 00F7	  _TEXT	
  ??0012 . . . . . . . . . . . .	L Near	 0121	  _TEXT	
  ??0016 . . . . . . . . . . . .	L Near	 0147	  _TEXT	
  ??0017 . . . . . . . . . . . .	L Near	 0171	  _TEXT	
  ??001B . . . . . . . . . . . .	L Near	 0196	  _TEXT	
  ??001C . . . . . . . . . . . .	L Near	 01BE	  _TEXT	
  finish . . . . . . . . . . . .	L Near	 01CF	  _TEXT	


Symbols:

                N a m e                 Type     Value    Attr

??0001 . . . . . . . . . . . . .	DWord	 00F7	  _DATA	
??0006 . . . . . . . . . . . . .	DWord	 00FB	  _DATA	
??0008 . . . . . . . . . . . . .	DWord	 00FF	  _DATA	
??000A . . . . . . . . . . . . .	Byte	 0103	  _DATA	
??000C . . . . . . . . . . . . .	Byte	 0106	  _DATA	
??000E . . . . . . . . . . . . .	Byte	 0109	  _DATA	
??000F . . . . . . . . . . . . .	Byte	 0110	  _DATA	
??0010 . . . . . . . . . . . . .	DWord	 0111	  _DATA	
??0013 . . . . . . . . . . . . .	Byte	 0115	  _DATA	
??0014 . . . . . . . . . . . . .	Byte	 0124	  _DATA	
??0015 . . . . . . . . . . . . .	DWord	 0125	  _DATA	
??0018 . . . . . . . . . . . . .	Byte	 0129	  _DATA	
??0019 . . . . . . . . . . . . .	Byte	 0141	  _DATA	
??001A . . . . . . . . . . . . .	DWord	 0142	  _DATA	
@CodeSize  . . . . . . . . . . .	Number	 0000h	 
@DataSize  . . . . . . . . . . .	Number	 0000h	 
@Interface . . . . . . . . . . .	Number	 0000h	 
@Model . . . . . . . . . . . . .	Number	 0002h	 
@code  . . . . . . . . . . . . .	Text   	 _TEXT
@data  . . . . . . . . . . . . .	Text   	 DGROUP
@fardata?  . . . . . . . . . . .	Text   	 FAR_BSS
@fardata . . . . . . . . . . . .	Text   	 FAR_DATA
@stack . . . . . . . . . . . . .	Text   	 DGROUP
age  . . . . . . . . . . . . . .	Byte	 0000	  _DATA	
crlf . . . . . . . . . . . . . .	L Near	 0000	  _TEXT	External
last . . . . . . . . . . . . . .	Byte	 00EB	  _DATA	
miles  . . . . . . . . . . . . .	Word	 002C	  _DATA	
p1 . . . . . . . . . . . . . . .	Byte	 0032	  _DATA	
p2 . . . . . . . . . . . . . . .	Byte	 0047	  _DATA	
p31  . . . . . . . . . . . . . .	Byte	 007E	  _DATA	
p3 . . . . . . . . . . . . . . .	Byte	 0062	  _DATA	
p4 . . . . . . . . . . . . . . .	Byte	 0099	  _DATA	
p5 . . . . . . . . . . . . . . .	Byte	 00C7	  _DATA	
pname  . . . . . . . . . . . . .	Byte	 0002	  _DATA	
profit . . . . . . . . . . . . .	DWord	 002E	  _DATA	
readint  . . . . . . . . . . . .	L Near	 0000	  _TEXT	External
readkey  . . . . . . . . . . . .	L Near	 0000	  _TEXT	External
readlong . . . . . . . . . . . .	L Near	 0000	  _TEXT	External
readstring . . . . . . . . . . .	L Near	 0000	  _TEXT	External
sex  . . . . . . . . . . . . . .	Byte	 0001	  _DATA	
sname  . . . . . . . . . . . . .	Byte	 0017	  _DATA	
waitchar . . . . . . . . . . . .	L Near	 0000	  _TEXT	External
writeint_signed  . . . . . . . .	L Near	 0000	  _TEXT	External
writeint . . . . . . . . . . . .	L Near	 0000	  _TEXT	External
writelong  . . . . . . . . . . .	L Near	 0000	  _TEXT	External
writestring  . . . . . . . . . .	L Near	 0000	  _TEXT	External

	   0 Warnings
	   0 Errors
