Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Page     1-1


				;
				page 80,132
				;
				title CP/DOS DosGetMessage mapper
				;
 0000				messages segment word public 'messages'
				
 0000  0D 0A 44 6F 73 47	OurMessage	db	0dh,0ah,"DosGetMessage returning ->",'$'
       65 74 4D 65 73 73	
       61 67 65 20 72 65	
       74 75 72 6E 69 6E	
       67 20 2D 3E 24		
				
 001D  00			ErrorMessageFlag	db	0
 001E  0000			MessageToGo	dw	0
 0020  0000			MessageLength	dw	0
 0022  00000000			NextVarPointer	dd	0
 0026  0000			VarsToGo	dw	0
				
 = 0000				MaxMessageNumber	=	0
				
				; This macro is used to define/declare all of the messages
				
				; We will have four macros, msg 	 -> defines a complete message
				;			    msgStart	 -> defines the first part of a message
				;			    msgContinue  ->   continues a started message
				;			    msgEnd	 ->	ends a message
				
 = 0000				MacroState = 0
				
				;----------------------------------------------
				
				MsgError	macro text		; message string error
				
					if1
					else
					%out 
					%out $ERROR - &text
					endif
				
				 $ERROR - &text
				
					endm
				
				;----------------------------------------------
				
				msg	macro	number,text
				
					if	MacroState NE 0
				 MsgError <Cannot use the 'Msg' Macro when inside a message definition.>
					mexit
					endif
				
				Message&Number	db	text
						db	0
				
					if	MaxMessageNumber lt &number
					  MaxMessageNumber	  =	  &Number
					endif
				
				MacroState = 0
				
					endm
				
				;----------------------------------------------
				
				msgStart	macro	number,text	 ; start of  a message string
				
					if	MacroState NE 0
				 MsgError <Cannot use the 'MsgStart' macro when inside a message definition.>
					mexit
					endif
				
				Message&Number	db	text
				
					if	MaxMessageNumber lt &number
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Page     1-2


					  MaxMessageNumber	  =	  &Number
					endif
				
				MacroState = 1
				
					endm
				
				;----------------------------------------------
				
				msgContinue	macro	text		 ; messgage string contination
				
					if	MacroState EQ 0
				 MsgError <Cannot use the 'MsgContinue' macro unless inside a message definition.>
					mexit
					endif
				
					db	text
				
				MacroState = 1
				
					endm
				
				;----------------------------------------------
				
				msgEnd	macro				; end of message string
				
					if	MacroState EQ 0
				 MsgError <Cannot use the 'MsgEnd' macro unless inside a message definition.>
					mexit
					endif
				
					db	0
				
				MacroState = 0
				
					endm
				
				
				;-----------------------------------------------
				
				; Define/declare the messages first!
				
					include messages.inc
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Page     1-3


			     C		page
			     C	
			     C	; Restore Messages 0
			     C	
 = 0000                      C	MSG0			    equ  0
 = 0663                      C	INSERT_SOURCE_DISK	    equ  1635	       ;925
 = 066A                      C	SOURCE_TARGET_SAME	    equ  1642	       ;932
 = 066B                      C	INVALID_NUM_PARM	    equ  1643	       ;933
 = 066C                      C	INVALID_DRIVE		    equ  1644	       ;934
 = 066D                      C	NO_FILE_TO_RESTORE	    equ  1645	       ;935
 = 066E                      C	INVALID_PARM		    equ  1646	       ;936
 = 0670                      C	LAST_FILE_NOT_RESTORED	    equ  1648	       ;938
 = 0671                      C	SOURCE_NO_BACKUP_FILE	    equ  1649	       ;939
 = 0008                      C	INSUFFICIENT_MEMORY	    equ  8	       ;8
 = 0673                      C	FILE_SEQUENCE_ERROR	    equ  1651	       ;941
 = 0674                      C	FILE_CREATION_ERROR	    equ  1652	       ;942
 = 0675                      C	TARGET_IS_FULL		    equ  1653	       ;943
 = 0677                      C	NOT_ABLE_TO_RESTORE_FILE    equ  1655	       ;945
 = 04BA                      C	INVALID_DOS_VER 	    equ  1210	       ;500
 = 066F                      C	FILE_SHARING_ERROR	    equ  1647	       ;937
 = 0666                      C	FILE_WAS_CHANGED	    equ  1638	       ;928
 = 0664                      C	DISK_OUT_OF_SEQUENCE	    equ  1636	       ;926
 = 0665                      C	FILE_IS_READONLY	    equ  1637	       ;927
 = 0667                      C	SYSTEM_FILE_RESTORED	    equ  1639	       ;929
 = 0668                      C	FILES_WERE_BACKUP_ON	    equ  1640	       ;930
 = 0662                      C	RESTORE_FILE_FROM_DRIVE     equ  1634	       ;924
 = 0679                      C	INSERT_TARGET_DISK	    equ  1657	       ;947
 = 0669                      C	FILE_TO_BE_RESTORED	    equ  1641	       ;931
 = 0678                      C	DISKETTE_NUM		    equ  1656	       ;946
 = 0686                      C	INVALID_PATH		    equ  1670	       ;960
			     C	
 0028  20 54 68 65 20 4D     C			db	' The Microsoft  MS DOS (R) Restore Utility'
       69 63 72 6F 73 6F     C	
       66 74 20 20 4D 53     C	
       20 44 4F 53 20 28     C	
       52 29 20 52 65 73     C	
       74 6F 72 65 20 55     C	
       74 69 6C 69 74 79     C	
 0052  20 56 65 72 73 69     C			db	' Version 4.00 Copyright 1988 Microsoft  '
       6F 6E 20 34 2E 30     C	
       30 20 43 6F 70 79     C	
       72 69 67 68 74 20     C	
       31 39 38 38 20 4D     C	
       69 63 72 6F 73 6F     C	
       66 74 20 20           C	
 007A  20 4C 69 63 65 6E     C			db	' Licensed Material - Property of Microsoft  '
       73 65 64 20 4D 61     C	
       74 65 72 69 61 6C     C	
       20 2D 20 50 72 6F     C	
       70 65 72 74 79 20     C	
       6F 66 20 4D 69 63     C	
       72 6F 73 6F 66 74     C	
       20 20                 C	
 00A6  20 41 75 74 68 6F     C			db	' Author - ** **** '
       72 20 2D 20 2A 2A     C	
       20 2A 2A 2A 2A 20     C	
			     C	
			     C	
			     C	 msg %MSG0,<"Y N A R I",0dh,0ah>
 00B8  59 20 4E 20 41 20     C1	Message0	db	"Y N A R I",0dh,0ah 
 00C3  00                    C1			db	0 
			     C	 Msg %SOURCE_TARGET_SAME,<0dh,0ah,"Source and target drives are the same",0dh,0ah>
 00C4  0D 0A 53 6F 75 72     C1	Message1642	db	0dh,0ah,"Source and target drives are the same",0dh,0ah 
 00ED  00                    C1			db	0 
			     C	 Msg %INVALID_NUM_PARM,<0dh,0ah,"Invalid number of parameters",0dh,0ah>
 00EE  0D 0A 49 6E 76 61     C1	Message1643	db	0dh,0ah,"Invalid number of parameters",0dh,0ah 
 010E  00                    C1			db	0 
			     C	 Msg %INVALID_PATH,<0dh,0ah,"Invalid path",0dh,0ah>
 010F  0D 0A 49 6E 76 61     C1	Message1670	db	0dh,0ah,"Invalid path",0dh,0ah 
 011F  00                    C1			db	0 
			     C	 Msg %INVALID_DRIVE,<0dh,0ah,"Invalid drive specification",0dh,0ah>
 0120  0D 0A 49 6E 76 61     C1	Message1644	db	0dh,0ah,"Invalid drive specification",0dh,0ah 
 013F  00                    C1			db	0 
			     C	 Msg %NO_FILE_TO_RESTORE,<0dh,0ah,"Warning! No files were found to restore",0dh,0ah>
 0140  0D 0A 57 61 72 6E     C1	Message1645	db	0dh,0ah,"Warning! No files were found to restore",0dh,0ah 
 016B  00                    C1			db	0 
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Page     1-4


			     C	 msg %INVALID_PARM,<0dh,0ah,"Invalid parameter %s",0dh,0ah>
 016C  0D 0A 49 6E 76 61     C1	Message1646	db	0dh,0ah,"Invalid parameter %s",0dh,0ah 
 0184  00                    C1			db	0 
			     C	 Msgstart %INSERT_SOURCE_DISK,<0dh,0ah,"Insert backup diskette %s in drive">
 0185  0D 0A 49 6E 73 65     C1	Message1635	db	0dh,0ah,"Insert backup diskette %s in drive" 
			     C	 MsgContinue		 <" %c:",0dh,0ah>
 01A9  20 25 63 3A 0D 0A     C1		db	" %c:",0dh,0ah 
			     C	 MsgContinue		 <"Strike any key when ready ",0dh,0ah>
 01AF  53 74 72 69 6B 65     C1		db	"Strike any key when ready ",0dh,0ah 
			     C	 MsgEnd
 01CB  00                    C1		db	0 
			     C	
			     C	 MsgStart %DISK_OUT_OF_SEQUENCE,<0dh,0ah,"Warning! Diskette is out of sequence",0dh,0ah>
 01CC  0D 0A 57 61 72 6E     C1	Message1636	db	0dh,0ah,"Warning! Diskette is out of sequence",0dh,0ah 
			     C	 MsgContinue			<"Replace diskette or continue if okay",0dh,0ah>
 01F4  52 65 70 6C 61 63     C1		db	"Replace diskette or continue if okay",0dh,0ah 
			     C	 MsgContinue			<"Strike any key when ready ",0dh,0ah>
 021A  53 74 72 69 6B 65     C1		db	"Strike any key when ready ",0dh,0ah 
			     C	 MsgEnd
 0236  00                    C1		db	0 
			     C	
			     C	 Msg %LAST_FILE_NOT_RESTORED,<0dh,0ah,"The last file was not restored",0dh,0ah>
 0237  0D 0A 54 68 65 20     C1	Message1648	db	0dh,0ah,"The last file was not restored",0dh,0ah 
 0259  00                    C1			db	0 
			     C	 Msg %FILES_WERE_BACKUP_ON,<0dh,0ah,"*** Files were backed up %s *** ",0dh,0ah>
 025A  0D 0A 2A 2A 2A 20     C1	Message1640	db	0dh,0ah,"*** Files were backed up %s *** ",0dh,0ah 
 027E  00                    C1			db	0 
			     C	 Msg %SOURCE_NO_BACKUP_FILE,<0dh,0ah,"Source does not contain backup files",0dh,0ah>
 027F  0D 0A 53 6F 75 72     C1	Message1649	db	0dh,0ah,"Source does not contain backup files",0dh,0ah 
 02A7  00                    C1			db	0 
			     C	 Msg %INSUFFICIENT_MEMORY,<0dh,0ah,"Insufficient memory",0dh,0ah>
 02A8  0D 0A 49 6E 73 75     C1	Message8	db	0dh,0ah,"Insufficient memory",0dh,0ah 
 02BF  00                    C1			db	0 
			     C	 MsgStart %FILE_IS_READONLY,<0dh,0ah,"Warning! File %s",0dh,0ah>
 02C0  0D 0A 57 61 72 6E     C1	Message1637	db	0dh,0ah,"Warning! File %s",0dh,0ah 
			     C	 MsgContinue		    <"is a read-only file",0dh,0ah>
 02D4  69 73 20 61 20 72     C1		db	"is a read-only file",0dh,0ah 
			     C	 MsgContinue		    <"Replace the file (Y/N)? ",0dh,0ah>
 02E9  52 65 70 6C 61 63     C1		db	"Replace the file (Y/N)? ",0dh,0ah 
			     C	 MsgEnd
 0303  00                    C1		db	0 
			     C	
			     C	 Msg %FILE_SEQUENCE_ERROR,<0dh,0ah,"Restore file sequence error",0dh,0ah>
 0304  0D 0A 52 65 73 74     C1	Message1651	db	0dh,0ah,"Restore file sequence error",0dh,0ah 
 0323  00                    C1			db	0 
			     C	 Msg %FILE_CREATION_ERROR,<0dh,0ah,"File creation error",0dh,0ah>
 0324  0D 0A 46 69 6C 65     C1	Message1652	db	0dh,0ah,"File creation error",0dh,0ah 
 033B  00                    C1			db	0 
			     C	 Msg %TARGET_IS_FULL,<0dh,0ah,"Target is full",0dh,0ah>
 033C  0D 0A 54 61 72 67     C1	Message1653	db	0dh,0ah,"Target is full",0dh,0ah 
 034E  00                    C1			db	0 
			     C	 Msg %NOT_ABLE_TO_RESTORE_FILE,<0dh,0ah,"*** Not able to restore file ***",0dh,0ah>
 034F  0D 0A 2A 2A 2A 20     C1	Message1655	db	0dh,0ah,"*** Not able to restore file ***",0dh,0ah 
 0373  00                    C1			db	0 
			     C	 MsgStart %INSERT_TARGET_DISK,<0dh,0ah,"Insert restore target in " >
 0374  0D 0A 49 6E 73 65     C1	Message1657	db	0dh,0ah,"Insert restore target in "  
			     C	 MsgContinue		 <"drive %s:",0dh,0ah>
 038F  64 72 69 76 65 20     C1		db	"drive %s:",0dh,0ah 
			     C	 MsgContinue		 <"Strike any key when ready ",0dh,0ah>
 039A  53 74 72 69 6B 65     C1		db	"Strike any key when ready ",0dh,0ah 
			     C	 MsgEnd
 03B6  00                    C1		db	0 
			     C	 msg %INVALID_DOS_VER,<0dh,0ah,"Incorrect DOS version",0dh,0ah>
 03B7  0D 0A 49 6E 63 6F     C1	Message1210	db	0dh,0ah,"Incorrect DOS version",0dh,0ah 
 03D0  00                    C1			db	0 
			     C	 msg %FILE_TO_BE_RESTORED,<0dh,0ah,"%s",0>
 03D1  0D 0A 25 73 00        C1	Message1641	db	0dh,0ah,"%s",0 
 03D6  00                    C1			db	0 
			     C	
			     C	 msg %RESTORE_FILE_FROM_DRIVE,<0dh,0ah,"*** Restoring files from drive %s: ***",0>
 03D7  0D 0A 2A 2A 2A 20     C1	Message1634	db	0dh,0ah,"*** Restoring files from drive %s: ***",0 
 0400  00                    C1			db	0 
			     C	
			     C	 Msg %FILE_SHARING_ERROR,<0dh,0ah,"Unrecoverable file sharing error",0dh,0ah>
 0401  0D 0A 55 6E 72 65     C1	Message1647	db	0dh,0ah,"Unrecoverable file sharing error",0dh,0ah 
 0425  00                    C1			db	0 
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Page     1-5


			     C	
			     C	 MsgStart %SYSTEM_FILE_RESTORED,<0dh,0ah,"System files restored",0dh,0ah>
 0426  0D 0A 53 79 73 74     C1	Message1639	db	0dh,0ah,"System files restored",0dh,0ah 
			     C	 MsgContinue			<"Target disk may not be bootable",0dh,0ah>
 043F  54 61 72 67 65 74     C1		db	"Target disk may not be bootable",0dh,0ah 
			     C	 MsgEnd
 0460  00                    C1		db	0 
			     C	
			     C	 MsgStart %FILE_WAS_CHANGED,<0dh,0ah,"Warning! File %s",0dh,0ah>
 0461  0D 0A 57 61 72 6E     C1	Message1638	db	0dh,0ah,"Warning! File %s",0dh,0ah 
			     C	 MsgContinue		    <"was changed after it was backed up",0dh,0ah>
 0475  77 61 73 20 63 68     C1		db	"was changed after it was backed up",0dh,0ah 
			     C	 MsgContinue		    <"Replace the file (Y/N)? ",0dh,0ah>
 0499  52 65 70 6C 61 63     C1		db	"Replace the file (Y/N)? ",0dh,0ah 
			     C	 MsgEnd
 04B3  00                    C1		db	0 
			     C	 msg %DISKETTE_NUM,<0dh,0ah,"Diskette: %s",0>
 04B4  0D 0A 44 69 73 6B     C1	Message1656	db	0dh,0ah,"Diskette: %s",0 
 04C3  00                    C1			db	0 
			     C	
				
 =-0002				NotFoundNumber	=	-2
				
 04C4				NotFoundMessage label	byte
						msg	NotFoundNumber,<'We could not find your message #'>
 04C4  57 65 20 63 6F 75     1	MessageNotFoundNumber	db	'We could not find your message #' 
 04E4  00                    1			db	0 
				
				; Now, for each defined message, generate an index
				
				msgidx	macro	number
					ifdef	Message&Number
					dw	&Number
					dw	offset messages:Message&Number
					endif
					endm
				
 04E5  00				even
				
 04E6				MessageIndex	label	word
				
 = 0000				ThisMessageNumber	=	0
					rept	MaxMessageNumber + 1
					msgidx	%ThisMessageNumber
				ThisMessageNumber	=	ThisMessageNumber + 1
					endm
 04E6  0000                  2		dw	0 
 04E8  00B8 R                2		dw	offset messages:Message0 
 04EA  0008                  2		dw	8 
 04EC  02A8 R                2		dw	offset messages:Message8 
 04EE  04BA                  2		dw	1210 
 04F0  03B7 R                2		dw	offset messages:Message1210 
 04F2  0662                  2		dw	1634 
 04F4  03D7 R                2		dw	offset messages:Message1634 
 04F6  0663                  2		dw	1635 
 04F8  0185 R                2		dw	offset messages:Message1635 
 04FA  0664                  2		dw	1636 
 04FC  01CC R                2		dw	offset messages:Message1636 
 04FE  0665                  2		dw	1637 
 0500  02C0 R                2		dw	offset messages:Message1637 
 0502  0666                  2		dw	1638 
 0504  0461 R                2		dw	offset messages:Message1638 
 0506  0667                  2		dw	1639 
 0508  0426 R                2		dw	offset messages:Message1639 
 050A  0668                  2		dw	1640 
 050C  025A R                2		dw	offset messages:Message1640 
 050E  0669                  2		dw	1641 
 0510  03D1 R                2		dw	offset messages:Message1641 
 0512  066A                  2		dw	1642 
 0514  00C4 R                2		dw	offset messages:Message1642 
 0516  066B                  2		dw	1643 
 0518  00EE R                2		dw	offset messages:Message1643 
 051A  066C                  2		dw	1644 
 051C  0120 R                2		dw	offset messages:Message1644 
 051E  066D                  2		dw	1645 
 0520  0140 R                2		dw	offset messages:Message1645 
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Page     1-6


 0522  066E                  2		dw	1646 
 0524  016C R                2		dw	offset messages:Message1646 
 0526  066F                  2		dw	1647 
 0528  0401 R                2		dw	offset messages:Message1647 
 052A  0670                  2		dw	1648 
 052C  0237 R                2		dw	offset messages:Message1648 
 052E  0671                  2		dw	1649 
 0530  027F R                2		dw	offset messages:Message1649 
 0532  0673                  2		dw	1651 
 0534  0304 R                2		dw	offset messages:Message1651 
 0536  0674                  2		dw	1652 
 0538  0324 R                2		dw	offset messages:Message1652 
 053A  0675                  2		dw	1653 
 053C  033C R                2		dw	offset messages:Message1653 
 053E  0677                  2		dw	1655 
 0540  034F R                2		dw	offset messages:Message1655 
 0542  0678                  2		dw	1656 
 0544  04B4 R                2		dw	offset messages:Message1656 
 0546  0679                  2		dw	1657 
 0548  0374 R                2		dw	offset messages:Message1657 
 054A  0686                  2		dw	1670 
 054C  010F R                2		dw	offset messages:Message1670 
				
 054E  FFFF				dw	-1
				
 0550  FFFE			NotFoundIndex	dw	-2
 0552  04C4 R					dw	offset messages:NotFoundMessage
				
 0554				messages ends
				;
 0000				dosxxx	segment byte public 'dos'
					assume	cs:dosxxx,ds:nothing,es:nothing,ss:nothing
				;
				;**********************************************************************
				;*
				;*   MODULE:   dosgetmessage
				;*
				;*   FILE NAME: dos029.asm
				;*
				;*   CALLING SEQUENCE:
				;*
				;*	 push@	   other   insert variable table
				;*	 push	   word    insert variable count
				;*	 push@	   other   message buffer address
				;*	 push	   word    buffer length
				;*	 push	   word    message number
				;*	 push@	   asciiz  message file name
				;*	 push@	   word    returned message length
				;*	 call	   dosgetmessage
				;*
				;*   MODULES CALLED:  None (preliminary version)
				;*
				;*********************************************************************
				;
					    public   dosgetmessage
					    .sall
					    .list
				
				str	    struc
 0000  0000			old_bp	    dw	     ?
 0002  00000000			return	    dd	     ?
 0006  00000000			ReturnLengthPtr  dd	 ?	; length of returned message
 000A  00000000			MessageFileName  dd	 ?	; message file name
 000E  0000			MessageNumber	 dw	 ?	; number of the message
 0010  0000			MessageBufferLen dw	 ?	; length of the message buffer
 0012  00000000			MessageBufferPtr dd	 ?	; buffer address to return message
 0016  0000			VariablesCount	 dw	 ?	; number of variables
 0018  00000000			VariableTablePtr dd	 ?	; table of variables to insert
 001C				str	    ends
				
				
 0000				dosgetmessage  proc	far
				
					Enter	Dosgetmessage		; push registers
 000C  B8 ---- R			mov	ax,messages		; setup message buffer
 000F  8E D8				mov	ds,ax
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Page     1-7


					assume	ds:messages
 0011  C6 06 001D R 00			mov	ErrorMessageFlag,0	; reset error message flag
				
 0016  8B 5E 0E				mov	bx,[bp].MessageNumber		 ; get message number
 0019  BE 04E6 R			mov	si,offset messages:MessageIndex
				
 001C				SearchForMessageLoop:			; search for message in table
 001C  AD				lodsw
 001D  3B C3				cmp	ax,bx			; found ??
 001F  74 10				je	FoundMessage		; jump if true
				
 0021  83 C6 02				add	si,2			; if not serach continues
 0024  3D FFFF				cmp	ax,-1
 0027  75 F3				jne	SearchForMessageLoop
				
 0029  BE 0552 R			mov	si,offset messages:NotFoundIndex + 2
 002C  C6 06 001D R 01			mov	ErrorMessageFlag,1
				
				; Here, ds:[si] -> word message number, followed by word message offset
				
 0031				FoundMessage:
 0031  8B 34				mov	si,ds:[si]
				
				; Here, ds:[si] -> message text bytes
				
 0033  C4 7E 18				les	di,[bp].VariableTablePtr	; get variable address
 0036  89 3E 0022 R			mov	word ptr NextVarPointer+0,di	; save it
 003A  8C 06 0024 R			mov	word ptr NextVarPointer+2,es
				
 003E  8B 7E 16				mov	di,[bp].VariablesCount		; get variable count
 0041  89 3E 0026 R			mov	VarsToGo,di			; save it
				
 0045  C4 7E 12				les	di,[bp].MessageBufferPtr	; get return message buffer
										;     address
 0048  8B 46 10				mov	ax,[bp].MessageBufferLen	; get return message buffer
 004B  A3 001E R			mov	MessageToGo,ax			;   length
				
 004E  3D 0000				cmp	ax,0				; length = 0 ??
 0051  75 03				jne	HaveLengthToCopy		; if not, jump
				
 0053  E9 011C R			jmp	GetMessageDone			; done
				
 0056				HaveLengthToCopy:
 0056  C7 06 0020 R 0000		mov	MessageLength,0 		; initialize counter
				
 005C				MoveCharsLoop:
 005C  AC				lodsb					; get  next character
 005D  3C 25				cmp	al,'%'                          ; is it a % sign
 005F  74 15				je	DoSubstitution			; if so, need substitution
				
 0061  3C 00				cmp	al,0				; end of string ??
 0063  75 03				jne	RealCharacter			; if not look for real chars
				
 0065  E9 011C R			jmp	GetMessageDone			; else, jump to update
										;    return message length
				
 0068				RealCharacter:					; look for real character
 0068  AA				stosb
 0069  FF 06 0020 R			inc	MessageLength			; update message length counter
 006D  FF 0E 001E R			dec	MessageToGo
 0071  75 E9				jnz	MoveCharsLoop			; branch if not all done
				
 0073  E9 011C R			jmp	GetMessageDone			; else alldone, branch
				
 0076				DoSubstitution: 				; do substitution
 0076  AC				lodsb					; get character
 0077  3C 25				cmp	al,'%'                          ; check for %%
 0079  74 ED				je	RealCharacter			; if so, get next character
				
				
				
				; skip the numbers that indicate field width!
				
 007B				SkipFieldWidth: 				; check for field width  digit
 007B  3C 30				cmp	al,'0'                          ; indicator digits
 007D  72 07				jc	CheckChar
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Page     1-8


				
 007F  3C 3A				cmp	al,'9'+1
 0081  73 03				jnc	CheckChar
										; if field width indicator
 0083  AC				lodsb					; jump to examine next	char
 0084  EB F5				jmp	SkipFieldWidth
				
				;-----------------------------------------
				
 0086				CheckChar:					; check for char substitution
 0086  3C 63				cmp	al,'c'                          ;   if true go do character
 0088  74 04				je	SubstituteChar			;      substitution
 008A  3C 43				cmp	al,'C'
 008C  75 16				jne	CheckDecimal
				
 008E				SubstituteChar: 				; do character subtitution
 008E  1E				push	ds
 008F  56				push	si
 0090  C5 36 0022 R			lds	si,NextVarPointer
 0094  C5 34				lds	si,ds:dword ptr [si]
				
					assume	ds:nothing
				
 0096  AC				lodsb
 0097  5E				pop	si
 0098  1F				pop	ds
				
					assume	ds:messages
				
 0099  83 06 0022 R 04			add	word ptr NextVarPointer,4
 009E  FF 0E 0026 R			dec	VarsToGo
				
 00A2  EB C4				jmp	RealCharacter
				
				;-----------------------------------------
				
 00A4				CheckDecimal:					; check for decimal subtitution
 00A4  3C 64				cmp	al,'d'                          ;   if true, do decimal
 00A6  74 04				je	SubstituteDecimal		;      substitution
 00A8  3C 44				cmp	al,'D'
 00AA  75 29				jne	CheckString
				
 00AC				SubstituteDecimal:				; do decimal subtitution
 00AC  1E				push	ds
 00AD  56				push	si
 00AE  C5 36 0022 R			lds	si,NextVarPointer
 00B2  C5 34				lds	si,ds:dword ptr [si]
				
					assume	ds:nothing
				
 00B4  AD				lodsw
 00B5  5E				pop	si
 00B6  1F				pop	ds
				
					assume	ds:messages
				
 00B7  83 06 0022 R 04			add	word ptr NextVarPointer,4
 00BC  FF 0E 0026 R			dec	VarsToGo
				
 00C0  BA 0000				mov	dx,0
 00C3  E8 01AB R			call	ConvDec
				
 00C6  01 06 0020 R			add	MessageLength,ax
 00CA  29 06 001E R			sub	MessageToGo,ax
 00CE  72 02				jc	PastEndOfBuffer
				
 00D0  EB 8A				jmp	MoveCharsLoop
				
 00D2				PastEndOfBuffer:
 00D2  EB 48 90				jmp	GetMessageDone
				
				;-----------------------------------------
				
 00D5				CheckString:
 00D5  3C 73				cmp	al,'s'                          ; check for string subtitution
 00D7  74 04				je	SubstituteString		;   if true, do string
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Page     1-9


 00D9  3C 53				cmp	al,'S'                          ;      substitution
 00DB  75 31				jne	CheckLong
				
 00DD				SubstituteString:				; do string substitution
 00DD  1E				push	ds
 00DE  56				push	si
 00DF  8B 0E 001E R			mov	cx,MessageToGo
 00E3  8B 16 0020 R			mov	dx,MessageLength
 00E7  C5 36 0022 R			lds	si,NextVarPointer
 00EB  C5 34				lds	si,ds:dword ptr [si]
					assume	ds:nothing
				
 00ED				ContinueStringSubstitution:
 00ED  AC				lodsb
 00EE  3C 00				cmp	al,0
 00F0  74 04				je	EndOfSubstituteString
				
 00F2  AA				stosb
 00F3  42				inc	dx
 00F4  E2 F7				loop	ContinueStringSubstitution
				
 00F6				EndOfSubstituteString:
 00F6  5E				pop	si
 00F7  1F				pop	ds
					assume	ds:messages
				
 00F8  83 06 0022 R 04			add	word ptr NextVarPointer,4
 00FD  FF 0E 0026 R			dec	VarsToGo
				
 0101  89 16 0020 R			mov	MessageLength,dx
 0105  89 0E 001E R			mov	MessageToGo,cx
 0109  E3 C7				jcxz	PastEndOfBuffer
				
 010B  E9 005C R			jmp	MoveCharsLoop
				
				;-----------------------------------------
				
 010E				CheckLong:					  ; need long substitution
 010E  3C 6C				cmp	al,'l'
 0110  74 04				je	SubstituteLong			  ; if true go do it
 0112  3C 4C				cmp	al,'L'
 0114  75 03				jne	Unknown 			  ; else unknown substitution
				
 0116				SubstituteLong:
 0116  E9 0068 R			jmp	RealCharacter			  ; just go back
				
				;-----------------------------------------
				
 0119				Unknown:
 0119  E9 0068 R			jmp	RealCharacter			  ; just go back
				
				
				
				
				; Update the return message length
				
 011C				GetMessageDone:
 011C  1E				push	ds
 011D  56				push	si
 011E  A1 0020 R			mov	ax,MessageLength
 0121  C5 76 06				lds	si,[bp].ReturnLengthPtr
					assume	ds:nothing
 0124  89 04				mov	ds:[si],ax
 0126  5E				pop	si
 0127  1F				pop	ds
					assume	ds:messages
				
 0128  80 3E 001D R 00			cmp	ErrorMessageFlag,0
 012D  74 29				je	NotErrorMessage
				
 012F  C6 06 001D R 00			mov	ErrorMessageFlag,0
				
 0134				KeepGoingBackwards:
 0134  26: 80 7D FF 00			cmp	es:byte ptr [di-1],0
 0139  75 03				jne	PutItHere
				
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Page     1-10


 013B  4F				dec	di
 013C  EB F6				jmp	KeepGoingBackwards
				
 013E				PutItHere:
 013E  8B 46 0E				mov	ax,[bp].MessageNumber
 0141  BA 0000				mov	dx,0
				
 0144  E8 01AB R			call	convdec
 0147  C5 76 06				lds	si,[bp].ReturnLengthPtr
					assume	ds:nothing
 014A  05 0003				add	ax,3			; for cr, lf, nul
 014D  01 04				add	ds:[si],ax
				
 014F  B0 0D				mov	al,0dh
 0151  AA				stosb
 0152  B0 0A				mov	al,0ah
 0154  AA				stosb
				
 0155  B0 00				mov	al,0
 0157  AA				stosb
				
 0158				NotErrorMessage:
 0158  EB 1C 90				jmp	SkipToHere
				
 015B  BA ---- R			mov	dx,seg messages
 015E  8E DA				mov	ds,dx
 0160  BA 0000 R			mov	dx,offset messages:OurMessage
				
 0163  B4 09				mov	ah,9			   ; load op code
 0165  CD 21				int	21h			   ; display message
				
 0167  C5 76 06				lds	si,[bp].ReturnLengthPtr
 016A  8B 0C				mov	cx,ds:[si]
 016C  C5 56 12				lds	dx,[bp].MessageBufferPtr
				
 016F  BB 0001				mov	bx,1
 0172  B4 40				mov	ah,40h
 0174  CD 21				int	21h			   ; display message
				
 0176				SkipToHere:
 0176  33 C0				xor	ax,ax			   ; set good return code
				
					mexit				   ; pop registers
 0184  CA 0016				ret	 size str - 6		   ; return
				
 0187				dosgetmessage  endp
				
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Page     1-11


					page
				
				;##################################################################
				
 0187  00989680			Tens	dd	10000000
 018B  000F4240				dd	1000000
 018F  000186A0				dd	100000
 0193  00002710				dd	10000
 0197  000003E8				dd	1000
 019B  00000064				dd	100
 019F  0000000A				dd	10
 01A3  00000001				dd	1
 01A7  00000000				dd	0
				
 01AB				convdec proc	near
				
				; input es:di -> location to put decimal characters at
				;	dx:ax -> 32bit value to be displayed
				
				; output es:di -> next location for output characters
				;	 ax = number of characters output
				
 01AB  55				push	bp
 01AC  83 EC 06				sub	sp,6
 01AF  8B EC				mov	bp,sp
				
 = word ptr [bp+0]		DecLength	equ	word ptr [bp+0]
 = word ptr [bp+2]		LowValue	equ	word ptr [bp+2]
 = word ptr [bp+4]		HighValue	equ	word ptr [bp+4]
				
 01B1  C7 46 00 0000			mov	DecLength,0
 01B6  89 56 04				mov	HighValue,dx
 01B9  89 46 02				mov	LowValue,ax
				
 01BC  BB 0187 R			mov	bx,offset dosxxx:Tens
				
				; Start with a count of zero.
				
 01BF				DigitLoop:
 01BF  BA 0000				mov	dx,0
				
				; Loop, counting the number of times you can subtract the current digit value
				
 01C2				CountLoop:
 01C2  2E: 8B 07			mov	ax,cs:[bx+0]
 01C5  29 46 02				sub	LowValue,ax
 01C8  2E: 8B 47 02			mov	ax,cs:[bx+2]
 01CC  19 46 04				sbb	HighValue,ax
 01CF  72 03				jc	TooFar
 01D1  42				inc	dx		; Subtraction did no go negative, inc digit
 01D2  EB EE				jmp	CountLoop
				
				; Since we know when this digit is done by the number going negative, we must
				;  fixup the damage.
				
 01D4				TooFar:
 01D4  2E: 8B 07			mov	ax,cs:[bx+0]
 01D7  01 46 02				add	LowValue,ax
 01DA  2E: 8B 47 02			mov	ax,cs:[bx+2]
 01DE  11 46 04				adc	HighValue,ax
				
				; We need to supress leading zeros, so check to see if this digit is non zero
				
 01E1  83 FA 00				cmp	dx,0
 01E4  75 06				jnz	DoDisplay
				
				; Digit is zero, check to see if we have put out any digits yet?
				
 01E6  83 7E 00 00			cmp	Declength,0
 01EA  74 08				jz	NextDigit
				
				; Either digit was non zero, or we have already output the leading non-zero.
				;  It really doesn't matter, display the digit
				
 01EC				DoDisplay:
 01EC  8A C2				mov	al,dl
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Page     1-12


 01EE  04 30				add	al,'0'
 01F0  AA				stosb
 01F1  FF 46 00				inc	DecLength
				
				; Set up for the next digit, and determine if we are done
				
 01F4				NextDigit:
 01F4  83 C3 04				add	bx,4
 01F7  2E: 83 3F 00			cmp	cs:word ptr [bx+0],0
 01FB  75 C2				jnz	DigitLoop
 01FD  2E: 83 7F 02 00			cmp	cs:word ptr [bx+2],0
 0202  75 BB				jnz	DigitLoop
				
				; Check to see that we at least put out a single 0 character
				
 0204  83 7E 00 00			cmp	DecLength,0
 0208  75 06				jne	Done
				
				; We didn't, so let's put the zero there
				
 020A  B0 30				mov	al,'0'
 020C  AA				stosb
 020D  FF 46 00				inc	DecLength
				
				; The decimal display is complete.  Get the return value and return
				
 0210				Done:
 0210  8B 46 00				mov	ax,DecLength
				
 0213  8B E5				mov	sp,bp
 0215  83 C4 06				add	sp,6
 0218  5D				pop	bp
				
 0219  C3				ret
				
 021A				convdec endp
				
 021A				dosxxx	    ends
				
					    end

Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Symbols-1


