summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/KEYB/KEYBCPSD.ASM
blob: 2cae9fe030ff697bb3233fe31e0ce9f9234935c4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
	PAGE	,132
	TITLE	DOS - KEYB Command  -  Copy Shared_Data_Area

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DOS - NLS Support - KEYB Command
;; (C) Copyright 1988 Microsoft
;;
;; File Name:  KEYBCPSD.ASM
;; ----------
;;
;; Description:
;; ------------
;;	 Copies the SHARED_DATA_AREA into a part of memory that
;;	 can be left resident. All relative pointers must already
;;	 be recalculated to this new position.
;;	 THIS FILE MUST BE THE LAST OF THE RESIDENT FILES WHEN KEYB IS LINKED.
;;
;; Documentation Reference:
;; ------------------------
;;	 PC DOS 3.3 Detailed Design Document - May ?? 1986
;;
;; Procedures Contained in This File:
;; ----------------------------------
;;
;; Include Files Required:
;; -----------------------
;;	INCLUDE KEYBSHAR.INC
;;	INCLUDE KEYBCMD.INC
;;	INCLUDE KEYBTBBL.INC
;;
;; External Procedure References:
;; ------------------------------
;;	 FROM FILE  ????????.ASM:
;;	      procedure - description????????????????????????????????
;;
;; Linkage Information:  Refer to file KEYB.ASM
;; --------------------
;;
;; Change History:
;; ---------------
;; PTMP3955 ;AN004;KEYB component to free environment and close handles 0 - 4
;; 3/24/88
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
				       ;;
	PUBLIC	SD_DEST_PTR	       ;;
	PUBLIC	COPY_SD_AREA	       ;;
	PUBLIC	SHARED_DATA	       ;;
				       ;;
	INCLUDE STRUC.INC
	INCLUDE KEYBSHAR.INC	       ;;
	INCLUDE KEYBCMD.INC	       ;;
	INCLUDE KEYBTBBL.INC	       ;;
				       ;;
CODE	SEGMENT PUBLIC 'CODE'          ;;
				       ;;
	ASSUME	CS:CODE,DS:CODE        ;;
				       ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Module: COPY_SD_AREA
;;
;; Description:
;;
;; Input Registers:
;;
;; Output Registers:
;;     N/A
;;
;; Logic:
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
				       ;;
SD		EQU   SHARED_DATA      ;;
TSD		EQU  TEMP_SHARED_DATA  ;;
				       ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
					       ;;
COPY_SD_AREA	PROC   NEAR		       ;;
					       ;;
	REP	MOVS ES:BYTE PTR [DI],DS:[SI]  ;; Copy SHARED_DATA_AREA to

		  push	  ax			  ;AN004;save existing values
		  push	  es			  ;AN004;;
		  xor	  ax,ax 		  ;AN004;clear out ax
		  mov	  ax,cs:[2ch]		  ;AN004;check offset for address containin environ.
		  cmp	  ax,0			  ;AN004;
		  je	  NO_FREEDOM		  ;AN004;
		  mov	  es,ax 		  ;AN004;
		  mov	  ax,4900H		  ;AN004;make the free allocate mem func
		  int	  21h			  ;AN004;;


NO_FREEDOM:
		  pop	  es			  ;AN004;restore existing values
		  pop	  ax			  ;AN004;;

		  push	  ax			  ;AN004;
		  push	  bx			  ;AN004;

						  ;AN004;     ;Terminate and stay resident
	     mov     bx,4			  ;AN004;     ;1st close file handles
	 .REPEAT				  ;AN004;     ;STDIN,STDOUT,STDERR
	     mov  ah,3eh			  ;AN004;     ;
	     int  21h				  ;AN004;     ;
	     dec  bx				  ;AN004;     ;
	.UNTIL <BX eq 0>			  ;AN004;     ;

		 pop	 bx			  ;AN004;
		 pop	 ax			  ;AN004;
						  ;AN004;	 new part of memory
	MOV	BYTE PTR ES:SD.TABLE_OK,1	  ;; Activate processing flag
	INT	21H				  ;; Exit
					       ;;
					       ;;
COPY_SD_AREA	ENDP			       ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
				       ;;
 db 'SHARED DATA'                      ;;
SD_DEST_PTR	LABEL	BYTE	       ;;
				       ;;
SHARED_DATA   SHARED_DATA_STR <>       ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CODE   ENDS
       END