Macros:

		N a m e			Lines

ENTER  . . . . . . . . . . . . .  	   3
MEXIT  . . . . . . . . . . . . .  	   3
MSG  . . . . . . . . . . . . . .  	  10
MSGCONTINUE  . . . . . . . . . .  	   6
MSGEND . . . . . . . . . . . . .  	   6
MSGERROR . . . . . . . . . . . .  	   6
MSGIDX . . . . . . . . . . . . .  	   4
MSGSTART . . . . . . . . . . . .  	   9
POPAL  . . . . . . . . . . . . .  	   9
PUSHAL . . . . . . . . . . . . .  	   9

Structures and Records:

                N a m e                 Width   # fields
                                        Shift   Width   Mask    Initial

STR  . . . . . . . . . . . . . .  	001C	0009
  OLD_BP . . . . . . . . . . . .  	0000
  RETURN . . . . . . . . . . . .  	0002
  RETURNLENGTHPTR  . . . . . . .  	0006
  MESSAGEFILENAME  . . . . . . .  	000A
  MESSAGENUMBER  . . . . . . . .  	000E
  MESSAGEBUFFERLEN . . . . . . .  	0010
  MESSAGEBUFFERPTR . . . . . . .  	0012
  VARIABLESCOUNT . . . . . . . .  	0016
  VARIABLETABLEPTR . . . . . . .  	0018

Segments and Groups:

                N a m e         	Length	 Align	Combine Class

DOSXXX . . . . . . . . . . . . .  	021A	BYTE	PUBLIC	'DOS'
MESSAGES . . . . . . . . . . . .  	0554	WORD	PUBLIC	'MESSAGES'

Symbols:            

                N a m e         	Type	 Value	 Attr

CHECKCHAR  . . . . . . . . . . .  	L NEAR	0086	DOSXXX
CHECKDECIMAL . . . . . . . . . .  	L NEAR	00A4	DOSXXX
CHECKLONG  . . . . . . . . . . .  	L NEAR	010E	DOSXXX
CHECKSTRING  . . . . . . . . . .  	L NEAR	00D5	DOSXXX
CONTINUESTRINGSUBSTITUTION . . .  	L NEAR	00ED	DOSXXX
CONVDEC  . . . . . . . . . . . .  	N PROC	01AB	DOSXXX	Length = 006F
COUNTLOOP  . . . . . . . . . . .  	L NEAR	01C2	DOSXXX

DECLENGTH  . . . . . . . . . . .  	TEXT  word ptr [bp+0]		
DIGITLOOP  . . . . . . . . . . .  	L NEAR	01BF	DOSXXX
DISKETTE_NUM . . . . . . . . . .  	NUMBER	0678	
DISK_OUT_OF_SEQUENCE . . . . . .  	NUMBER	0664	
DODISPLAY  . . . . . . . . . . .  	L NEAR	01EC	DOSXXX
DONE . . . . . . . . . . . . . .  	L NEAR	0210	DOSXXX
dosgetmessage  . . . . . . . . .  	F PROC	0000	DOSXXX	Global	Length = 0187
DOSUBSTITUTION . . . . . . . . .  	L NEAR	0076	DOSXXX

ENDOFSUBSTITUTESTRING  . . . . .  	L NEAR	00F6	DOSXXX
ERRORMESSAGEFLAG . . . . . . . .  	L BYTE	001D	MESSAGES

FILES_WERE_BACKUP_ON . . . . . .  	NUMBER	0668	
FILE_CREATION_ERROR  . . . . . .  	NUMBER	0674	
FILE_IS_READONLY . . . . . . . .  	NUMBER	0665	
FILE_SEQUENCE_ERROR  . . . . . .  	NUMBER	0673	
FILE_SHARING_ERROR . . . . . . .  	NUMBER	066F	
FILE_TO_BE_RESTORED  . . . . . .  	NUMBER	0669	
FILE_WAS_CHANGED . . . . . . . .  	NUMBER	0666	
FOUNDMESSAGE . . . . . . . . . .  	L NEAR	0031	DOSXXX

GETMESSAGEDONE . . . . . . . . .  	L NEAR	011C	DOSXXX

HAVELENGTHTOCOPY . . . . . . . .  	L NEAR	0056	DOSXXX
HIGHVALUE  . . . . . . . . . . .  	TEXT  word ptr [bp+4]		

Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Symbols-2


INSERT_SOURCE_DISK . . . . . . .  	NUMBER	0663	
INSERT_TARGET_DISK . . . . . . .  	NUMBER	0679	
INSUFFICIENT_MEMORY  . . . . . .  	NUMBER	0008	
INVALID_DOS_VER  . . . . . . . .  	NUMBER	04BA	
INVALID_DRIVE  . . . . . . . . .  	NUMBER	066C	
INVALID_NUM_PARM . . . . . . . .  	NUMBER	066B	
INVALID_PARM . . . . . . . . . .  	NUMBER	066E	
INVALID_PATH . . . . . . . . . .  	NUMBER	0686	

KEEPGOINGBACKWARDS . . . . . . .  	L NEAR	0134	DOSXXX

LAST_FILE_NOT_RESTORED . . . . .  	NUMBER	0670	
LOWVALUE . . . . . . . . . . . .  	TEXT  word ptr [bp+2]		

MACROSTATE . . . . . . . . . . .  	NUMBER	0000	
MAXMESSAGENUMBER . . . . . . . .  	NUMBER	0686	
MESSAGE0 . . . . . . . . . . . .  	L BYTE	00B8	MESSAGES
MESSAGE1210  . . . . . . . . . .  	L BYTE	03B7	MESSAGES
MESSAGE1634  . . . . . . . . . .  	L BYTE	03D7	MESSAGES
MESSAGE1635  . . . . . . . . . .  	L BYTE	0185	MESSAGES
MESSAGE1636  . . . . . . . . . .  	L BYTE	01CC	MESSAGES
MESSAGE1637  . . . . . . . . . .  	L BYTE	02C0	MESSAGES
MESSAGE1638  . . . . . . . . . .  	L BYTE	0461	MESSAGES
MESSAGE1639  . . . . . . . . . .  	L BYTE	0426	MESSAGES
MESSAGE1640  . . . . . . . . . .  	L BYTE	025A	MESSAGES
MESSAGE1641  . . . . . . . . . .  	L BYTE	03D1	MESSAGES
MESSAGE1642  . . . . . . . . . .  	L BYTE	00C4	MESSAGES
MESSAGE1643  . . . . . . . . . .  	L BYTE	00EE	MESSAGES
MESSAGE1644  . . . . . . . . . .  	L BYTE	0120	MESSAGES
MESSAGE1645  . . . . . . . . . .  	L BYTE	0140	MESSAGES
MESSAGE1646  . . . . . . . . . .  	L BYTE	016C	MESSAGES
MESSAGE1647  . . . . . . . . . .  	L BYTE	0401	MESSAGES
MESSAGE1648  . . . . . . . . . .  	L BYTE	0237	MESSAGES
MESSAGE1649  . . . . . . . . . .  	L BYTE	027F	MESSAGES
MESSAGE1651  . . . . . . . . . .  	L BYTE	0304	MESSAGES
MESSAGE1652  . . . . . . . . . .  	L BYTE	0324	MESSAGES
MESSAGE1653  . . . . . . . . . .  	L BYTE	033C	MESSAGES
MESSAGE1655  . . . . . . . . . .  	L BYTE	034F	MESSAGES
MESSAGE1656  . . . . . . . . . .  	L BYTE	04B4	MESSAGES
MESSAGE1657  . . . . . . . . . .  	L BYTE	0374	MESSAGES
MESSAGE1670  . . . . . . . . . .  	L BYTE	010F	MESSAGES
MESSAGE8 . . . . . . . . . . . .  	L BYTE	02A8	MESSAGES
MESSAGEINDEX . . . . . . . . . .  	L WORD	04E6	MESSAGES
MESSAGELENGTH  . . . . . . . . .  	L WORD	0020	MESSAGES
MESSAGENOTFOUNDNUMBER  . . . . .  	L BYTE	04C4	MESSAGES
MESSAGETOGO  . . . . . . . . . .  	L WORD	001E	MESSAGES
MOVECHARSLOOP  . . . . . . . . .  	L NEAR	005C	DOSXXX
MSG0 . . . . . . . . . . . . . .  	NUMBER	0000	

NEXTDIGIT  . . . . . . . . . . .  	L NEAR	01F4	DOSXXX
NEXTVARPOINTER . . . . . . . . .  	L DWORD	0022	MESSAGES
NOTERRORMESSAGE  . . . . . . . .  	L NEAR	0158	DOSXXX
NOTFOUNDINDEX  . . . . . . . . .  	L WORD	0550	MESSAGES
NOTFOUNDMESSAGE  . . . . . . . .  	L BYTE	04C4	MESSAGES
NOTFOUNDNUMBER . . . . . . . . .  	NUMBER	-0002	
NOT_ABLE_TO_RESTORE_FILE . . . .  	NUMBER	0677	
NO_FILE_TO_RESTORE . . . . . . .  	NUMBER	066D	

OURMESSAGE . . . . . . . . . . .  	L BYTE	0000	MESSAGES

PASTENDOFBUFFER  . . . . . . . .  	L NEAR	00D2	DOSXXX
PUTITHERE  . . . . . . . . . . .  	L NEAR	013E	DOSXXX

REALCHARACTER  . . . . . . . . .  	L NEAR	0068	DOSXXX
RESTORE_FILE_FROM_DRIVE  . . . .  	NUMBER	0662	

SEARCHFORMESSAGELOOP . . . . . .  	L NEAR	001C	DOSXXX
SKIPFIELDWIDTH . . . . . . . . .  	L NEAR	007B	DOSXXX
SKIPTOHERE . . . . . . . . . . .  	L NEAR	0176	DOSXXX
SOURCE_NO_BACKUP_FILE  . . . . .  	NUMBER	0671	
SOURCE_TARGET_SAME . . . . . . .  	NUMBER	066A	
SUBSTITUTECHAR . . . . . . . . .  	L NEAR	008E	DOSXXX
SUBSTITUTEDECIMAL  . . . . . . .  	L NEAR	00AC	DOSXXX
SUBSTITUTELONG . . . . . . . . .  	L NEAR	0116	DOSXXX
SUBSTITUTESTRING . . . . . . . .  	L NEAR	00DD	DOSXXX
SYSTEM_FILE_RESTORED . . . . . .  	NUMBER	0667	
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS DosGetMessage mapper                                 Symbols-3



TARGET_IS_FULL . . . . . . . . .  	NUMBER	0675	
TENS . . . . . . . . . . . . . .  	L DWORD	0187	DOSXXX
THISMESSAGENUMBER  . . . . . . .  	NUMBER	0687	
TOOFAR . . . . . . . . . . . . .  	L NEAR	01D4	DOSXXX

UNKNOWN  . . . . . . . . . . . .  	L NEAR	0119	DOSXXX

VARSTOGO . . . . . . . . . . . .  	L WORD	0026	MESSAGES

@CPU . . . . . . . . . . . . . .  	TEXT  0101h		
@FILENAME  . . . . . . . . . . .  	TEXT  getmsg		
@VERSION . . . . . . . . . . . .  	TEXT  510		


    720 Source  Lines
  11136 Total   Lines
    130 Symbols

  47214 + 274252 Bytes symbol space free

      0 Warning Errors
      0 Severe  Errors
