3 ;=========================================================================
4 ; This module contains all the EQU's, STRUC's, data, and routines necessary
6 ; This module is to be INCLUDE'd as part of LIMDMS.INC.
8 ;=========================================================================
10 ;=========================================================================
11 ;========== Begin EQUate Definitions =====================================
12 ;=========================================================================
14 AAJ_Option_Max equ 1h ;max option value ;an000; dms;
15 AAJ_Segment equ 1h ;segment request value ;an000; dms;
16 AAJ_No_Pages_To_Map equ 0h ;0 page map request ;an000; dms;
18 MAC_Stack_Status_Request equ 02h ;stack size request ;an000; dms;
20 ER_Conv_Memory equ 00h ;conv. memory request ;an000; dms;
21 ER_EMS_Memory equ 01h ;EMS memory request ;an000; dms;
22 EMS_Page_Size_In_Bytes equ (16*1024)-1 ;page size in bytes ;an000; dms;
23 ER_Max_Type equ 01h ;max type possible ;an000; dms;
24 ER_Max_Function equ 01h ;max function possible ;an000; dms;
25 ER_Move equ 00h ;move data ;an000; dms;
26 ER_Exchange equ 01h ;exchange data ;an000; dms;
27 ER_EMS_Page_FE equ 0FEh ;phys. page FEh ;an000; dms;
28 ER_EMS_Page_FF equ 0FFh ;phys. page FFh ;an000; dms;
29 ER_Dest_EMS_Memory equ 01h ;bit 0 set ;an000; dms;
30 ER_Source_EMS_Memory equ 02h ;bit 1 set ;an000; dms;
31 ER_Up equ 00h ;signal forward move ;an000; dms;
32 ER_Down equ 0ffh ;signal reverse move
33 ER_10H equ 10h ;equ for 10h ;an000; dms;
35 AR_Sub_Max equ 01h ;5ah max. sub functions ;an000; dms;
37 ;=========================================================================
38 ;========== End EQUate Definitions =======================================
39 ;=========================================================================
42 ;=========================================================================
43 ;========== Begin STRUC Definitions ======================================
44 ;=========================================================================
46 Log_Phys_Map_Struc struc ;page structure ;an000; dms;
48 Log_Page_Number dw ? ;logical page number ;an000; dms;
49 Phys_Page_Number_Seg dw ? ;physical page or seg ;an000; dms;
51 Log_Phys_Map_Struc ends
54 Map_And_Jump_Struc struc ;carries jump info. ;an000; dms;
56 Target_Address dd ? ;jump address ;an000; dms;
57 Log_Phys_Map_Len db ? ;entry count in ;an000; dms;
59 Log_Phys_Map_Ptr dd ? ;Log_Phys_Map_Struct ptr;an000; dms;
61 Map_And_Jump_Struc ends ;an000; dms;
64 Map_And_Call_Struc struc ;carries jump info. ;an000; dms;
66 MAC_Target_Address dd ? ;jump address ;an000; dms;
67 MAC_New_Page_Map_Len db ? ;entry count in ;an000; dms;
70 MAC_New_Page_Map_Ptr dd ? ;Log_Phys_Map_Struc ptr ;an000; dms;
72 MAC_Old_Page_Map_Len db ? ;entry count in ;an000; dms;
75 MAC_Old_Page_Map_Ptr dd ? ;Log_Phys_Map_Struc ptr ;an000; dms;
77 MAC_Reserved dw 4 DUP (?) ;Used to restore map ;an000; dms;
80 Map_And_Call_Struc ends ;an000; dms;
83 Move_Source_Dest_Struc struc ;structure for move ;an000; dms;
85 Region_Length_Low_Word dw ? ;
86 Region_Length_High_Word dw ? ;length of region ;an000; dms;
88 Source_Memory_Type db ? ;conv/EMS ;an000; dms;
89 Source_Handle dw ? ;handle if EMS, else 0 ;an000; dms;
90 Source_Initial_Offset dw ? ;offset of source region;an000; dms;
91 Source_Initial_Seg_Page dw ? ;logical page if EMS ;an000; dms;
93 Dest_Memory_Type db ? ;conv/EMS ;an000; dms;
94 Dest_Handle dw ? ;handle if EMS, else 0 ;an000; dms;
95 Dest_Initial_Offset dw ? ;offset of source region;an000; dms;
96 Dest_Initial_Seg_Page dw ? ;logical page if EMS ;an000; dms;
98 Move_Source_Dest_Struc ends ;end structure ;an000; dms;
100 Realloc_Struc Struc ;BP addressible struc ;an000; dms;
102 Realloc_Reserved db size Instance_Entry_Struc dup (?) ;an000; dms;
103 Realloc_Alloc_Byte db ? ;reserved ;an000; dms;
104 Realloc_Reg_DI dw ? ;reserved ;an000; dms;
105 Realloc_Handle dw ? ;handle ;an000; dms;
107 Realloc_Page_Count dw ? ;new page count ;an000; dms;
108 Realloc_Page_Alloc dw ? ;pages to be allocated ;an000; dms;
109 Realloc_Page_Dealloc dw ? ;pages to be deallocated ;an000; dms;
111 Realloc_Handle_Xref_Index dw ? ;index to end of handle table ;an000; dms;
112 Realloc_LookUp_Index dw ? ;index to applicable handle ;an000; dms;
113 Realloc_Mult dw ? ;multiplier ;an000; dms;
115 Realloc_Struc Ends ;end structure ;an000; dms;
117 AAJ_Struc Struc ;BP addressible struc ;an000; dms;
119 AAJ_Reserved db size Instance_Entry_Struc dup (?) ;an000; dms;
120 AAJ_Xref_Pages dw ? ;save logical page count ;an000; dms;
121 AAJ_Handle dw ? ;saved handle ;an000; dms;
122 AAJ_Option db ? ;saved selector state ;an000; dms;
123 AAJ_LookUp_Index dw ? ;save index ;an000; dms;
124 AAJ_Mult dw ? ;multiplier ;an000; dms;
126 AAJ_Struc Ends ;end structure ;an000; dms;
128 MAC_Struc Struc ;BP addressible struc ;an000; dms;
130 MAC_Reserved_Area db size Instance_Entry_Struc dup (?) ;an000; dms;
131 MAC_LookUp_Index dw ? ;save index ;an000; dms;
132 MAC_Xref_Pages dw ? ;save logical page count ;an000; dms;
133 MAC_Option db ? ;saved selector state ;an000; dms;
135 EMS_Reg_ES dw ? ;ES reg ;an000; dms;
136 EMS_Reg_DS dw ? ;DS reg ;an000; dms;
137 EMS_Reg_FL dw ? ;FL reg ;an000; dms;
138 EMS_Reg_SI dw ? ;SI reg ;an000; dms;
139 EMS_Reg_DI dw ? ;DI reg ;an000; dms;
140 EMS_Reg_DX dw ? ;DX reg ;an000; dms;
141 EMS_Reg_CX dw ? ;CX reg ;an000; dms;
142 EMS_Reg_BX dw ? ;BX reg ;an000; dms;
144 MAC_M_C_Data db size Map_And_Call_Struc dup (?) ;an000; dms;
145 MAC_M_C_Log db size Log_Phys_Map_Struc*Map_Count_Def dup (?) ;an000; dms;
146 MAC_Map_Table db size Mappable_Phys_Page_Struct*Map_Count_Def dup (?) ;an000; dms;
147 MAC_Mult dw ? ;multiplier ;an000; dms;
149 MAC_Struc Ends ;end structure ;an000; dms;
152 ER_Struc Struc ;BP addressible struc ;an000; dms;
154 ER_Reserved db size Instance_Entry_Struc dup (?) ;an000; dms;
155 ER_Direction_Flag db ER_Up ;default to forward move;an000; dms;
157 ER_Sub_Function db ? ;save subfunction byte ;an000; dms;
159 ER_Src_Abs_Beg_Low dw ? ;abs add of src EMS page;an000; dms;
160 ER_Src_Abs_Beg_High dw ? ; beginning of trf area;an000; dms;
161 ER_Src_Abs_End_Low dw ? ;abs add of src EMS page;an000; dms;
162 ER_Src_Abs_End_High dw ? ; end of trf area ;an000; dms;
164 ER_Dst_Abs_Beg_Low dw ? ;abs add of src EMS page;an000; dms;
165 ER_Dst_Abs_Beg_High dw ? ; beginning of trf area;an000; dms;
166 ER_Dst_Abs_End_Low dw ? ;abs add of src EMS page;an000; dms;
167 ER_Dst_Abs_End_High dw ? ; end of trf area ;an000; dms;
169 ER_Current_Move_Count dw ? ;bytes moved this time ;an000; dms;
171 ER_Move_Xchg_Buffer1 db 10h dup (?) ;buffer for move/xchg ;an000; dms;
172 ER_Move_Xchg_Buffer2 db 10h dup (?) ;buffer for move/xchg ;an000; dms;
174 ER_Move_Count_Low dw ? ;low word of count ;an000; dms;
175 ER_Move_Count_High dw ? ;high word of count ;an000; dms;
177 ER_Source_Phys_Page dw ? ;page number of source ;an000; dms;
178 ER_Dest_Phys_Page dw ? ;page number of dest ;an000; dms;
180 ER_Source_Page dw ? ;active source page ;an000; dms;
181 ER_Dest_Page dw ? ;active dest page ;an000; dms;
183 ER_Source_Handle dw ? ;active handle ;an000; dms;
184 ER_Dest_Handle dw ? ;active handle ;an000; dms;
187 ER_Save_Context_Buffer dw 2*Type Mappable_Phys_Page_Struct dup (0) ;room for 2 pgs;an000; dms;
189 ER_Dest_Seg dw ? ;seg value of dest ;an000; dms;
190 ER_Source_Seg dw ? ;seg value of source ;an000; dms;
192 ER_Dest_Off dw ? ;off value of dest ;an000; dms;
193 ER_Source_Off dw ? ;off value of source ;an000; dms;
195 ER_Mem_Type dw ? ;memory type ;an000; dms;
198 ER_Struc Ends ;end structure ;an000; dms;
200 ;=========================================================================
201 ;========== End STRUC Definitions ========================================
202 ;=========================================================================
205 ;=========================================================================
206 ;========== Begin Macro Definitions ======================================
207 ;=========================================================================
210 ;=========================================================================
211 ; MAC_Expand_Stack_And_Copy : This routine will place data in the
212 ; instance table by copying the data pointed
215 ; Inputs : AX - Size of stack adjustment
216 ; ES:DI - Pointer to data to be copied to stack
218 ; Outputs : BP - data place in instance table
220 ;=========================================================================
222 MAC_Expand_Stack_And_Copy proc
224 mov cx,ax ;get adjustment factor ;an000; dms;
225 shr cx,1 ;convert to word move ;an000; dms;
226 mov ax,es ;get data source seg ;an000; dms;
227 mov ds,ax ;place in ds ;an000; dms;
228 mov si,di ;get data source off ;an000; dms;
230 mov ax,cs ;get dest. seg ;an000; dms;
231 mov es,ax ;place in es ;an000; dms;
232 mov di,bx ;get dest. off ;an000; dms;
234 cli ;ints off ;an000; dms;
235 rep movsw ;move data to stack ;an000; dms;
236 sti ;ints on ;an000; dms;
238 ret ;end routine ;an000; dms;
240 MAC_Expand_Stack_And_Copy endp
243 ;=========================================================================
244 ; MAC_Shrink_Stack_And_Copy : This routine move data from the instance
245 ; table and place it at ES:DI.
247 ; Inputs : AX - Size of stack adjustment
248 ; ES:DI - Pointer to where data is to be copied
250 ; Outputs : BP - data removed from instance table
252 ;=========================================================================
254 MAC_Shrink_Stack_And_Copy proc
256 mov cx,ax ;get adjustment factor ;an000; dms;
257 mov ax,cs ;get data source seg ;an000; dms;
258 mov ds,ax ;place in ds ;an000; dms;
259 mov si,bx ;get data source off ;an000; dms;
260 mov ax,cx ;save count across move ;an000; dms;
261 shr cx,1 ;convert to word move ;an000; dms;
263 cli ;ints off ;an000; dms;
264 rep movsw ;move data from stack ;an000; dms;
265 sti ;ints on ;an000; dms;
267 ret ;end routine ;an000; dms;
269 MAC_Shrink_Stack_And_Copy endp
272 ;=========================================================================
273 ;========== End Macro Definitions ========================================
274 ;=========================================================================
277 ;=========================================================================
278 ;========== Begin Generic PROC Definitions ===============================
279 ;=========================================================================
281 ;=========================================================================
282 ; Map_Pages : This routine will map the pages being
283 ; requested in the struc pointed to by
286 ; Inputs : ES:DI - Pointer to data in Log_Phys_Map_Struc format
287 ; CX - Count of data iterations in ES:DI
289 ; BX - page count for handle
292 ; Outputs : Revised map
295 ;=========================================================================
297 Map_Pages proc ; ;an000; dms;
299 push si ;save reg ;an000; dms;
301 mov si,ax ;save option ;an000; dms;
302 cmp cx,AAJ_No_Pages_To_Map ;no pages? ;an000; dms;
303 je Map_Error_Exit ;yes - exit loop ;an000; dms;
307 cmp [di].Log_Page_Number,bx ;logical page out of ;an000; dms;
309 jbe Map_Get_Segment ;no - in range ;an000; dms;
310 mov ah,EMS_Code8A ;yes - out of range ;an000; dms;
311 jmp Map_Error_Exit ;exit routine ;an000; dms;
315 cmp si,AAJ_Segment ;segment request? ;an000; dms;
316 mov ax,[di].Phys_Page_Number_Seg ;get physical page ;an000; dms;
317 jne Map_Page_Request ;no - page request ;an000; dms;
319 mov dx,[di].Phys_Page_Number_Seg ;get segment ;an000; dms;
320 call Get_Phys_Seg_Page ;get the associated ;an000; dms;
321 ; page for the segment
322 mov ax,dx ;place page in ax ;an000; dms;
323 pop dx ;restore handle
324 jnc Map_Page_Request ;no error - continue ;an000; dms;
325 mov ah,EMS_Code8B ;phys page not found ;an000; dms;
326 jmp Map_Error_Exit ;exit routine ;an000; dms;
330 push bx ;save bx across call ;an000; dms;
331 mov bx,[di].Log_Page_Number ;logical page to map ;an000; dms;
332 call Map_L_To_P ;map the page ;an000; dms;
333 pop bx ;restore bx ;an000; dms;
334 or ah,ah ;error? ;an000; dms;
335 jnz Map_Error_Exit ;pass error on & exit ;an000; dms;
336 add di,Type Log_Phys_Map_Struc ;adjust pointer ;an000; dms;
337 loop Map_Loop_Continue ;continue loop ;an000; dms;
338 xor ax,ax ;signal good finish ;an000; dms;
342 pop si ;restore reg ;an000; dms;
344 ret ;return to caller ;an000; dms;
346 Map_Pages endp ;end proc ;an000; dms;
350 ;=========================================================================
351 ; Get_Phys_Seg_Page : This routine will obtain the physical page
352 ; number for a given segment.
354 ; Inputs : DX - Segment value
355 ; Outputs : DX - Physical page number
358 ;=========================================================================
360 Get_Phys_Seg_Page proc ;begin routine ;an000; dms;
362 push ax ;save regs ;an000; dms;
363 push cx ; ;an000; dms;
364 push di ; ;an000; dms;
366 cli ;ints off ;an000; dms;
367 mov di,offset Map_Table ;point to table map ;an000; dms;
368 mov cx,Map_Count ;number of table entries;an000; dms;
369 sti ;ints on ;an000; dms;
373 cli ;ints off ;an000; dms;
374 cmp dx,cs:[di].Phys_Page_Segment ;segment match? ;an000; dms;
375 je GPSP_Got_Segment ;yes ;an000; dms;
376 add di,Type Mappable_Phys_Page_Struct ;adjust pointer ;an000; dms;
377 loop GPSP_Loop ;continue search ;an000; dms;
381 sti ;ints on ;an000; dms;
382 cmp cx,0 ;data found? ;an000; dms;
383 je GPSP_Not_Found ;exit with error ;an000; dms;
384 mov dx,cs:[di].Phys_Page_Number ;exit with page number ;an000; dms;
385 clc ;clear cy ;an000; dms;
386 jmp GPSP_Found ;exit ;an000; dms;
390 stc ;signal error ;an000; dms;
392 GPSP_Found: ;exit ;an000; dms;
394 pop di ;restore regs ;an000; dms;
395 pop cx ; ;an000; dms;
396 pop ax ; ;an000; dms;
398 ret ;return to caller ;an000; dms;
400 Get_Phys_Seg_Page endp ;end proc ;an000; dms;
403 ;=========================================================================
404 ;========== End Generic PROC Definitions =================================
405 ;=========================================================================
411 ;-------------------------------------------------------------------
412 ; Reallocate Pages - Function 18
415 ; BX = count of new allocation pages
419 ; BX = new page count
420 ; if error - original page count
421 ;-------------------------------------------------------------------
424 push cx ;save affected regs ;an000; dms;
425 push dx ; ;an000; dms;
426 push di ; ;an000; dms;
427 push si ; ;an000; dms;
429 push ds ;save segments ;an000; dms;
430 push es ; ;an000; dms;
432 mov ax,cs ;get code segment ;an000; dms;
433 mov ds,ax ;put int ds and ;an000; dms;
434 mov es,ax ; es ;an000; dms;
437 mov cs:[bp].Realloc_Page_Count,bx ;new page count ;an000; dms;
438 mov cs:[bp].Realloc_Handle,dx ;handle ;an000; dms;
442 mov ax,cs:[bp].Realloc_Handle ;get handle for search ;an000; dms;
443 mov cs:[bp].Realloc_Mult,Type H_LookUp_Struc;handle lookup table ;an000; dms;
444 mul cs:[bp].Realloc_Mult ;obtain index position ;an000; dms;
445 mov cs:[bp].Realloc_LookUp_Index,ax ;index to handle ;an000; dms;
446 mov di,ax ;place index in si ;an000; dms;
447 mov dx,cs:[bp].Realloc_Handle ;get handle number ;an000; dms;
450 cmp dx,Num_Handles-1 ;dx > handle count? ;an000; dms;
451 jbe Realloc_Handle_Search ;handle within range ;an000; dms;
452 mov ah,EMS_Code83 ;EMS handle non-existent;an000; dms;
453 jmp Realloc_Error_Exit ;exit program ;an000; dms;
455 Realloc_Handle_Search:
457 cmp Handle_LookUp_Table.H_Pages[di],Reusable_Handle ;handle allocated ;an000; dms;
458 jne Realloc_Status_Of_Handle ;handle good ;an000; dms;
459 mov ah,EMS_Code83 ;EMS handle not alloc ;an000; dms;
460 jmp Realloc_Error_Exit ;exit program ;an000; dms;
462 Realloc_Status_Of_Handle:
465 mov ax,Handle_LookUp_Table.H_Pages[di] ;get current page count ;an000; dms;
466 sub ax,cs:[bp].Realloc_Page_Count ;more or less pages? ;an000; dms;
467 jc Realloc_More_Pages ;more pages to alloc ;an000; dms;
471 mov bx,ax ;pages to deallocate ;an000; dms;
472 mov cs:[bp].Realloc_Page_Dealloc,ax ;save dealloc value ;an000; dms;
474 mov si,Handle_LookUp_Table.H_Pal_Ptr[di] ;get start of links ;an000; dms;
475 mov cx,Handle_LookUp_Table.H_Pages[di] ;current pages allocated;an000; dms;
476 sub cx,bx ;pages to remain alloc ;an000; dms;
479 Realloc_Dealloc_Loop1:
481 cmp cx,0 ;pages? ;an000; dms;
482 je Realloc_Dealloc_Loop1_Exit ;no - exit ;an000; dms;
484 mov si,Page_Alloc_List[si] ;get next pointer ;an000; dms;
485 dec cx ;dec loop count ;an000; dms;
486 jmp Realloc_Dealloc_Loop1 ;continue ;an000; dms;
488 Realloc_Dealloc_Loop1_Exit:
490 ;***** Adjust pointers *****
492 mov cx,cs:[bp].Realloc_Page_Dealloc ;get dealloc count ;an000; dms;
493 mov ax,cs:PAL_Free_Ptr ;get the free ptr ;an001; dms;
494 cmp cx,0 ;0 pages to dealloc? ;an001; dms;
495 je Realloc_Dealloc_Loop2_Exit1 ;yes - bypass dealloc ;an001; dms;
496 mov cs:PAL_Free_Ptr,si ;no - set new free ptr ;an001; dms;
497 dec cx ;don't loop past last pg;an001; dms;
499 Realloc_Dealloc_Loop2:
501 cmp cx,0 ;end of deallocate? ;an000; dms;
502 je Realloc_Dealloc_Loop2_Exit ;yes - exit ;an000; dms;
503 shl si,1 ;get index entry ;an001; dms;
504 mov si,Page_Alloc_List[si] ;get next ptr ;an001; dms;
505 dec cx ;decrement counter ;an000; dms;
506 jmp Realloc_Dealloc_Loop2
508 Realloc_Dealloc_Loop2_Exit:
510 shl si,1 ;get index entry ;an001; dms;
511 mov Page_Alloc_List[si],ax ;pt. last page to orig. ;an001; dms;
514 Realloc_Dealloc_Loop2_Exit1:
516 mov ax,cs:[bp].Realloc_Page_Count ;new page count ;an000; dms;
517 mov Handle_LookUp_Table.H_Pages[di],ax ; ;an000; dms;
519 mov ax,cs:[bp].Realloc_Page_Dealloc ;adj. value ;an000; dms;
520 add cs:Free_Pages,ax ;free up page ;an000; dms;
522 mov bx,cs:[bp].Realloc_Page_Count ;pass back page request ;an000; dms;
523 xor ah,ah ;clear error ;an000; dms;
524 jmp Realloc_Exit ;exit ;an000; dms;
528 mov cx,cs:[bp].Realloc_Page_Count ;get page request count ;an000; dms;
529 mov di,cs:[bp].Realloc_LookUp_Index ;get LookUp Table ptr ;an000; dms;
530 mov ax,Handle_LookUp_Table.H_Pages[di] ;get current page count ;an000; dms;
531 sub cx,ax ;get additional pages ;an000; dms;
532 mov cs:[bp].Realloc_Page_Alloc,cx ;new pages to alloc ;an000; dms;
533 cmp cx,Free_Pages ;> pages remaining? ;an000; dms;
534 jbe Realloc_Pages ;reallocate pages ;an000; dms;
535 mov ah,EMS_Code87 ;Too few pages avail ;an000; dms;
536 jmp Realloc_Error_Exit ;exit prog ;an000; dms;
540 mov cx,Handle_LookUp_Table.H_Pages[di] ;current pages allocated;an000; dms;
541 cmp cx,0 ;any pages? ;an000; dms;
542 jne Realloc_More_Pages_Cont ;yes ;an000; dms;
543 cmp cs:[bp].Realloc_Page_Alloc,0 ;any pages requested? ;an000; dms;
544 je Realloc_Alloc_Loop1_Exit ;continue ;an000; dms;
546 mov cx,cs:[bp].Realloc_Page_Alloc ;get new page count ;an001; dms;
547 cli ;ints off ;an001; dms;
548 call EMS_Page_Contig_Chk ;contig pages avail? ;an001; dms;
549 jnc Realloc_New_Pages
550 mov ah,EMS_Code87 ;Too few pages avail ;an000; dms;
551 sti ;ints on ;an001; dms;
552 jmp Realloc_Error_Exit ;exit prog ;an000; dms;
556 call EMS_Link_Set ;set up page list ;an001; dms;
558 mov Handle_LookUp_Table.H_Pal_Ptr[di],si ;set table to pointer ;an000; dms;
559 mov Handle_LookUp_Table.H_Pages[di],cx ;new page count ;an000; dms;
560 mov bx,cs:[bp].Realloc_Page_Count ;return new page count ;an001; dms;
561 sub cs:Free_Pages,bx ;new free count ;an000; dms;
562 sti ;ints on ;an001; dms;
563 xor ax,ax ;clear error flag ;an001; dms;
565 jmp Realloc_Exit ;exit routine ;an001; dms;
568 Realloc_More_Pages_Cont:
571 mov si,Handle_LookUp_Table.H_Pal_Ptr[di] ;get start of links ;an000; dms;
574 cmp cx,0 ;at end ;an000; dms;
575 je Realloc_Alloc_Loop1_Exit ;yes ;an000; dms;
576 shl si,1 ;word entry ;an000; dms;
577 mov si,Page_Alloc_List[si] ;get next pointer ;an000; dms;
578 dec cx ;decrement loop count ;an000; dms;
579 jmp Realloc_Alloc_Loop1 ;continue ;an000; dms;
581 Realloc_Alloc_Loop1_Exit:
583 mov cx,cs:[bp].Realloc_Page_Alloc ;new pages to alloc ;an000; dms;
584 cmp cx,0 ;pages requested? ;an001; dms;
585 je Realloc_Alloc_Exit ;no - exit routine ;an001; dms;
587 mov bx,si ;save si ;an001; dms;
588 cli ;ints off ;an001; dms;
589 call EMS_Page_Contig_Chk ;contig pages? ;an001; dms;
590 jnc Realloc_Next_Pages ;yes ;an001; dms;
591 mov ah,EMS_Code87 ;Too few pages avail ;an000; dms;
592 sti ;ints on ;an001; dms;
593 jmp Realloc_Error_Exit ;exit prog ;an000; dms;
597 ;;;; mov ax,si ;ptr to new list ;an001; dms;
598 ;;;; inc ax ;contig to new links? ;an001; dms;
599 ;;;; cmp ax,bx ; ;an001; dms;
600 ;;;; je Realloc_Next_Pages1 ;yes continue ;an001; dms;
601 ;;;; mov ah,EMS_Code87 ;Too few pages avail ;an000; dms;
602 ;;;; sti ;ints on ;an001; dms;
603 ;;;; jmp Realloc_Error_Exit ;exit prog ;an000; dms;
607 call EMS_Link_Set ;set up page list ;an001; dms;
608 mov ax,si ;ptr to new list ;an001; dms;
609 mov si,bx ;end of old list ;an001; dms;
610 shl si,1 ;index entry ;an001; dms;
611 mov Page_Alloc_List[si],ax ;pick up new links ;an001; dms;
615 mov bx,cs:[bp].Realloc_Page_Alloc ;additional pages ;an001; dms;
616 sub cs:Free_Pages,bx ;new free count ;an000; dms;
617 mov bx,cs:[bp].Realloc_Page_Count ;pass back page request ;an000; dms;
618 mov Handle_LookUp_Table.H_Pages[di],bx ;new page count ;an000; dms;
619 sti ;ints on ;an001; dms;
620 xor ah,ah ;clear ah ;an000; dms;
621 jmp Realloc_Exit ;exit ;an000; dms;
626 cli ;ints off ;an000; dms;
627 mov si,cs:[bp].Realloc_LookUp_Index ;get handle index ;an000; dms;
628 mov bx,Handle_LookUp_Table.H_Pages[si] ;get orig. count ;an000; dms;
629 mov Handle_LookUp_Table.H_Pages[si],bx ;new page count ;an000; dms;
630 sti ;ints on ;an000; dms;
634 pop es ;restore segments ;an000; dms;
635 pop ds ; ;an000; dms;
637 pop si ;restore regs ;an000; dms;
638 pop di ; ;an000; dms;
639 pop dx ; ;an000; dms;
640 pop cx ; ;an000; dms;
642 ret ;return to caller ;an000; dms;
649 ;=========================================================================
650 ;=============== Function 55h Logic - Alter Page Map & Jump =============
651 ;=========================================================================
652 ;=========================================================================
653 ; Alter_And_Jump - This routine alters the page map and jumps
654 ; to the specified address.
656 ; Inputs : AH - 55h (Alter page map & jump)
657 ; AL - Physical page number/segment selector
658 ; 0 = Physical page numbers specified
659 ; 1 = Segment addresses specified in lieu of
660 ; physical page numbers
662 ; DS:SI - Pointer to map and jump structure
663 ; (see Map_And_Jump_Struct above)
665 ; Outputs : Revised map
666 ; AH - Non-zero if error
668 ;=========================================================================
669 Alter_And_Jump proc ;modify map ;an000; dms;
671 push bx ;save regs for jump ;an000; dms;
672 push cx ; ;an000; dms;
673 push di ; ;an000; dms;
674 push si ; ;an000; dms;
676 pushf ;save flags ;an000; dms;
677 push ds ;save segments ;an000; dms;
678 push es ; ;an000; dms;
680 mov bx,cs ;get code segment ;an000; dms;
681 mov es,bx ; es ;an000; dms;
683 mov cs:[bp].AAJ_Handle,dx ;save handle ;an000; dms;
684 mov cs:[bp].AAJ_Option,al ;save selector option ;an000; dms;
688 cmp dx,Num_Handles-1 ;dx > handle count ;an000; dms;
689 jbe AAJ_Check_Reusable ;continue test ;an000; dms;
690 mov ah,EMS_Code83 ;EMS handle bad ;an000; dms;
691 jmp AAJ_Error_Exit ;exit routine ;an000; dms;
695 mov ax,dx ;get handle ;an000; dms;
696 mov cs:[bp].AAJ_Mult,Type H_LookUp_Struc ;handle lookup table ;an000; dms;
697 mul cs:[bp].AAJ_Mult ;obtain index position ;an000; dms;
698 mov cs:[bp].AAJ_LookUp_Index,ax ;index to handle ;an000; dms;
699 mov di,ax ;place index in di ;an000; dms;
701 cli ;ints off ;an000; dms;
702 mov ax,Handle_LookUp_Table.H_Pages[di] ;get logical page count ;an000; dms;
703 mov cs:[bp].AAJ_Xref_Pages,ax ;save logical page count;an000; dms;
704 sti ;ints on ;an000; dms;
705 cmp Handle_LookUp_Table.H_Pages[di],Reusable_Handle ;handle allocated ;an000; dms;
706 jne AAJ_Good_Handle ;handle good ;an000; dms;
707 mov ah,EMS_Code83 ;EMS handle bad ;an000; dms;
708 jmp AAJ_Error_Exit ;exit routine ;an000; dms;
712 cmp cs:[bp].AAJ_Option,AAJ_Option_Max ;option in range? ;an000; dms;
713 jbe AAJ_Good_Option ;option good ;an000; dms;
714 mov ah,EMS_Code8F ;bad option ;an000; dms;
715 jmp AAJ_Error_Exit ;exit routine ;an000; dms;
719 les di,[si].Log_Phys_Map_Ptr ;point to map data ;an000; dms;
720 xor cx,cx ;clear loop counter ;an000; dms;
721 mov cl,[si].Log_Phys_Map_Len ;get loop count ;an000; dms;
722 mov dx,cs:[bp].AAJ_Handle ;get handle for call ;an000; dms;
723 mov bx,cs:[bp].AAJ_Xref_Pages ;logical page count ;an000; dms;
724 xor ah,ah ;clear high word ;an000; dms;
725 mov al,cs:[bp].AAJ_Option ;option selected ;an000; dms;
726 call Map_Pages ;map the pages requested;an000; dms;
727 or ah,ah ;error? ;an000; dms;
728 jnz AAJ_Error_Exit ;exit with error cond. ;an000; dms;
732 pop es ;restore regs ;an000; dms;
733 pop ds ; ;an000; dms;
735 pop si ; ;an000; dms;
736 pop di ; ;an000; dms;
737 pop cx ; ;an000; dms;
738 pop bx ; ;an000; dms;
740 mov cs:[bp].IE_Alloc_Byte,Unallocated ;deallocate instance ;an000; dms;
742 jmp dword ptr [si].Target_Address ;jump to address & run ;an000; dms;
746 pop es ;restore regs ;an000; dms;
747 pop ds ; ;an000; dms;
749 pop si ; ;an000; dms;
750 pop di ; ;an000; dms;
751 pop cx ; ;an000; dms;
752 pop bx ; ;an000; dms;
755 ret ;return to caller ;an000; dms;
757 Alter_And_Jump endp ;end proc ;an000; dms;
762 ;=========================================================================
763 ;=============== Function 56h Logic - Alter Page Map & Call =============
764 ;=========================================================================
768 ;=========================================================================
769 ; Alter_And_Call - This routine alters the page map and calls
770 ; the specified address. The mapping context
771 ; is saved on entry to the routine and restored
772 ; on exit from the routine.
774 ; Inputs : AH - 56h (Alter page map & call)
775 ; AL - Physical page number/segment selector
776 ; 0 = Physical page numbers specified
777 ; 1 = Segment addresses specified in lieu of
778 ; physical page numbers
779 ; 2 = Give minimum required stack size
781 ; DS:SI - Pointer to map and jump structure
782 ; (see Map_And_Call_Struc above)
784 ; Outputs : Revised map
785 ; AH - Non-zero if error
786 ; BX - Function 2 = size in bytes needed for stack
788 ;=========================================================================
791 Alter_And_Call proc ;modify map & call ;an000; dms;
793 cmp al,MAC_Stack_Status_Request ;stack report? ;an000; dms;
794 je MAC_Calc_Stack_Status ;yes ;an000; dms;
795 jb MAC_Alter_And_Call ;no - new mapping ;an000; dms;
796 mov ah,EMS_Code8F ;error occurred ;an000; dms;
797 jmp MAC_Stack_Exit ;exit routine ;an000; dms;
799 MAC_Calc_Stack_Status:
801 mov bx,8h ;room for call address ;an000; dms;
803 xor ax,ax ;signal no error ;an000; dms;
804 jmp MAC_Stack_Exit ;exit routine ;an000; dms;
808 cli ;ints off ;an000; dms;
809 mov cs:[bp].EMS_Reg_BX,bx ; ;an000; dms;
810 mov bx,ax ;save ax across flags ;an000; dms;
811 lahf ;move flags to ah ;an000; dms;
812 mov cs:[bp].EMS_Reg_FL,ax ;save flags ;an000; dms;
813 mov ax,bx ;restore ax ;an000; dms;
814 mov cs:[bp].EMS_Reg_CX,cx ; ;an000; dms;
815 mov cs:[bp].EMS_Reg_DX,dx ; ;an000; dms;
816 mov cs:[bp].EMS_Reg_DI,di ; ;an000; dms;
817 mov cs:[bp].EMS_Reg_SI,si ; ;an000; dms;
818 mov cs:[bp].EMS_Reg_DS,ds ; ;an000; dms;
819 mov cs:[bp].EMS_Reg_ES,es ; ;an000; dms;
821 mov cs:[bp].MAC_Option,al ;save option ;an000; dms;
822 sti ;ints on ;an000; dms;
823 cmp dx,Num_Handles-1 ;dx > handle count ;an000; dms;
824 jbe MAC_Check_Reusable ;continue test ;an000; dms;
825 mov ah,EMS_Code83 ;EMS handle bad ;an000; dms;
826 jmp MAC_Error_Exit ;exit routine ;an000; dms;
830 mov ax,dx ;get handle ;an000; dms;
831 mov cs:[bp].MAC_Mult,Type H_LookUp_Struc ;handle lookup table ;an000; dms;
832 mul cs:[bp].MAC_Mult ;obtain index position ;an000; dms;
833 mov cs:[bp].MAC_LookUp_Index,ax ;index to handle ;an000; dms;
834 mov di,ax ;place index in di ;an000; dms;
836 cli ;ints off ;an000; dms;
837 mov ax,Handle_LookUp_Table.H_Pages[di] ;get logical page count ;an000; dms;
838 mov cs:[bp].MAC_Xref_Pages,ax ;save logical page count;an000; dms;
839 cmp Handle_LookUp_Table.H_Pages[di],Reusable_Handle ;handle allocated ;an000; dms;
840 sti ;ints on ;an000; dms;
841 jne MAC_Verify_New_Count ;handle good ;an000; dms;
842 mov ah,EMS_Code83 ;EMS handle bad ;an000; dms;
843 jmp MAC_Error_Exit ;exit routine ;an000; dms;
845 MAC_Verify_New_Count:
847 cli ;ints off ;an000; dms;
848 mov ax,Map_Count ;get phys. page count ;an000; dms;
849 sti ;ints on ;an000; dms;
850 cmp [si].MAC_New_Page_Map_Len,al ;> physical pages ;an000; dms;
851 jbe MAC_Verify_Old_Count ;no - continue ;an000; dms;
852 mov ah,EMS_Code8B ;out of range ;an000; dms;
853 jmp MAC_Error_Exit ;exit routine ;an000; dms;
855 MAC_Verify_Old_Count:
857 cli ;ints off ;an000; dms;
858 mov ax,Map_Count ;get phys. page count ;an000; dms;
859 sti ;ints on ;an000; dms;
860 cmp [si].MAC_Old_Page_Map_Len,al ;> physical pages ;an000; dms;
861 jbe MAC_Do_Alter_and_Call ;no - continue ;an000; dms;
862 mov ah,EMS_Code8B ;yes - error ;an000; dms;
863 jmp MAC_Error_Exit ;exit routine ;an000; dms;
865 MAC_Do_Alter_And_Call:
867 jmp MAC_Build_Stack_And_Map ;build stack and map ;an000; dms;
871 jmp MAC_Strip_Stack_And_Map ;restore data strucs ;an000; dms;
877 cli ;ints off ;an000; dms;
878 mov bx,ax ;save ax ;an000; dms;
879 mov ax,cs:[bp].EMS_Reg_FL ;obtain entry flag stat ;an000; dms;
880 sahf ;put in flags reg ;an000; dms;
881 mov ax,bx ;restore ax ;an000; dms;
882 mov bx,cs:[bp].EMS_Reg_BX ; ;an000; dms;
883 mov cx,cs:[bp].EMS_Reg_CX ; ;an000; dms;
884 mov dx,cs:[bp].EMS_Reg_DX ; ;an000; dms;
885 mov di,cs:[bp].EMS_Reg_DI ; ;an000; dms;
886 mov si,cs:[bp].EMS_Reg_SI ; ;an000; dms;
887 mov ds,cs:[bp].EMS_Reg_DS ; ;an000; dms;
888 mov es,cs:[bp].EMS_Reg_ES ; ;an000; dms;
889 sti ;ints on ;an000; dms;
893 ret ;return to caller ;an000; dms;
896 ;=========================================================================
897 ; MAC_Build_Stack_And_Map : This routine will build the required
898 ; stack structure for a re-entrant
899 ; routine and map the new pages.
901 ; Inputs : DS:SI - Pointer to data in Map_And_Call_Struc format
903 ; Outputs : BP - Instance table to reflect data copyied to it
906 ; >0 = error (determined by Map_Pages)
908 ; Instance Table carries this data: Old Map Data
912 ;=========================================================================
914 MAC_Build_Stack_And_Map:
916 mov cs:[bp].EMS_Reg_DS,ds ;save DS ;an000; dms;
917 mov cs:[bp].EMS_Reg_SI,si ;save SI ;an000; dms;
919 mov ax,word ptr [si].MAC_Old_Page_Map_Ptr[+2];get the segment ;an000; dms;
920 mov es,ax ; of the old map ;an000; dms;
921 mov di,word ptr [si].MAC_Old_Page_Map_Ptr[+0];get its offset ;an000; dms;
923 mov al,[si].MAC_Old_Page_Map_Len ;get length of data ;an000; dms;
924 cbw ;convert to word ;an000; dms;
925 xor dx,dx ;clear high word ;an000; dms;
926 mov bx,Type Log_Phys_Map_Struc ;struc size
927 mul bx ;get total byte count ;an000; dms;
928 cli ;ints off ;an000; dms;
929 mov bx,offset MAC_M_C_Log ;offset in struc ;an000; dms;
930 sti ;ints on ;an000; dms;
931 add bx,bp ;actual offset ;an000; dms;
932 call MAC_Expand_Stack_And_Copy ;set up stack for ;an000; dms;
935 mov ds,cs:[bp].EMS_Reg_DS ;restore ds ;an000; dms;
936 mov si,cs:[bp].EMS_Reg_SI ;restore si ;an000; dms;
938 mov ax,word ptr [si].MAC_New_Page_Map_Ptr[+2];get the segment ;an000; dms;
939 mov es,ax ; of the old map ;an000; dms;
940 mov di,word ptr [si].MAC_New_Page_Map_Ptr[+0];get its offset ;an000; dms;
942 mov al,[si].MAC_New_Page_Map_Len ;get length of data ;an000; dms;
943 cbw ;conver to word ;an000; dms;
944 xor dx,dx ;clear high word ;an000; dms;
945 mov bx,Type Log_Phys_Map_Struc ;struc size
946 mul bx ;get total byte count ;an000; dms;
947 cli ;ints off ;an000; dms;
948 mov bx,offset MAC_M_C_Log ;Ptr in struc ;an000; dms;
949 add bx,size MAC_M_C_Log/2 ;next entry ;an000; dms;
950 sti ;ints on ;an000; dms;
951 add bx,bp ;offset BP relative ;an000; dms;
952 call MAC_Expand_Stack_And_Copy ;set up stack for ;an000; dms;
955 mov ds,cs:[bp].EMS_Reg_DS ;restore ds ;an000; dms;
956 mov si,cs:[bp].EMS_Reg_SI ;restore si ;an000; dms;
958 mov ax,ds ;move seg of data to ;an000; dms;
959 mov es,ax ; es ;an000; dms;
960 mov di,si ;move off of data ;an000; dms;
961 mov ax,Type Map_And_Call_Struc ;get size of structure ;an000; dms;
962 cli ;ints off ;an000; dms;
963 mov bx,offset MAC_M_C_Data
964 sti ;ints on ;an000; dms;
965 add bx,bp ;offset BP relative ;an000; dms;
966 call MAC_Expand_Stack_And_Copy ;set up stack for ;an000; dms;
969 mov ds,cs:[bp].EMS_Reg_DS ;restore ds ;an000; dms;
970 mov si,cs:[bp].EMS_Reg_SI ;restore si ;an000; dms;
972 mov ax,cs ;get seg of context ;an000; dms;
973 mov es,ax ; in es ;an000; dms;
974 cli ;ints off ;an000; dms;
975 mov di,offset cs:Map_Table ;get offset of context ;an000; dms;
976 mov ax,Map_Count ;get context entry count;an000; dms;
977 sti ;ints on ;an000; dms;
978 xor dx,dx ;clear dx ;an000; dms;
979 mov bx,Type Mappable_Phys_Page_Struct ;get struc size ;an000; dms;
980 mul bx ;get size in bytes ;an000; dms;
981 cli ;ints off ;an000; dms;
982 mov bx,offset cs:MAC_Map_Table
983 sti ;ints on ;an000; dms;
984 add bx,bp ;offset BP relative ;an000; dms;
985 call MAC_Expand_Stack_And_Copy ;set up stack for ;an000; dms;
988 mov ds,cs:[bp].EMS_Reg_DS ;restore ds ;an000; dms;
989 mov si,cs:[bp].EMS_Reg_SI ;restore si ;an000; dms;
991 push cs ;save return segment ;an000; dms;
992 mov ax,offset MAC_Return_Routine ;save return offset ;an000; dms;
993 push ax ; ;an000; dms;
995 mov ax,word ptr [si].MAC_Target_Address[+2] ;get seg of call far ;an000; dms;
996 mov bx,word ptr [si].MAC_Target_Address[+0] ;get offset of call far ;an000; dms;
997 push ax ;put on stack ;an000; dms;
998 push bx ; ;an000; dms;
1000 les di,[si].MAC_New_Page_Map_Ptr ;set up for call ;an000; dms;
1001 xor cx,cx ;clear cx ;an000; dms;
1002 mov cl,[si].MAC_New_Page_Map_Len ;get array size ;an000; dms;
1003 mov dx,cs:[bp].EMS_Reg_DX ;get handle for call ;an000; dms;
1004 mov bx,cs:[bp].MAC_Xref_Pages ;get handle page count ;an000; dms;
1005 xor ah,ah ;clear high word ;an000; dms;
1006 mov al,cs:[bp].MAC_Option ;get option ;an000; dms;
1008 call Map_Pages ;map the new pages ;an000; dms;
1009 or ah,ah ;error? ;an000; dms;
1010 jnz MAC_Error_Strip_Stack ;take data off stack ;an000; dms;
1012 cli ;ints off ;an000; dms;
1013 mov ax,cs:[bp].EMS_Reg_FL ;obtain entry flag stat ;an000; dms;
1014 sahf ;put in flags reg ;an000; dms;
1015 mov bx,cs:[bp].EMS_Reg_BX ; ;an000; dms;
1016 mov cx,cs:[bp].EMS_Reg_CX ; ;an000; dms;
1017 mov dx,cs:[bp].EMS_Reg_DX ; ;an000; dms;
1018 mov di,cs:[bp].EMS_Reg_DI ; ;an000; dms;
1019 mov si,cs:[bp].EMS_Reg_SI ; ;an000; dms;
1020 mov ds,cs:[bp].EMS_Reg_DS ; ;an000; dms;
1021 mov es,cs:[bp].EMS_Reg_ES ; ;an000; dms;
1022 sti ;ints on ;an000; dms;
1024 Retf_Fake_Out Proc Far ;this proc is to ;an000; dms;
1027 ret ;performs a far return ;an000; dms;
1029 Retf_Fake_Out Endp ;end of retf fake out ;an000; dms;
1032 MAC_Error_Strip_Stack:
1034 add sp,8h ;adjust for return add. ;an000; dms;
1035 ; and target add. on
1037 jmp MAC_Error_Exit ;exit routine ;an000; dms;
1040 ;=========================================================================
1041 ; MAC_Strip_Stack_And_Map : This routine will strip the stack of all
1042 ; the data placed on by MAC_Build_Stack_And_Map.
1044 ; Inputs : CS:BP - Pointer to data on the instance table
1046 ; Outputs : All data area restored
1047 ; Pages remapped to original
1049 ; >0 = error (determined by Map_Pages)
1051 ; Instance Table carries this data: Old Map Data
1055 ;=========================================================================
1057 MAC_Strip_Stack_And_Map: ;an000; dms;
1059 mov ax,cs ;seg of context ;an000; dms;
1060 mov es,ax ;place in es ;an000; dms;
1061 cli ;ints off ;an000; dms;
1062 mov di,offset cs:Map_Table ;get off of context ;an000; dms;
1063 mov ax,Map_Count ;get entries in context ;an000; dms;
1064 sti ;ints on ;an000; dms;
1065 xor dx,dx ;clear dx ;an000; dms;
1066 mov bx,Type Mappable_Phys_Page_Struct ;struc size ;an000; dms;
1067 mul bx ;get byte count ;an000; dms;
1068 cli ;ints off ;an000; dms;
1069 mov bx,offset MAC_Map_Table
1070 sti ;ints on ;an000; dms;
1071 add bx,bp ;offset BP relative ;an000; dms;
1072 call MAC_Shrink_Stack_And_Copy ;restore context ;an000; dms;
1074 mov si,cs:[bp].EMS_Reg_SI ;restore pointer ;an000; dms;
1075 mov ds,cs:[bp].EMS_Reg_DS ; to data struc ;an000; dms;
1077 mov ax,ds ;transfer seg of struc ;an000; dms;
1078 mov es,ax ; to dest. segment ;an000; dms;
1079 mov di,si ;di=dest. offset ;an000; dms;
1080 mov ax,Type Map_And_Call_Struc ;get size to move ;an000; dms;
1081 cli ;ints off ;an000; dms;
1082 mov bx,offset MAC_M_C_Data
1083 sti ;ints on ;an000; dms;
1084 add bx,bp ;offset BP relative ;an000; dms;
1085 call MAC_Shrink_Stack_And_Copy ;restore Map & Call buf ;an000; dms;
1087 mov ds,cs:[bp].EMS_Reg_DS ;restore ds ;an000; dms;
1088 mov si,cs:[bp].EMS_Reg_SI ;restore si ;an000; dms;
1090 mov ax,word ptr [si].MAC_New_Page_Map_Ptr[+2];get the segment ;an000; dms;
1091 mov es,ax ; of the old map ;an000; dms;
1092 mov di,word ptr [si].MAC_New_Page_Map_Ptr[+0];get its offset ;an000; dms;
1094 mov al,[si].MAC_New_Page_Map_Len ;get length of data ;an000; dms;
1095 cbw ;convert to word ;an000; dms;
1096 xor dx,dx ;clear high word ;an000; dms;
1097 mov bx,Type Log_Phys_Map_Struc ;struc size ;an000; dms;
1098 mul bx ;get total byte count ;an000; dms;
1099 cli ;ints off ;an000; dms;
1100 mov bx,offset MAC_M_C_Log
1101 sti ;ints on ;an000; dms;
1102 add bx,size MAC_M_C_Log/2
1103 add bx,bp ;offset BP relative ;an000; dms;
1104 call MAC_Shrink_Stack_And_Copy ;restore new page data ;an000; dms;
1106 mov ds,cs:[bp].EMS_Reg_DS ;restore ds ;an000; dms;
1107 mov si,cs:[bp].EMS_Reg_SI ;restore si ;an000; dms;
1109 mov ax,word ptr [si].MAC_Old_Page_Map_Ptr[+2];get the segment ;an000; dms;
1110 mov es,ax ; of the old map ;an000; dms;
1111 mov di,word ptr [si].MAC_Old_Page_Map_Ptr[+0];get its offset ;an000; dms;
1113 mov al,[si].MAC_Old_Page_Map_Len ;get length of data ;an000; dms;
1114 cbw ;convert to word ;an000; dms;
1115 xor dx,dx ;clear high word ;an000; dms;
1116 mov bx,Type Log_Phys_Map_Struc ;struc size ;an000; dms;
1117 mul bx ;get total byte count ;an000; dms;
1118 cli ;ints off ;an000; dms;
1119 mov bx,offset MAC_M_C_Log
1120 sti ;ints on ;an000; dms;
1121 add bx,bp ;offset BP relative ;an000; dms;
1122 call MAC_Shrink_Stack_And_Copy ;set up stack for ;an000; dms;
1124 mov ds,cs:[bp].EMS_Reg_DS ;restore ds ;an000; dms;
1125 mov si,cs:[bp].EMS_Reg_SI ;restore si ;an000; dms;
1127 mov dx,cs:[bp].EMS_Reg_DX ;get DX reg
1129 les di,[si].MAC_Old_Page_Map_Ptr ;set up for call ;an000; dms;
1130 xor cx,cx ;clear cx ;an000; dms;
1131 mov cl,[si].MAC_Old_Page_Map_Len ;get array size ;an000; dms;
1132 mov bx,cs:[bp].MAC_Xref_Pages ;get handle page count ;an000; dms;
1133 xor ah,ah ;clear high byte ;an000; dms;
1134 mov al,cs:[bp].MAC_Option ;get option ;an000; dms;
1136 call Map_Pages ;map the new pages ;an000; dms;
1138 jmp MAC_Exit ;exit the program ;an000; dms;
1141 Alter_And_Call endp ;end proc ;an000; dms;
1145 ;=========================================================================
1146 ;=============== Function 57h Logic - Move/Exchange Memory Region =======
1147 ;=========================================================================
1149 ;=========================================================================
1150 ; Exchng_Region - This routine moves/exchanges memory regions
1151 ; specified by the user. The following types of
1152 ; moves/exchanges are possible:
1154 ; Source Destination
1155 ; ------------------- ----------------------
1156 ; Conventional Memory Expanded Memory
1157 ; Expanded Memory Conventional Memory
1158 ; Expanded Memory Expanded Memory
1160 ; Inputs : AH - 57h (Move/Exchange Memory Region)
1161 ; AL - Type of transfer
1163 ; 1 = Exchange memory
1164 ; DS:SI - Pointer to Move_Source_Dest Structure
1166 ; Outputs : Revised map
1167 ; AH - Non-zero if error
1168 ;=========================================================================
1173 push bx ;save regs ;an000; dms;
1174 push cx ; ;an000; dms;
1175 push dx ; ;an000; dms;
1176 push di ; ;an000; dms;
1177 push si ; ;an000; dms;
1178 push ds ; ;an000; dms;
1179 push es ; ;an000; dms;
1181 mov cs:[bp].ER_Sub_Function,al ;save subfunction ;an000; dms;
1182 cmp al,ER_Max_Function ;valid function? ;an000; dms;
1183 jbe ER_Valid_Sub_Function ;yes - continue ;an000; dms;
1184 mov ah,EMS_Code8F ;no - error ;an000; dms;
1185 jmp ER_Error_Exit ;exit routine ;an000; dms;
1187 ER_Valid_Sub_Function:
1189 call ER_Type_Check ;Proper types & ;an000; dms;
1190 or ah,ah ; type combinations? ;an000; dms;
1191 jnz ER_Error_Exit ;no - exit routine ;an000; dms;
1193 call ER_Handle_Check ;valid handles? ;an000; dms;
1194 or ah,ah ; ;an000; dms;
1195 jnz ER_Error_Exit ;no - exit routine ;an000; dms;
1197 call ER_Length_Check ;Region fits in page ;an000; dms;
1198 or ah,ah ; and <= 1Mb? ;an000; dms;
1199 jnz ER_Error_Exit ;no - exit routine ;an000; dms;
1201 call ER_Wrap_Check ;> 1Mb wrap on move? ;an000; dms;
1202 or ah,ah ; ;an000; dms;
1203 jnz ER_Error_Exit ;yes - exit routine ;an000; dms;
1205 call ER_Overlap_Check ;conv. memory overlaps ;an000; dms;
1206 or ah,ah ; EMS page frame? ;an000; dms;
1207 jnz ER_Error_Exit ;yes - exit routine ;an000; dms;
1209 call ER_Log_Page_Test ;offset valid for log. ;an000; dms;
1210 or ah,ah ; page? ;an000; dms;
1211 jnz ER_Error_Exit ;no - exit routine ;an000; dms;
1213 cmp cs:[bp].ER_Sub_Function,ER_Move ;move? ;an000; dms;
1214 je ER_Move_Call ;yes - perform move ;an000; dms;
1215 call ER_EMS_Overlap_Check ;EMS pages overlap? ;an000; dms;
1217 jz ER_Exchange_No_Overlap ;no - exit with error ;an000; dms;
1218 mov ah,EMS_Code97 ;signal error ;an000; dms;
1219 jmp ER_Error_Exit ;exit with error code ;an000; dms;
1221 ER_Exchange_No_Overlap:
1223 call ER_Exchange_Data ;no - perform exchange ;an000; dms;
1224 jmp ER_Exit ;exit the routine ;an000; dms;
1228 call ER_EMS_Overlap_Check ;see if we had a move ;an000; dms;
1230 push ax ;save result across call;an000; dms;
1231 call ER_Move_Data ;perform the move ;an000; dms;
1232 pop ax ;restore result ;an000; dms;
1237 pop es ;restore regs ;an000; dms;
1238 pop ds ; ;an000; dms;
1239 pop si ; ;an000; dms;
1240 pop di ; ;an000; dms;
1241 pop dx ; ;an000; dms;
1242 pop cx ; ;an000; dms;
1243 pop bx ; ;an000; dms;
1245 ret ;return to caller ;an000; dms;
1250 ;=========================================================================
1251 ; ER_Handle_Check : This routine checks to see if the EMS handles
1252 ; specified are valid.
1254 ; Inputs : DS:SI - Pointer to Move_Source_Dest_Struc data
1256 ; Outputs : AH - Non-zero on error
1257 ; Possible error codes: 83h
1258 ;=========================================================================
1260 ER_Handle_Check proc ;check requested handles;an000; dms;
1262 push dx ;save regs ;an000; dms;
1263 push di ; ;an000; dms;
1265 cmp [si].Source_Memory_Type,ER_Conv_Memory ;Conv memory for source?;an000; dms;
1266 je ER_Handle_Check_Dest ;yes - ck dest. handle ;an000; dms;
1268 push dx ;save dx ;an000; dms;
1269 xor dx,dx ;clear it ;an000; dms;
1270 mov ax,[si].Source_Handle ;get handle requested ;an000; dms;
1271 mov dx,Type H_LookUp_Struc ;handle lookup table ;an000; dms;
1272 mul dx ;obtain index position ;an000; dms;
1273 mov di,ax ;place index in di ;an000; dms;
1274 pop dx ;restore dx ;an000; dms;
1276 cmp Handle_LookUp_Table.H_Pages[di],Reusable_Handle ;handle allocated ;an000; dms;
1277 je ER_Handle_Check_Error_Exit ;handle not allocated ;an000; dms;
1279 ER_Handle_Check_Dest:
1281 cmp [si].Dest_Memory_Type,ER_Conv_Memory ;Conv memory for dest? ;an000; dms;
1282 je ER_Handle_Check_Good_Exit ;yes - exit routine ;an000; dms;
1284 push dx ;save dx ;an000; dms;
1285 xor dx,dx ;clear it ;an000; dms;
1286 mov ax,[si].Dest_Handle ;get handle requested ;an000; dms;
1287 mov dx,Type H_LookUp_Struc ;handle lookup table ;an000; dms;
1288 mul dx ;obtain index position ;an000; dms;
1289 mov di,ax ;place index in di ;an000; dms;
1290 pop dx ;restore dx ;an000; dms;
1292 cmp Handle_LookUp_Table.H_Pages[di],Reusable_Handle ;handle allocated ;an000; dms;
1293 je ER_Handle_Check_Error_Exit ;handle not allocated ;an000; dms;
1295 ER_Handle_Check_Good_Exit:
1297 xor ah,ah ;signal no error ;an000; dms;
1298 jmp ER_Handle_Check_Exit ;exit program ;an000; dms;
1300 ER_Handle_Check_Error_Exit:
1302 mov ah,EMS_Code83 ;signal error ;an000; dms;
1304 ER_Handle_Check_Exit:
1306 pop di ;restore regs ;an000; dms;
1307 pop dx ; ;an000; dms;
1309 ret ;return to caller ;an000; dms;
1311 ER_Handle_Check endp ;end proc ;an000; dms;
1315 ;=========================================================================
1316 ; ER_Length_Check : This routine checks to see if the region length
1317 ; specified exceeds the page count of either the
1318 ; source or destination EMS handle pages allocated.
1319 ; It also checks to determine if the region length
1322 ; Inputs : DS:SI - Pointer to Move_Source_Dest_Struc data
1324 ; Outputs : AH - Non-zero on error
1325 ; Possible error codes: 93h
1328 ;=========================================================================
1330 ER_Length_Check proc ;check region length ;an000; dms;
1332 push bx ;save regs ;an000; dms;
1333 push cx ; ;an000; dms;
1334 push dx ; ;an000; dms;
1335 push di ; ;an000; dms;
1337 mov cx,[si].Region_Length_High_Word ;get size of the region ;an000; dms;
1338 mov bx,[si].Region_Length_Low_Word ; in CX:BX ;an000; dms;
1339 cmp cx,ER_10H ;> 1Mb ;an000; dms;
1340 ja ER_Length_Check_Error96 ;exit with error ;an000; dms;
1341 cmp cx,ER_10H ;high word = 10h? ;an000; dms;
1342 jne ER_Length_Check_Cont ;no - continue ;an000; dms;
1343 cmp bx,0 ;low word other than 0? ;an000; dms;
1344 je ER_Length_Check_Cont ;no - good value ;an000; dms;
1346 ER_Length_Check_Error96:
1348 mov ah,EMS_Code96 ;signal error ;an000; dms;
1349 jmp ER_Length_Check_Exit ;exit routine
1351 ER_Length_Check_Cont:
1353 cmp [si].Source_Memory_Type,ER_Conv_Memory ;Conv memory for source?;an000; dms;
1354 je ER_Length_Check_Dest ;yes - ck dest. length ;an000; dms;
1356 push dx ;save dx ;an000; dms;
1357 xor dx,dx ;clear it ;an000; dms;
1358 mov ax,[si].Source_Handle ;get handle requested ;an000; dms;
1359 mov dx,Type H_LookUp_Struc ;handle lookup table ;an000; dms;
1360 mul dx ;obtain index position ;an000; dms;
1361 mov di,ax ;place index in di ;an000; dms;
1362 pop dx ;restore dx ;an000; dms;
1364 mov ax,Handle_LookUp_Table.H_Pages[di] ;get logical page count ;an000; dms;
1366 sub ax,[si].Source_Initial_Seg_Page ;pages in EMS to fill ;an000; dms;
1367 push ax ;save ax ;an000; dms;
1368 dec ax ;make it 0 based ;an000; dms;
1369 pop ax ;restore ax ;an000; dms;
1370 js ER_Length_Check_Error8A_Exit ;page out of range ;an000; dms;
1372 xor dx,dx ;clear it ;an000; dms;
1373 mov dx,EMS_Page_Size_In_Bytes+1 ;page size in bytes ;an000; dms;
1374 mul dx ;get total bytes to trf ;an000; dms;
1375 sub ax,[si].Source_Initial_Offset ;get byte count in 1st ;an000; dms;
1378 mov bx,ax ;prepare for DWORD comp ;an000; dms;
1379 mov ax,dx ; ;an000; dms;
1381 mov cx,[si].Region_Length_High_Word ;get size of the region ;an000; dms;
1382 mov dx,[si].Region_Length_Low_Word ; in CX:BX ;an000; dms;
1384 call ER_Dword_Compare ;region > target? ;an000; dms;
1385 jc ER_Length_Check_Error93_Exit ;CY = region > target ;an000; dms;
1388 ER_Length_Check_Dest:
1390 cmp [si].Dest_Memory_Type,ER_Conv_Memory ;Conv memory for dest? ;an000; dms;
1391 je ER_Length_Check_Good_Exit ;yes - exit routine ;an000; dms;
1393 push dx ;save dx ;an000; dms;
1394 xor dx,dx ;clear it ;an000; dms;
1395 mov ax,[si].Dest_Handle ;get handle requested ;an000; dms;
1396 mov dx,Type H_LookUp_Struc ;handle lookup table ;an000; dms;
1397 mul dx ;obtain index position ;an000; dms;
1398 mov di,ax ;place index in di ;an000; dms;
1399 pop dx ;restore dx ;an000; dms;
1401 mov ax,Handle_LookUp_Table.H_Pages[di] ;get logical page count ;an000; dms;
1403 sub ax,[si].Dest_Initial_Seg_Page ;pages in EMS to fill ;an000; dms;
1404 push ax ;save ax ;an000; dms;
1405 dec ax ;make it 0 based ;an000; dms;
1406 pop ax ;restore ax ;an000; dms;
1407 js ER_Length_Check_Error8A_Exit ;page out of range ;an000; dms;
1409 xor dx,dx ;clear high word ;an000; dms;
1410 mov dx,EMS_Page_Size_In_Bytes+1 ;page size in bytes ;an000; dms;
1411 mul dx ;get total bytes to trf ;an000; dms;
1412 sub ax,[si].Dest_Initial_Offset ;get byte count in 1st ;an000; dms;
1415 mov bx,ax ;prepare for DWORD comp ;an000; dms;
1416 mov ax,dx ; ;an000; dms;
1418 mov cx,[si].Region_Length_High_Word ;get size of the region ;an000; dms;
1419 mov dx,[si].Region_Length_Low_Word ; in CX:BX ;an000; dms;
1421 call ER_Dword_Compare ;region > target? ;an000; dms;
1422 jc ER_Length_Check_Error93_Exit ;CY = region > target ;an000; dms;
1425 ER_Length_Check_Good_Exit:
1427 xor ah,ah ;signal no error ;an000; dms;
1428 jmp ER_Length_Check_Exit ;exit routine ;an000; dms;
1430 ER_Length_Check_Error93_Exit:
1432 mov ah,EMS_Code93 ;signal error ;an000; dms;
1433 jmp ER_Length_Check_Exit ;exit routine ;an000; dms;
1435 ER_Length_Check_Error8A_Exit:
1437 mov ah,EMS_Code8A ;signal error ;an000; dms;
1439 ER_Length_Check_Exit: ;main exit ;an000; dms;
1441 pop di ;restore regs ;an000; dms;
1442 pop dx ; ;an000; dms;
1443 pop cx ; ;an000; dms;
1444 pop bx ; ;an000; dms;
1446 ret ;return to caller ;an000; dms;
1448 ER_Length_Check endp ;end proc ;an000; dms;
1451 ;=========================================================================
1452 ; ER_Type_Check : This routine checks the source/destination type
1453 ; specified to determine if they are within the
1456 ; Inputs : DS:SI - Pointer to Move_Source_Dest_Struc data
1458 ; Outputs : AH - Non-zero on error
1459 ; Possible error codes: 98h
1460 ;=========================================================================
1462 ER_Type_Check proc ;check type ;an000; dms;
1464 cmp [si].Source_Memory_Type,ER_Max_Type ;type within range? ;an000; dms;
1465 ja ER_Type_Check_Error_Exit ;no - error exit ;an000; dms;
1467 cmp [si].Dest_Memory_Type,ER_Max_Type ;type within range? ;an000; dms;
1468 ja ER_Type_Check_Error_Exit ;no - error exit ;an000; dms;
1471 ER_Type_Check_Good_Exit:
1473 xor ah,ah ;signal no error ;an000; dms;
1474 jmp ER_Type_Check_Exit ;exit routine ;an000; dms;
1476 ER_Type_Check_Error_Exit:
1478 mov ah,EMS_Code98 ;signal error ;an000; dms;
1482 ret ;return to caller ;an000; dms;
1484 ER_Type_Check endp ;end proc ;an000; dms;
1487 ;=========================================================================
1488 ; ER_Wrap_Check : This routine checks to determine if there will be
1489 ; a wrap of conventional memory beyond 1Mb.
1491 ; Inputs : DS:SI - Pointer to Move_Source_Dest_Struc data
1493 ; Outputs : AH - Non-zero on error
1494 ; Possible error codes: A2h
1495 ;=========================================================================
1497 ER_Wrap_Check proc ;cks. conv. mem. wrap ;an000; dms;
1499 push dx ;save regs ;an000; dms;
1500 push bx ; ;an000; dms;
1502 cmp [si].Source_Memory_Type,ER_Conv_Memory ;conv. memory? ;an000; dms;
1503 jne ER_Wrap_Check_Dest ;no -check dest. ;an000; dms;
1505 mov ax,[si].Source_Initial_Seg_Page ;get segment ;an000; dms;
1506 xor dx,dx ;clear high word ;an000; dms;
1507 mov bx,ER_10H ;adjust segment to ;an000; dms;
1509 mul bx ; ;an000; dms;
1510 add ax,[si].Source_Initial_Offset ;add in offset ;an000; dms;
1511 adc dx,0 ;pick up carry if any ;an000; dms;
1513 add ax,[si].Region_Length_Low_Word ;add in low word of ;an000; dms;
1515 adc dx,[si].Region_Length_High_Word ;add in high word of ;an000; dms;
1517 cmp dx,ER_10H ;> 1Mb? ;an000; dms;
1518 jae ER_Wrap_Check_Error_Exit ;yes - signal error ;an000; dms;
1519 jmp ER_Wrap_Check_Good_Exit ;no - signal no error ;an000; dms;
1523 cmp [si].Dest_Memory_Type,ER_Conv_Memory ;conv. memory? ;an000; dms;
1524 jne ER_Wrap_Check_Good_Exit ;no - exit routine ;an000; dms;
1526 mov ax,[si].Dest_Initial_Seg_Page ;get segment ;an000; dms;
1527 xor dx,dx ;clear high word ;an000; dms;
1528 mov bx,ER_10H ;adjust segment to ;an000; dms;
1530 mul bx ; ;an000; dms;
1531 add ax,[si].Dest_Initial_Offset ;add in offset ;an000; dms;
1532 adc dx,0 ;pick up carry if any ;an000; dms;
1534 add ax,[si].Region_Length_Low_Word ;add in low word of ;an000; dms;
1536 adc dx,[si].Region_Length_High_Word ;add in high word of ;an000; dms;
1538 cmp dx,ER_10H ;> 1Mb? ;an000; dms;
1539 jae ER_Wrap_Check_Error_Exit ;yes - signal error ;an000; dms;
1541 ER_Wrap_Check_Good_Exit:
1543 xor ah,ah ;signal no error ;an000; dms;
1544 jmp ER_Wrap_Check_Exit ;exit routine ;an000; dms;
1546 ER_Wrap_Check_Error_Exit:
1548 mov ah,EMS_CodeA2 ;signal error ;an000; dms;
1552 pop bx ;restore regs ;an000; dms;
1553 pop dx ; ;an000; dms;
1555 ret ;return to caller ;an000; dms;
1557 ER_Wrap_Check endp ;end proc ;an000; dms;
1560 ;=========================================================================
1561 ; ER_Overlap_Check : This routine checks to determine if the conventional
1562 ; memory region and expanded memory region overlap.
1563 ; Specifically, does the conventional memory region
1564 ; overlap the physical page addresses used for
1567 ; Inputs : DS:SI - Pointer to Move_Source_Dest_Struc data
1569 ; Outputs : AH - Non-zero on error
1570 ; Possible error codes: 94h
1574 ; If Beg.Src.Add. < Beg.Dst.Add
1575 ; If (End.Src.Add - Beg.Dst.Add) > 0
1581 ; If (End.Dst.Add - Beg.Src.Add) > 0
1587 ;=========================================================================
1589 ER_Overlap_Check proc ;check for overlap ;an000; dms;
1591 push dx ;save regs ;an000; dms;
1592 call ER_Save_Context ;save context ;an000; dms;
1594 cmp [si].Source_Memory_Type,ER_Conv_Memory ;conventional memory? ;an000; dms;
1595 je ER_Overlap_Check_Source ;yes - check overlap ;an000; dms;
1596 ;no - see if dest is
1599 cmp [si].Dest_Memory_Type,ER_Conv_Memory ;conventional memory? ;an000; dms;
1600 jne ER_Overlap_Jump_Good ;no - exit routine ;an000; dms;
1602 ER_Overlap_Check_Dest:
1604 mov di,offset cs:ER_Save_Context_Buffer ;get addressibility to ;an000; dms;
1605 ; the page frame save
1607 add di,bp ;offset BP relative ;an000; dms;
1608 cli ;ints off ;an000; dms;
1609 cmp Map_Count,2 ;>= 2 page frames ;an000; dms;
1610 sti ;ints on ;an000; dms;
1611 jb ER_Overlap_Check_Dest_1_Frame ;no - use 1st. frame ;an000; dms;
1612 add di,Type Mappable_Phys_Page_Struct ;yes - adjust ptr to ;an000; dms;
1613 ; next frame for dest.
1614 ER_Overlap_Check_Dest_1_Frame:
1616 ;**** calc abs address of the bottom of EMS transfer area
1618 mov ax,cs:[di].Phys_Page_Segment ;get seg value ;an000; dms;
1619 xor dx,dx ;clear high word ;an000; dms;
1620 mov bx,ER_10H ;para size ;an000; dms;
1621 mul bx ;make abs address ;an000; dms;
1622 mov cs:[bp].ER_Src_Abs_Beg_Low,ax ;save abs. address of ;an000; dms;
1623 mov cs:[bp].ER_Src_Abs_Beg_High,dx ; phys page beg. ;an000; dms;
1625 ;**** calc abs address of the top of EMS transfer area
1627 add ax,EMS_Page_Size_In_Bytes ;make abs address ;an000; dms;
1628 adc dx,0 ; ;an000; dms;
1629 mov cs:[bp].ER_Src_Abs_End_Low,ax ;save abs. address ;an000; dms;
1630 mov cs:[bp].ER_Src_Abs_End_High,dx ; of phys page end ;an000; dms;
1632 ;**** calc abs address of the bottom of CONV transfer area
1634 mov ax,[si].Dest_Initial_Seg_Page ;get segment ;an000; dms;
1635 xor dx,dx ;clear high word ;an000; dms;
1636 mov bx,ER_10H ;para size ;an000; dms;
1637 mul bx ;make abs address ;an000; dms;
1638 add ax,[si].Dest_Initial_Offset ;get offset ;an000; dms;
1639 adc dx,0 ;pick up carry ;an000; dms;
1640 mov cs:[bp].ER_Dst_Abs_Beg_Low,ax ;save initial seg start ;an000; dms;
1641 mov cs:[bp].ER_Dst_Abs_Beg_High,dx ;save initial off start ;an000; dms;
1643 ;**** calc abs address of the top of CONV transfer area
1645 add ax,[si].Region_Length_Low_Word ;add in low word of ;an000; dms;
1647 adc dx,[si].Region_Length_High_Word ;add in high word of ;an000; dms;
1648 mov cs:[bp].ER_Dst_Abs_End_Low,ax ;save initial seg start ;an000; dms;
1649 mov cs:[bp].ER_Dst_Abs_End_High,dx ;save initial off start ;an000; dms;
1651 call ER_General_Overlap_Test ;test for overlap ;an000; dms;
1653 jc ER_Overlap_Error_Exit ;exit with error ;an000; dms;
1655 ER_Overlap_Jump_Good:
1657 jmp ER_Overlap_Good_Exit ;exit good ;an000; dms;
1659 ER_Overlap_Check_Source:
1661 mov di,offset cs:ER_Save_Context_Buffer ;get addressibility to ;an000; dms;
1662 ; the page frame save
1664 add di,bp ;offset BP relative ;an000; dms;
1666 ;**** calc abs address of the bottom of EMS transfer area
1668 mov ax,cs:[di].Phys_Page_Segment ;get seg value ;an000; dms;
1669 xor dx,dx ;clear high word ;an000; dms;
1670 mov bx,ER_10H ;para size ;an000; dms;
1671 mul bx ;make abs address ;an000; dms;
1672 mov cs:[bp].ER_Src_Abs_Beg_Low,ax ;save abs. address of ;an000; dms;
1673 mov cs:[bp].ER_Src_Abs_Beg_High,dx ; phys page beg. ;an000; dms;
1675 ;**** calc abs address of the top of EMS transfer area
1677 mov ax,cs:[di].Phys_Page_Segment ;get seg value ;an000; dms;
1678 mov dx,EMS_Page_Size_In_Bytes ;get end of phys page ;an000; dms;
1679 mov bx,ER_10H ;para size ;an000; dms;
1680 mul bx ;make abs address ;an000; dms;
1681 mov cs:[bp].ER_Src_Abs_End_Low,ax ;save abs. address ;an000; dms;
1682 mov cs:[bp].ER_Src_Abs_End_High,dx ; of phys page end ;an000; dms;
1684 ;**** calc abs address of the bottom of CONV transfer area
1686 mov ax,[si].Source_Initial_Seg_Page ;get segment ;an000; dms;
1687 xor dx,dx ;clear high word ;an000; dms;
1688 mov bx,ER_10H ;para size ;an000; dms;
1689 mul bx ;make abs address ;an000; dms;
1690 add ax,[si].Source_Initial_Offset ;get offset ;an000; dms;
1691 adc dx,0 ;pick up carry ;an000; dms;
1692 mov cs:[bp].ER_Dst_Abs_Beg_Low,ax ;save initial seg start ;an000; dms;
1693 mov cs:[bp].ER_Dst_Abs_Beg_High,dx ;save initial off start ;an000; dms;
1695 ;**** calc abs address of the top of CONV transfer area
1697 add ax,[si].Region_Length_Low_Word ;add in low word of ;an000; dms;
1699 adc dx,[si].Region_Length_High_Word ;add in high word of ;an000; dms;
1700 mov cs:[bp].ER_Dst_Abs_End_Low,ax ;save initial seg start ;an000; dms;
1701 mov cs:[bp].ER_Dst_Abs_End_High,dx ;save initial off start ;an000; dms;
1703 call ER_General_Overlap_Test ;test for overlap ;an000; dms;
1705 jnc ER_Overlap_Good_Exit ;exit good ;an000; dms;
1706 jmp ER_Overlap_Error_Exit ;exit bad
1708 ER_Overlap_Good_Exit:
1710 xor ah,ah ;signal no error ;an000; dms;
1711 jmp ER_Overlap_Exit ;exit ;an000; dms;
1713 ER_Overlap_Error_Exit:
1715 mov ah,EMS_Code94 ;signal error ;an000; dms;
1719 call ER_Restore_Context ;restore context ;an000; dms;
1721 pop dx ;restore regs ;an000; dms;
1723 ret ;return to caller ;an000; dms;
1725 ER_Overlap_Check endp ;end proc ;an000; dms;
1728 ;=========================================================================
1729 ; ER_EMS_Overlap_Check : This routine determines if the source and target
1730 ; EMS regions overlap when both the source and target
1733 ; Inputs : DS:SI - Pointer to Move_Source_Dest_Struc data
1735 ; Outputs : AH - Non-zero on error
1736 ; Possible error codes: 92h
1740 ; If Beg.Src.Add. < Beg.Dst.Add
1741 ; If (End.Src.Add - Beg.Dst.Add) > 0
1747 ; If (End.Dst.Add - Beg.Src.Add) > 0
1753 ;=========================================================================
1755 ER_EMS_Overlap_Check proc ;check for overlap ;an000; dms;
1757 push bx ;save regs ;an000; dms;
1758 push dx ; ;an000; dms;
1760 cmp [si].Source_Memory_Type,ER_EMS_Memory ;Source EMS? ;an000; dms;
1761 jne ER_EMS_Overlap_Exit ;no - exit routine ;an000; dms;
1763 cmp [si].Dest_Memory_Type,ER_EMS_Memory ;Dest. EMS? ;an000; dms;
1764 jne ER_EMS_Overlap_Exit ;no - exit routine ;an000; dms;
1766 mov bx,[si].Source_Handle ;get source handle ;an000; dms;
1767 cmp bx,[si].Dest_Handle ;source = dest? ;an000; dms;
1768 jne ER_EMS_Overlap_Good_Exit ;no - exit routine ;an000; dms;
1770 ER_EMS_Overlap_Calc_N_Ck:
1772 ;**** calc absolute beginning address of source page
1774 mov ax,[si].Source_Initial_Seg_Page ;get start page ;an000; dms;
1775 xor dx,dx ;clear high word ;an000; dms;
1776 mov bx,EMS_Page_Size_In_Bytes ;get page size ;an000; dms;
1777 mul bx ;convert page to abs ;an000; dms;
1779 add ax,[si].Source_Initial_Offset ;add in offset value ;an000; dms;
1780 adc dx,0 ;pick up carry ;an000; dms;
1782 mov cs:[bp].ER_Src_Abs_Beg_Low,ax ;save low word of add
1783 mov cs:[bp].ER_Src_Abs_Beg_High,dx ;save high word of add ;an000; dms;
1785 ;**** calc absolute ending address of source page
1787 add ax,[si].Region_Length_Low_Word ;add in low word of ;an000; dms;
1789 adc dx,[si].Region_Length_High_Word ;add in high word of ;an000; dms;
1791 mov cs:[bp].ER_Src_Abs_End_Low,ax ;save low word of end ;an000; dms;
1792 mov cs:[bp].ER_Src_Abs_End_High,dx ;save high word of end ;an000; dms;
1794 ;**** calc absolute beginning address of dest. page
1796 mov ax,[si].Dest_Initial_Seg_Page ;get start page ;an000; dms;
1797 xor dx,dx ;clear high word ;an000; dms;
1798 mov bx,EMS_Page_Size_In_Bytes ;get page size ;an000; dms;
1799 mul bx ;convert page to abs ;an000; dms;
1801 add ax,[si].Dest_Initial_Offset ;add in offset value ;an000; dms;
1802 adc dx,0 ;pick up carry ;an000; dms;
1804 mov cs:[bp].ER_Dst_Abs_Beg_Low,ax ;save low word of add
1805 mov cs:[bp].ER_Dst_Abs_Beg_High,dx ;save high word of add ;an000; dms;
1807 ;**** calc absolute ending address of dest. page
1809 add ax,[si].Region_Length_Low_Word ;add in low word of ;an000; dms;
1811 adc dx,[si].Region_Length_High_Word ;add in high word of ;an000; dms;
1813 mov cs:[bp].ER_Dst_Abs_End_Low,ax ;save low word of end ;an000; dms;
1814 mov cs:[bp].ER_Dst_Abs_End_High,dx ;save high word of end ;an000; dms;
1816 ;**** Actual test for overlap - corresponds to algorithm above
1818 call ER_General_Overlap_Test ;test for overlap ;an000; dms;
1819 jnc ER_EMS_Overlap_Good_Exit ;no error ;an000; dms;
1821 ER_EMS_Overlap_Error_Exit:
1823 mov ah,EMS_Code92 ;signal error ;an000; dms;
1824 jmp ER_EMS_Overlap_Exit ;exit ;an000; dms;
1826 ER_EMS_Overlap_Good_Exit:
1828 xor ah,ah ;no error ;an000; dms;
1830 ER_EMS_Overlap_Exit:
1832 pop dx ;restore regs ;an000; dms;
1833 pop bx ; ;an000; dms;
1835 ret ;return to caller ;an000; dms;
1837 ER_EMS_Overlap_Check endp ;end proc ;an000; dms;
1840 ;=========================================================================
1841 ; ER_General_Overlap_Test:This routine determines if the source and target
1842 ; EMS regions overlap when both the source and target
1845 ; Inputs : ER_Src_Abs_Beg_Low - Low word of beginning trf area of source
1846 ; ER_Src_Abs_Beg_High - High word of beginning trf area of source
1848 ; ER_Src_Abs_End_Low - Low word of ending trf area of source
1849 ; ER_Src_Abs_End_High - High word of ending trf area of source
1851 ; : ER_Dst_Abs_Beg_Low - Low word of beginning trf area of dest.
1852 ; ER_Dst_Abs_Beg_High - High word of beginning trf area of dest.
1854 ; ER_Dst_Abs_End_Low - Low word of ending trf area of dest.
1855 ; ER_Dst_Abs_End_High - High word of ending trf area of dest.
1857 ; Outputs : NC - no overlap
1862 ; If Beg.Src.Add. < Beg.Dst.Add
1863 ; If (End.Src.Add - Beg.Dst.Add) > 0
1869 ; If (End.Dst.Add - Beg.Src.Add) > 0
1875 ;=========================================================================
1877 ER_General_Overlap_Test proc ; ;an000; dms;
1879 push ax ;save regs ;an000; dms;
1880 push bx ; ;an000; dms;
1881 push cx ; ;an000; dms;
1882 push dx ; ;an000; dms;
1884 mov ax,cs:[bp].ER_Src_Abs_Beg_High ;get source beg. add. ;an000; dms;
1885 mov bx,cs:[bp].ER_Src_Abs_Beg_Low ; ;an000; dms;
1886 mov cx,cs:[bp].ER_Dst_Abs_Beg_High ;get dest. beg. add. ;an000; dms;
1887 mov dx,cs:[bp].ER_Dst_Abs_Beg_Low ; ;an000; dms;
1888 call ER_Dword_Compare ;
1889 ; $if c ;< dest. beg. add.? ;an000; dms;
1891 mov ax,cs:[bp].ER_Src_Abs_End_Low ;get end address ;an000; dms;
1892 mov dx,cs:[bp].ER_Src_Abs_End_High ; ;an000; dms;
1893 sub ax,cs:[bp].ER_Dst_Abs_Beg_Low ;End.Src.Add-Beg.Dst.Add;an000; dms;
1894 sbb dx,cs:[bp].ER_Dst_Abs_Beg_High ; ;an000; dms;
1895 ; $if ns ;yes - overlap ;an000; dms;
1897 stc ;signal error ;an000; dms;
1898 mov cs:[bp].ER_Direction_Flag,ER_Down ;signal reverse move ;an000; dms;
1899 ; $else ;no - not sure yet ;an000; dms;
1902 clc ;signal no overlap ;an000; dms;
1903 mov cs:[bp].ER_Direction_Flag,ER_Up ;forward move ;an000; dms;
1904 ; $endif ; ;an000; dms;
1906 ; $else ;not sure if src < dst ;an000; dms;
1909 mov ax,cs:[bp].ER_Dst_Abs_End_Low ;get end address ;an000; dms;
1910 mov dx,cs:[bp].ER_Dst_Abs_End_High ; ;an000; dms;
1911 sub ax,cs:[bp].ER_Src_Abs_Beg_Low ;End.Dst.Add-Beg.Src.Add;an000; dms;
1912 sbb dx,cs:[bp].ER_Src_Abs_Beg_High ; ;an000; dms;
1913 ; $if ns ;yes - overlap ;an000; dms;
1915 stc ;signal error ;an000; dms;
1916 mov cs:[bp].ER_Direction_Flag,ER_Up ;forward move ;an000; dms;
1917 ; $else ;no - not sure yet ;an000; dms;
1920 clc ;signal no overlap ;an000; dms;
1921 mov cs:[bp].ER_Direction_Flag,ER_Up ;forward move ;an000; dms;
1922 ; $endif ; ;an000; dms;
1924 ; $endif ; ;an000; dms;
1927 pop dx ;restore regs ;an000; dms;
1928 pop cx ; ;an000; dms;
1929 pop bx ; ;an000; dms;
1930 pop ax ; ;an000; dms;
1932 ret ;return to caller ;an000; dms;
1934 ER_General_Overlap_Test endp ;end proc ;an000; dms;
1937 ;=========================================================================
1938 ; ER_Dword_Compare : This routine determines whether or not a dword
1939 ; value is greater than another dword value.
1941 ; Inputs : AX - Source high word
1942 ; BX - Source low word
1943 ; CX - Destination high word
1944 ; DX - Destination low word
1946 ; Outputs : NC - source >= destination
1947 ; CY - source < destination
1948 ;=========================================================================
1950 ER_Dword_Compare proc ; ;an000; dms;
1952 cmp ax,cx ;src high < dest high? ;an000; dms;
1953 ; $if b ;yes ;an000; dms;
1955 stc ;signal less than ;an000; dms;
1956 ; $else ;no ;an000; dms;
1959 cmp ax,cx ;src high > dest high? ;an000; dms;
1960 ; $if a ;yes ;an000; dms;
1962 clc ;signal greater than ;an000; dms;
1963 ; $else ;no ;an000; dms;
1966 cmp bx,dx ;src low < dest low? ;an000; dms;
1967 ; $if b ;yes ;an000; dms;
1969 stc ;signal less than ;an000; dms;
1970 ; $else ;no ;an000; dms;
1973 cmp bx,dx ;src low > dest low? ;an000; dms;
1974 ; $if a ;yes ;an000; dms;
1976 clc ;signal greater than ;an000; dms;
1977 ; $else ;no ;an000; dms;
1981 ; $endif ; ;an000; dms;
1983 ; $endif ; ;an000; dms;
1985 ; $endif ; ;an000; dms;
1987 ; $endif ; ;an000; dms;
1992 ER_Dword_Compare endp ; ;an000; dms;
1996 ;=========================================================================
1997 ; ER_Segment_Adjust : This routine adjusts the segment:offset to a value
1998 ; with an offset less than 16.
2000 ; Inputs : AX:DX - Segment:Offset to be adjusted
2002 ; Outputs : AX:DX - New Segment:Offset value
2003 ;=========================================================================
2005 ER_Segment_Adjust proc ;adjust segment value ;an000; dms;
2007 push bx ;save bx ;an000; dms;
2008 push cx ; ;an000; dms;
2010 mov bx,ax ;save segment value ;an000; dms;
2011 mov ax,dx ;get offset ;an000; dms;
2012 xor dx,dx ;clear high word ;an000; dms;
2013 mov cx,ER_10h ;divide by 10h ;an000; dms;
2014 div cx ;get seg adjustment ;an000; dms;
2016 add ax,bx ;adjust segment up ;an000; dms;
2017 ; dx contains new off. ;an000; dms;
2018 pop cx ;restore regs ;an000; dms;
2019 pop bx ;restore bx ;an000; dms;
2021 ret ;return to caller ;an000; dms;
2023 ER_Segment_Adjust endp ;end proc ;an000; dms;
2026 ;=========================================================================
2027 ; ER_Log_Page_Test : This routine checks the offset specified for
2028 ; the logical page to determine if the offset is
2029 ; within the valid ranges for the page size.
2031 ; Inputs : DS:SI - Pointer to Move_Source_Dest_Struc data
2033 ; Outputs : AH - Non-zero on error
2034 ; Possible error codes: 95h
2035 ;=========================================================================
2037 ER_Log_Page_Test proc ; ;an000; dms;
2039 mov ax,EMS_Page_Size_In_Bytes ;get page size ;an000; dms;
2041 cmp [si].Source_Memory_Type,ER_EMS_Memory ;EMS memory specified? ;an000; dms;
2042 jne ER_Log_Dest_Test ;no - check dest. ;an000; dms;
2044 cmp ax,[si].Source_Initial_Offset ;> EMS page size ;an000; dms;
2045 jae ER_Log_Good_Exit ;good exit ;an000; dms;
2046 jmp ER_Log_Error_Exit ;error - bad exit ;an000; dms;
2050 cmp [si].Dest_Memory_Type,ER_EMS_Memory ;EMS memory specified? ;an000; dms;
2051 jne ER_Log_Good_Exit ;good exit ;an000; dms;
2053 cmp ax,[si].Dest_Initial_Offset ;> EMS page size ;an000; dms;
2054 jae ER_Log_Good_Exit ;good exit ;an000; dms;
2058 mov ah,EMS_Code95 ;signal error ;an000; dms;
2059 jmp ER_Log_Exit ;exit routine ;an000; dms;
2063 xor ah,ah ;signal no error ;an000; dms;
2067 ret ;return to caller ;an000; dms;
2069 ER_Log_Page_Test endp ;end proc ;an000; dms;
2071 ;=========================================================================
2072 ; ER_Save_Context : This routine saves the context for page frames
2073 ; needed for the move/exchange.
2077 ; Outputs : ER_Save_Context_Buffer - save context for the needed page frames
2078 ;=========================================================================
2080 ER_Save_Context proc ;save contexts ;an000; dms;
2082 push ax ;save regs ;an000; dms;
2083 push cx ; ;an000; dms;
2084 push di ; ;an000; dms;
2085 push si ; ;an000; dms;
2086 push ds ; ;an000; dms;
2087 push es ; ;an000; dms;
2089 mov ax,cs ;make ds/es = cs ;an000; dms;
2090 mov ds,ax ; ;an000; dms;
2091 mov es,ax ; ;an000; dms;
2093 mov si,offset cs:Map_Table ;ptr to page frame table;an000; dms;
2094 mov di,offset cs:ER_Save_Context_Buffer ;get dest. offset
2095 add di,bp ;offset BP relative ;an000; dms;
2097 mov cx,2 ;default frame save ;an000; dms;
2098 cli ;ints off ;an000; dms;
2099 cmp Map_Count,2 ;2 page frames? ;an000; dms;
2100 jae ER_Save_Context_Loop ;< = 2 - continue ;an000; dms;
2101 mov cx,Map_Count ;max frame count to save;an000; dms;
2103 ER_Save_Context_Loop:
2105 sti ;ints on ;an000; dms;
2106 push cx ;save cx ;an000; dms;
2107 mov cx,Type Mappable_Phys_Page_Struct ;get byte count to trf ;an000; dms;
2108 cli ;ints off ;an000; dms;
2109 rep movsb ;perform save ;an000; dms;
2110 sti ;ints on ;an000; dms;
2111 pop cx ;restore cx ;an000; dms;
2112 loop ER_Save_Context_Loop ;continue ;an000; dms;
2116 pop es ;restore regs ;an000; dms;
2117 pop ds ; ;an000; dms;
2118 pop si ; ;an000; dms;
2119 pop di ; ;an000; dms;
2120 pop cx ; ;an000; dms;
2121 pop ax ; ;an000; dms;
2123 ret ;return to caller ;an000; dms;
2125 ER_Save_Context endp ;end proc ;an000; dms;
2128 ;=========================================================================
2129 ; ER_Restore_Context : This routine restores the context for page frames
2130 ; saved. These pages were used for the
2131 ; move/exchange requested.
2133 ; Inputs : ER_Save_Context_Buffer - contains saved context
2135 ; Outputs : restored context for the saved page frames
2136 ;=========================================================================
2138 ER_Restore_Context proc ;restore contexts ;an000; dms;
2140 push ax ;save regs ;an000; dms;
2141 push cx ; ;an000; dms;
2142 push di ; ;an000; dms;
2143 push si ; ;an000; dms;
2144 push ds ; ;an000; dms;
2145 push es ; ;an000; dms;
2147 mov ax,cs ;make ds/es = cs ;an000; dms;
2148 mov ds,ax ; ;an000; dms;
2149 mov es,ax ; ;an000; dms;
2151 mov di,offset cs:Map_Table ;ptr to page frame table;an000; dms;
2152 mov si,offset cs:ER_Save_Context_Buffer ;get dest. offset
2153 add si,bp ;offset BP relative ;an000; dms;
2155 mov cx,2 ;default frame restore ;an000; dms;
2156 cli ;ints off ;an000; dms;
2157 cmp Map_Count,2 ;2 page frames? ;an000; dms;
2158 jae ER_Restore_Context_Loop ;< = 2 - continue ;an000; dms;
2159 mov cx,Map_Count ;max frame count to rest;an000; dms;
2161 ER_Restore_Context_Loop:
2163 sti ;ints on ;an000; dms;
2164 mov al,byte ptr ds:[si].Phys_Page_Number ;get physical page num. ;an000; dms;
2165 mov bx,word ptr ds:[si].PPM_Log_Page ;get logical page num. ;an000; dms;
2166 mov dx,word ptr ds:[si].PPM_Handle ;get handle number ;an000; dms;
2167 call Map_L_To_P ;map in orig. page ;an000; dms;
2169 push cx ;save cx ;an000; dms;
2170 mov cx,Type Mappable_Phys_Page_Struct ;get byte count to trf ;an000; dms;
2171 cli ;ints off ;an000; dms;
2172 rep movsb ;perform save ;an000; dms;
2173 sti ;ints on ;an000; dms;
2174 pop cx ;restore cx ;an000; dms;
2175 loop ER_Restore_Context_Loop ;continue ;an000; dms;
2179 pop es ;restore regs ;an000; dms;
2180 pop ds ; ;an000; dms;
2181 pop si ; ;an000; dms;
2182 pop di ; ;an000; dms;
2183 pop cx ; ;an000; dms;
2184 pop ax ; ;an000; dms;
2186 ret ;return to caller ;an000; dms;
2188 ER_Restore_Context endp ;end proc ;an000; dms;
2192 ;=========================================================================
2193 ; ER_Det_Src_Dest_Seg : This routine determines the applicable segment,
2194 ; offset, and page to be used for the move/exchange.
2195 ; This routine sets the pages/addresses to the end
2196 ; of the area to be moved/exchanged, if the move
2197 ; is to be a reverse move. If the move is to be
2198 ; a forward move, the pages/addresses are set to
2199 ; the beginning of the area to be moved/exchanged.
2200 ; In this way an overlapping move can be
2201 ; performed without overlaying data it is to move.
2203 ; Inputs : DS:SI - Pointer to Move_Source_Dest_Struc data
2205 ; Outputs : ER_Source_Seg - Segment value of source
2206 ; ER_Dest_Seg - Segment value of destination
2208 ; ER_Source_Off - Offset value of source
2209 ; ER_Dest_Off - Offset value of destination
2211 ; ER_Source_Page - Source EMS page
2212 ; ER_Dest_Page - Destination EMS page
2214 ; ER_Source_Handle - Source handle
2215 ; ER_Dest_Handle - Destination handle
2217 ; ER_Source_Phys_Page - Physical page number
2218 ; ER_Dest_Phys_Page - Physical page number
2219 ;=========================================================================
2221 ER_Det_Src_Dest_Seg proc ; ;an000; dms;
2223 push ax ;save regs ;an000; dms;
2224 push bx ; ;an000; dms;
2225 push cx ; ;an000; dms;
2226 push dx ; ;an000; dms;
2227 push di ; ;an000; dms;
2228 push ds ; ;an000; dms;
2229 push es ; ;an000; dms;
2232 cmp [si].Source_Memory_Type,ER_EMS_Memory ;EMS? ;an000; dms;
2233 jne ER_Det_Source_Conv ;no - conventional mem. ;an000; dms;
2235 mov di,offset cs:ER_Save_Context_Buffer ;get addressibility to ;an000; dms;
2236 ; the page frame save
2238 add di,bp ;offset BP relative
2239 mov ax,cs:[di].Phys_Page_Segment ;get seg value ;an000; dms;
2240 mov cs:[bp].ER_Source_Seg,ax ;save it in variable ;an000; dms;
2242 mov ax,[si].Source_Handle ;get source handle ;an000; dms;
2243 mov cs:[bp].ER_Source_Handle,ax ;save handle ;an000; dms;
2245 cmp cs:[bp].ER_Direction_Flag,ER_Down ;reverse move? ;an000; dms;
2246 ; $if e ;yes ;an000; dms;
2248 mov ax,[si].Region_Length_Low_Word ;get low word of move ;an000; dms;
2249 mov dx,[si].Region_Length_High_Word ;get high word ;an000; dms;
2250 add ax,[si].Source_Initial_Offset ;pick up offset value ;an000; dms;
2251 adc dx,0 ;pick up carry ;an000; dms;
2252 mov bx,4000h ;get page size ;an000; dms;
2253 div bx ;get end logical page ;an000; dms;
2254 add ax,[si].Source_Initial_Seg_Page ;adjust it for 1st. ;an000; dms;
2255 mov cs:[bp].ER_Source_Page,ax ;save log. page ;an000; dms;
2256 dec dx ;adjust to end point ;an000; dms;
2257 mov cs:[bp].ER_Source_Off,dx ;save offset in last pg ;an000; dms;
2259 ; $else ;forward move ;an000; dms;
2262 mov ax,[si].Source_Initial_Seg_Page ;get page ;an000; dms;
2263 mov dx,[si].Source_Initial_Offset ;get offset ;an000; dms;
2264 mov cs:[bp].ER_Source_Page,ax ;save page ;an000; dms;
2265 mov cs:[bp].ER_Source_Off,dx ;save offset ;an000; dms;
2266 ; $endif ; ;an000; dms;
2268 mov ax,cs:[di].Phys_Page_Number ;get phys. page ;an000; dms;
2269 mov cs:[bp].ER_Source_Phys_Page,ax ;save it ;an000; dms;
2270 jmp ER_Det_Dest_Check ;jump to dest check ;an000; dms;
2274 cmp cs:[bp].ER_Direction_Flag,ER_Down ;reverse move? ;an000; dms;
2275 ; $if e ;yes ;an000; dms;
2277 mov ax,[si].Region_Length_Low_Word ;get low word of move ;an000; dms;
2278 mov dx,[si].Region_Length_High_Word ;get high word ;an000; dms;
2279 mov bx,ER_10h ;get bytes/para ;an000; dms;
2280 div bx ;get para count ;an000; dms;
2283 mov bx,ax ;save across adjust call;an000; dms;
2284 mov cx,dx ; ;an000; dms;
2285 mov ax,[si].Source_Initial_Seg_Page ;get seg value ;an000; dms;
2286 mov dx,[si].Source_Initial_Offset ;get off value ;an000; dms;
2287 dec dx ;adjust to end byte
2288 call ER_Segment_Adjust ;adjust it downward ;an000; dms;
2289 add ax,bx ;new segment value ;an000; dms;
2290 add dx,cx ;new offset value ;an000; dms;
2292 mov cs:[bp].ER_Source_Seg,ax ;save it in variable ;an000; dms;
2293 mov cs:[bp].ER_Source_Off,dx ;save offset in var ;an000; dms;
2294 ; $else ;forward move ;an000; dms;
2297 mov ax,[si].Source_Initial_Seg_Page ;get seg value ;an000; dms;
2298 mov dx,[si].Source_Initial_Offset ;get off value ;an000; dms;
2299 mov cs:[bp].ER_Source_Seg,ax ;save it in variable ;an000; dms;
2300 mov cs:[bp].ER_Source_Off,dx ;save offset in var ;an000; dms;
2301 ; $endif ; ;an000; dms;
2307 cmp [si].Dest_Memory_Type,ER_EMS_Memory ;Dest. EMS? ;an000; dms;
2308 jne ER_Det_Dest_Conv ;no - conventional mem. ;an000; dms;
2310 mov di,offset cs:ER_Save_Context_Buffer ;save frame buffer ;an000; dms;
2311 add di,bp ;offset BP relative ;an000; dms;
2312 cli ;ints off ;an000; dms;
2313 cmp Map_Count,1 ;> 1 page frame? ;an000; dms;
2314 sti ;ints on ;an000; dms;
2315 jb ER_Det_Dest_Check1 ;don't adjust pointer ;an000; dms;
2316 add di,Type Mappable_Phys_Page_Struct ;next entry in save buf ;an000; dms;
2320 mov ax,cs:[di].Phys_Page_Segment ;get seg value ;an000; dms;
2321 mov cs:[bp].ER_Dest_Seg,ax ;save it in variable ;an000; dms;
2323 mov ax,[si].Dest_Handle ;get dest. handle ;an000; dms;
2324 mov cs:[bp].ER_Dest_Handle,ax ;save handle ;an000; dms;
2326 cmp cs:[bp].ER_Direction_Flag,ER_Down ;reverse move? ;an000; dms;
2327 ; $if e ;yes ;an000; dms;
2329 mov ax,[si].Region_Length_Low_Word ;get low word of move ;an000; dms;
2330 mov dx,[si].Region_Length_High_Word ;get high word ;an000; dms;
2331 add ax,[si].Dest_Initial_Offset ;pick up offset value ;an000; dms;
2332 adc dx,0 ;pick up carry ;an000; dms;
2334 mov bx,4000h ;get page size ;an000; dms;
2335 div bx ;get end logical page ;an000; dms;
2336 add ax,[si].Dest_Initial_Seg_Page ;adjust it for 1st. ;an000; dms;
2337 mov cs:[bp].ER_Dest_Page,ax ;save log. page ;an000; dms;
2338 dec dx ;adjust to end point ;an000; dms;
2339 mov cs:[bp].ER_Dest_Off,dx ;save off. in last page ;an000; dms;
2341 ; $else ;forward move ;an000; dms;
2344 mov ax,[si].Dest_Initial_Seg_Page ;get page ;an000; dms;
2345 mov dx,[si].Dest_Initial_Offset ;get offset ;an000; dms;
2346 mov cs:[bp].ER_Dest_Page,ax ;save log. page ;an000; dms;
2347 mov cs:[bp].ER_Dest_Off,dx ;save off. in last page ;an000; dms;
2348 ; $endif ; ;an000; dms;
2350 mov ax,cs:[di].Phys_Page_Number ;get phys page number ;an000; dms;
2351 mov cs:[bp].ER_Dest_Phys_Page,ax ;save it ;an000; dms;
2352 jmp ER_Det_Exit ;exit routine ;an000; dms;
2356 cmp cs:[bp].ER_Direction_Flag,ER_Down ;reverse move? ;an000; dms;
2357 ; $if e ;yes ;an000; dms;
2359 mov ax,[si].Region_Length_Low_Word ;get low word of move ;an000; dms;
2360 mov dx,[si].Region_Length_High_Word ;get high word ;an000; dms;
2361 mov bx,ER_10H ;get bytes/para ;an000; dms;
2362 div bx ;get para count ;an000; dms;
2365 mov bx,ax ;save across adjust call;an000; dms;
2366 mov cx,dx ; ;an000; dms;
2367 mov ax,[si].Dest_Initial_Seg_Page ;get seg value ;an000; dms;
2368 mov dx,[si].Dest_Initial_Offset ;get off value ;an000; dms;
2369 dec dx ;adjust to end byte ;an000; dms;
2370 call ER_Segment_Adjust ;adjust it downward ;an000; dms;
2371 add ax,bx ;new segment value ;an000; dms;
2372 add dx,cx ;new offset value ;an000; dms;
2374 mov cs:[bp].ER_Dest_Seg,ax ;save it in variable ;an000; dms;
2375 mov cs:[bp].ER_Dest_Off,dx ;save offset in var ;an000; dms;
2376 ; $else ;forward move ;an000; dms;
2379 mov ax,[si].Dest_Initial_Seg_Page ;get seg value ;an000; dms;
2380 mov dx,[si].Dest_Initial_Offset ;get off value ;an000; dms;
2381 mov cs:[bp].ER_Dest_Seg,ax ;save it in variable ;an000; dms;
2382 mov cs:[bp].ER_Dest_Off,dx ;save offset in var ;an000; dms;
2383 ; $endif ; ;an000; dms;
2389 pop es ;restore regs ;an000; dms;
2390 pop ds ; ;an000; dms;
2391 pop di ; ;an000; dms;
2392 pop dx ; ;an000; dms;
2393 pop cx ; ;an000; dms;
2394 pop bx ; ;an000; dms;
2395 pop ax ; ;an000; dms;
2397 ret ;return to caller ;an000; dms;
2399 ER_Det_Src_Dest_Seg endp ;end proc ;an000; dms;
2402 ;=========================================================================
2403 ; ER_Det_Move_Count : This initializes the count variables for the
2404 ; loop iteration counter of the move/exchange.
2406 ; Inputs : DS:SI - Pointer to Move_Source_Dest_Struc data
2408 ; Outputs : ER_Move_Count_Low - low word value of move count
2409 ; ER_Move_Count_High - high word value of move count
2410 ;=========================================================================
2413 ER_Det_Move_Count proc ; ;an000; dms;
2415 push ax ;save regs ;an000; dms;
2416 push dx ; ;an000; dms;
2418 mov ax,[si].Region_Length_Low_Word ;get low word count ;an000; dms;
2419 mov dx,[si].Region_Length_High_Word ;get high word count ;an000; dms;
2420 mov cs:[bp].ER_Move_Count_Low,ax ;save low word ;an000; dms;
2421 mov cs:[bp].ER_Move_Count_High,dx ;save high word ;an000; dms;
2423 pop dx ;restore regs ;an000; dms;
2424 pop ax ; ;an000; dms;
2426 ret ;return to caller ;an000; dms;
2428 ER_Det_Move_Count endp ;end proc ;an000; dms;
2430 ;=========================================================================
2431 ; ER_Move_Source_To_Buffer : This routine moves the source data to
2432 ; the buffer before it is transferred to
2433 ; its final destination.
2435 ; Inputs : BP - carries type of memory for source/dest
2436 ; Bit 0 - Destination (EMS if set)
2437 ; Bit 1 - Source (EMS if set)
2439 ; Outputs : ER_Move_Xchg_Buffer1 - Source data
2440 ;=========================================================================
2442 ER_Move_Source_To_Buffer proc ; ;an000; dms;
2444 push ax ;save regs ;an000; dms;
2445 push bx ; ;an000; dms;
2446 push dx ; ;an000; dms;
2447 push di ; ;an000; dms;
2448 push es ; ;an000; dms;
2450 test cs:[bp].ER_Mem_Type,ER_Source_EMS_Memory;Source EMS? ;an000; dms;
2451 jz ER_Move_Source_Conv_Mem ;no - adjust seg:off ;an000; dms;
2452 jmp ER_Move_Source_EMS_Mem ;yes- continue move ;an000; dms;
2454 ER_Move_Source_Conv_Mem:
2456 cmp cs:[bp].ER_Direction_Flag,ER_Down ;reverse move? ;an000; dms;
2457 ; $if e ;yes ;an000; dms;
2459 mov ax,ds ;adjust segment:off ;an000; dms;
2460 dec ax ;segment - 1 para ;an000; dms;
2461 mov ds,ax ; ;an000; dms;
2462 add si,ER_10H ;adjust offset for 1 ;an000; dms;
2463 ; $else ;forward move ;an000; dms;
2466 mov ax,ds ;get segment value ;an000; dms;
2467 mov dx,si ;get offset value ;an000; dms;
2468 call ER_Segment_Adjust ;adjust the seg:off ;an000; dms;
2469 mov ds,ax ;restore ds ;an000; dms;
2470 mov si,dx ;restore offset ;an000; dms;
2471 ; $endif ; ;an000; dms;
2473 jmp ER_Move_Source_Count ;determine count ;an000; dms;
2475 ER_Move_Source_EMS_Mem:
2478 cmp cs:[bp].ER_Direction_Flag,ER_Down ;reverse move? ;an000; dms;
2479 ; $if e ;yes ;an000; dms;
2481 cmp si,0ffffh ;beginning of log page ;an000; dms;
2482 ; $if e ;yes ;an000; dms;
2484 dec cs:[bp].ER_Source_Page ;adjust page ptr ;an000; dms;
2485 mov si,EMS_Page_Size_In_Bytes;get page size ;an000; dms;
2486 ; $endif ; ;an000; dms;
2488 ; $else ;forward move ;an000; dms;
2491 cmp si,4000h ;wrap beyond page ;an000; dms;
2492 ; $if e ;yes ;an000; dms;
2494 inc cs:[bp].ER_Source_Page ;adjust page ptr ;an000; dms;
2495 xor si,si ;clear si ;an000; dms;
2496 ; $endif ; ;an000; dms;
2498 ; $endif ; ;an000; dms;
2500 mov bx,cs:[bp].ER_Source_Page ;pass page to map ;an000; dms;
2501 call ER_Map_Next_Src_Page ;no - map in current pg;an000; dms;
2503 ER_Move_Source_Count:
2505 mov cx,ER_10H ;default count ;an000; dms;
2506 cmp cs:[bp].ER_Move_Count_High,0 ;high word set ;an000; dms;
2507 jne ER_Move_Source_High_Set ;yes - use default ;an000; dms;
2508 cmp cs:[bp].ER_Move_Count_Low,cx ;>= 10h bytes ;an000; dms;
2509 jae ER_Move_Source_High_Set ;yes - use default ;an000; dms;
2510 mov cx,cs:[bp].ER_Move_Count_Low ;no - use last few bytes;an000; dms;
2512 ER_Move_Source_High_Set:
2514 cmp cs:[bp].ER_Direction_Flag,ER_Down ;reverse move? ;an000; dms;
2515 ; $if e ;yes ;an000; dms;
2517 cmp si,di ;source >= dest? ;an000; dms;
2518 ; $if b ;no ;an000; dms;
2520 cmp si,ER_10H ;source >= 10h? ;an000; dms;
2521 ; $if b ;no ;an000; dms;
2523 mov cx,si ;get move count ;an000; dms;
2524 inc cx ;always 1 byte off ;an000; dms;
2525 ; $endif ; ;an000; dms;
2527 ; $else ;source >= dest ;an000; dms;
2530 cmp di,ER_10H ;dest >= 10h? ;an000; dms;
2531 ; $if b ;no ;an000; dms;
2533 mov cx,di ;get move count ;an000; dms;
2534 inc cx ;always 1 byte off ;an000; dms;
2535 ; $endif ; ;an000; dms;
2537 ; $endif ; ;an000; dms;
2539 ; $else ;forward move ;an000; dms;
2542 cmp si,di ;source >= dest? ;an000; dms;
2543 ; $if a ;yes ;an000; dms;
2545 mov ax,4000h ;get end of page ;an000; dms;
2546 sub ax,si ;get bytes remaining ;an000; dms;
2547 cmp ax,ER_10H ;source >= 10h ;an000; dms;
2548 ; $if b ;no ;an000; dms;
2550 mov cx,ax ;get remaining count ;an000; dms;
2551 ; $endif ; ;an000; dms;
2553 ; $else ;source >= dest ;an000; dms;
2556 mov ax,4000h ;get end of page ;an000; dms;
2557 sub ax,di ;get bytes remaining ;an000; dms;
2558 cmp ax,ER_10H ;dest >= 10h ;an000; dms;
2559 ; $if b ;no ;an000; dms;
2561 mov cx,ax ;get remaining count ;an000; dms;
2562 ; $endif ; ;an000; dms;
2564 ; $endif ; ;an000; dms;
2566 ; $endif ; ;an000; dms;
2569 jmp ER_Move_Source_Default_Count ;continue routine ;an000; dms;
2571 ER_Move_Source_Default_Count:
2573 mov cs:[bp].ER_Current_Move_Count,cx ;save current move cnt ;an000; dms;
2575 sub cs:[bp].ER_Move_Count_Low,cx ;get new count ;an000; dms;
2576 sbb cs:[bp].ER_Move_Count_High,0 ;pick up borrow ;an000; dms;
2578 mov ax,cs ;get seg for buffer ;an000; dms;
2579 mov es,ax ;put into es ;an000; dms;
2580 mov di,offset cs:ER_Move_Xchg_Buffer1 ;offset of buffer ;an000; dms;
2581 add di,bp ;offset BP relative ;an000; dms;
2583 cmp cs:[bp].ER_Direction_Flag,ER_Down ;reverse move? ;an000; dms;
2584 ; $if e ;yes ;an000; dms;
2586 add di,ER_10H ;end of buffer + 1 ;an000; dms;
2587 dec di ;end of buffer ;an000; dms;
2588 ; $endif ; ;an000; dms;
2592 cmp cs:[bp].ER_Direction_Flag,ER_Down ;reverse move? ;an000; dms;
2593 ; $if e ;yes ;an000; dms;
2595 std ;reverse move ;an000; dms;
2596 ; $else ;forward move ;an000; dms;
2600 ; $endif ; ;an000; dms;
2602 cli ;ints off ;an000; dms;
2603 rep movsb ;move the data ;an000; dms;
2604 sti ;ints on ;an000; dms;
2606 ER_Move_Source_Exit:
2608 pop es ;restore regs ;an000; dms;
2609 pop di ; ;an000; dms;
2610 pop dx ; ;an000; dms;
2611 pop bx ; ;an000; dms;
2612 pop ax ; ;an000; dms;
2614 ret ;return to caller ;an000; dms;
2616 ER_Move_Source_To_Buffer endp ;end proc ;an000; dms;
2619 ;=========================================================================
2620 ; ER_Move_Buffer_To_Dest : This routine moves the data in the buffer
2621 ; to the destination specified by the user.
2623 ; Inputs : BP - carries type of memory for source/dest
2624 ; Bit 0 - Destination (EMS if set)
2625 ; Bit 1 - Source (EMS if set)
2626 ; ER_Move_Xchg_Buffer1 - Source data
2628 ; Outputs : Adjusted segment:offset or page/offset
2629 ;=========================================================================
2631 ER_Move_Buffer_To_Dest proc ; ;an000; dms;
2633 push ax ;save regs ;an000; dms;
2634 push bx ; ;an000; dms;
2635 push dx ; ;an000; dms;
2636 push si ; ;an000; dms;
2637 push ds ; ;an000; dms;
2639 test cs:[bp].ER_Mem_Type,ER_Dest_EMS_Memory ;Source EMS? ;an000; dms;
2640 jz ER_Move_Buffer_Conv_Mem ;no - adjust seg:off ;an000; dms;
2641 jmp ER_Move_Buffer_EMS_Mem ;yes- continue move ;an000; dms;
2643 ER_Move_Buffer_Conv_Mem:
2645 cmp cs:[bp].ER_Direction_Flag,ER_Down ;reverse move? ;an000; dms;
2646 ; $if e ;yes ;an000; dms;
2648 mov ax,es ;adjust segment:off ;an000; dms;
2649 dec ax ;segment - 1 para ;an000; dms;
2650 mov es,ax ; ;an000; dms;
2651 add di,ER_10H ;adjust offset for 1 ;an000; dms;
2652 ; $else ;forward move? ;an000; dms;
2655 mov ax,es ;adjust seg:off ;an000; dms;
2656 mov dx,di ; ;an000; dms;
2657 call ER_Segment_Adjust ; ;an000; dms;
2658 mov es,ax ;new seg:off ;an000; dms;
2659 mov di,dx ; ;an000; dms;
2660 ; $endif ; ;an000; dms;
2663 jmp ER_Move_Buffer_Count ;determine count ;an000; dms;
2665 ER_Move_Buffer_EMS_Mem:
2667 cmp cs:[bp].ER_Direction_Flag,ER_Down ;reverse move? ;an000; dms;
2668 ; $if e ;yes ;an000; dms;
2670 cmp di,0ffffh ;beginning of log page ;an000; dms;
2671 ; $if e ;yes ;an000; dms;
2673 dec cs:[bp].ER_Dest_Page ;next page ;an000; dms;
2674 mov di,EMS_Page_Size_In_Bytes;end of page ;an000; dms;
2675 ; $endif ; ;an000; dms;
2677 ; $else ;forward move ;an000; dms;
2680 cmp di,4000h ;end of page? ;an000; dms;
2681 ; $if e ;yes ;an000; dms;
2683 inc cs:[bp].ER_Dest_Page ;next page ;an000; dms;
2684 xor di,di ;clear di ;an000; dms;
2685 ; $endif ; ;an000; dms;
2687 ; $endif ; ;an000; dms;
2689 mov bx,cs:[bp].ER_Dest_Page ;pass page to map ;an000; dms;
2690 call ER_Map_Next_Dest_Page ;map in the page ;an000; dms;
2692 ER_Move_Buffer_Count:
2694 mov cx,cs:[bp].ER_Current_Move_Count ;get move from source ;an000; dms;
2696 mov ax,cs ;get seg for buffer ;an000; dms;
2697 mov ds,ax ;put into es ;an000; dms;
2698 mov si,offset cs:ER_Move_Xchg_Buffer1 ;offset of buffer ;an000; dms;
2699 add si,bp ;offset BP relative ;an000; dms;
2700 cmp cs:[bp].ER_Direction_Flag,ER_Down ;reverse move? ;an000; dms;
2701 ; $if e ;yes ;an000; dms;
2703 add si,ER_10H ;end of buffer + 1 ;an000; dms;
2704 dec si ;end of buffer ;an000; dms;
2705 ; $endif ; ;an000; dms;
2708 cmp cs:[bp].ER_Direction_Flag,ER_Down ;reverse move? ;an000; dms;
2709 ; $if e ;yes ;an000; dms;
2711 std ;reverse move ;an000; dms;
2712 ; $else ;forward move ;an000; dms;
2716 ; $endif ; ;an000; dms;
2718 cli ;ints off ;an000; dms;
2719 rep movsb ;move the data ;an000; dms;
2720 sti ;ints on ;an000; dms;
2724 pop ds ;restore regs ;an000; dms;
2725 pop si ; ;an000; dms;
2726 pop dx ; ;an000; dms;
2727 pop bx ; ;an000; dms;
2728 pop ax ; ;an000; dms;
2730 ret ;return to caller ;an000; dms;
2732 ER_Move_Buffer_To_Dest endp ;end proc ;an000; dms;
2735 ;=========================================================================
2736 ; ER_Xchg_Source_To_Buffer : This routine moves the source data to
2737 ; the buffer before it is exchanged with
2738 ; the destination data.
2740 ; Inputs : BP - carries type of memory for source/dest
2741 ; Bit 0 - Destination (EMS if set)
2742 ; Bit 1 - Source (EMS if set)
2744 ; Outputs : ER_Move_Xchg_Buffer1 - Source data
2745 ;=========================================================================
2747 ER_Xchg_Source_To_Buffer proc ; ;an000; dms;
2749 push ax ;save regs ;an000; dms;
2750 push bx ; ;an000; dms;
2751 push dx ; ;an000; dms;
2752 push di ; ;an000; dms;
2753 push si ; ;an000; dms;
2754 push ds ; ;an000; dms;
2755 push es ; ;an000; dms;
2757 test cs:[bp].ER_Mem_Type,ER_Source_EMS_Memory;Source EMS? ;an000; dms;
2758 jz ER_Xchg_Source_Conv_Mem ;no - adjust seg:off ;an000; dms;
2759 jmp ER_Xchg_Source_EMS_Mem ;yes- continue move ;an000; dms;
2761 ER_Xchg_Source_Conv_Mem:
2763 mov ax,ds ;adjust segment:off ;an000; dms;
2764 mov dx,si ; ;an000; dms;
2765 call ER_Segment_Adjust ; ;an000; dms;
2766 mov ds,ax ;new segment:off ;an000; dms;
2767 mov si,dx ; ;an000; dms;
2768 jmp ER_Xchg_Source_Count ;determine count ;an000; dms;
2770 ER_Xchg_Source_EMS_Mem:
2772 cmp si,4000h ;beginning of log page ;an000; dms;
2773 je ER_Xchg_Source_EMS_Next ;yes - get next page ;an000; dms;
2774 mov bx,cs:[bp].ER_Source_Page ;pass log. page to call ;an000; dms;
2775 call ER_Map_Next_Src_Page ;no - map in current pg;an000; dms;
2776 jmp ER_Xchg_Source_Count ;get count for move ;an000; dms;
2778 ER_Xchg_Source_EMS_Next:
2780 mov bx,cs:[bp].ER_Source_Page ;pass log. page to call ;an000; dms;
2781 inc bx ; adjusted upward ;an000; dms;
2782 call ER_Map_Next_Src_Page ;map in the page ;an000; dms;
2783 xor si,si ;reinit pointer ;an000; dms;
2785 ER_Xchg_Source_Count:
2787 mov cx,ER_10H ;default count ;an000; dms;
2788 cmp cs:[bp].ER_Move_Count_High,0 ;high word set ;an000; dms;
2789 jne ER_Xchg_Source_High_Set ;yes - use default ;an000; dms;
2790 cmp cs:[bp].ER_Move_Count_Low,cx ;>= 10h bytes ;an000; dms;
2791 jae ER_Xchg_Source_High_Set ;yes - use default ;an000; dms;
2792 mov cx,cs:[bp].ER_Move_Count_Low ;no - use last few bytes;an000; dms;
2794 ER_Xchg_Source_High_Set:
2796 cmp si,di ;source >= dest? ;an000; dms;
2797 ; $if b ;no ;an000; dms;
2799 mov ax,4000h ;get end of page ;an000; dms;
2800 sub ax,si ;get bytes remaining ;an000; dms;
2801 cmp ax,ER_10H ;source >= 10h ;an000; dms;
2802 ; $if b ;no ;an000; dms;
2804 mov cx,ax ;get remaining count ;an000; dms;
2805 ; $endif ; ;an000; dms;
2807 ; $else ;source >= dest ;an000; dms;
2810 mov ax,4000h ;get end of page ;an000; dms;
2811 sub ax,di ;get bytes remaining ;an000; dms;
2812 cmp ax,ER_10H ;dest >= 10h ;an000; dms;
2813 ; $if b ;no ;an000; dms;
2815 mov cx,ax ;get remaining count ;an000; dms;
2816 ; $endif ; ;an000; dms;
2818 ; $endif ; ;an000; dms;
2821 ER_Xchg_Source_Default_Count:
2823 mov cs:[bp].ER_Current_Move_Count,cx ;save current move cnt ;an000; dms;
2825 sub cs:[bp].ER_Move_Count_Low,cx ;get new count ;an000; dms;
2826 sbb cs:[bp].ER_Move_Count_High,0 ;pick up borrow ;an000; dms;
2828 mov ax,cs ;get seg for buffer ;an000; dms;
2829 mov es,ax ;put into es ;an000; dms;
2830 mov di,offset cs:ER_Move_Xchg_Buffer1 ;offset of buffer ;an000; dms;
2831 add di,bp ;offset BP relative ;an000; dms;
2833 cld ;forward move ;an000; dms;
2834 cli ;ints off ;an000; dms;
2835 rep movsb ;move the data ;an000; dms;
2836 sti ;ints on ;an000; dms;
2838 ER_Xchg_Source_Exit:
2840 pop es ;restore regs ;an000; dms;
2841 pop ds ; ;an000; dms;
2842 pop si ; ;an000; dms;
2843 pop di ; ;an000; dms;
2844 pop dx ; ;an000; dms;
2845 pop bx ; ;an000; dms;
2846 pop ax ; ;an000; dms;
2848 ret ;return to caller ;an000; dms;
2850 ER_Xchg_Source_To_Buffer endp ;end proc ;an000; dms;
2853 ;=========================================================================
2854 ; ER_Xchg_Dest_To_Buffer : This routine moves the destination data to
2855 ; the buffer before it is exchanged with
2858 ; Inputs : BP - carries type of memory for source/dest
2859 ; Bit 0 - Destination (EMS if set)
2860 ; Bit 1 - Source (EMS if set)
2862 ; Outputs : ER_Move_Xchg_Buffer2 - Destination data
2863 ;=========================================================================
2865 ER_Xchg_Dest_To_Buffer proc ; ;an000; dms;
2867 push ax ;save regs ;an000; dms;
2868 push bx ; ;an000; dms;
2869 push dx ; ;an000; dms;
2870 push di ; ;an000; dms;
2871 push si ; ;an000; dms;
2872 push ds ; ;an000; dms;
2873 push es ; ;an000; dms;
2875 test cs:[bp].ER_Mem_Type,ER_Dest_EMS_Memory ;Dest EMS? ;an000; dms;
2876 jz ER_Xchg_Dest_Conv_Mem ;no - adjust seg:off ;an000; dms;
2877 jmp ER_Xchg_Dest_EMS_Mem ;yes- continue move ;an000; dms;
2879 ER_Xchg_Dest_Conv_Mem:
2881 mov ax,es ;adjust segment:off ;an000; dms;
2882 mov dx,di ; ;an000; dms;
2883 call ER_Segment_Adjust ; ;an000; dms;
2884 mov es,ax ;new segment:off ;an000; dms;
2885 mov di,dx ; ;an000; dms;
2886 jmp ER_Xchg_Dest_Count ;determine count ;an000; dms;
2888 ER_Xchg_Dest_EMS_Mem:
2890 cmp di,4000h ;beginning of log page ;an000; dms;
2891 je ER_Xchg_Dest_EMS_Next ;yes - get next page ;an000; dms;
2892 mov bx,cs:[bp].ER_Dest_Page ;pass log. page to call ;an000; dms;
2893 call ER_Map_Next_Dest_Page ;no - map in current pg;an000; dms;
2894 jmp ER_Xchg_Dest_Count ;get count for move ;an000; dms;
2896 ER_Xchg_Dest_EMS_Next:
2898 mov bx,cs:[bp].ER_Dest_Page ;pass log. page to call ;an000; dms;
2899 inc bx ; adjusted upward ;an000; dms;
2900 call ER_Map_Next_Dest_Page ;map in the page ;an000; dms;
2901 xor di,di ;reinit pointer ;an000; dms;
2905 mov cx,cs:[bp].ER_Current_Move_Count ;get move count ;an000; dms;
2906 mov ax,es ;get destination seg ;an000; dms;
2907 mov ds,ax ;put into ds for buffer ;an000; dms;
2909 mov si,di ;get destination off ;an000; dms;
2910 mov ax,cs ;get seg for buffer ;an000; dms;
2911 mov es,ax ;put into es ;an000; dms;
2912 mov di,offset cs:ER_Move_Xchg_Buffer2 ;offset of buffer ;an000; dms;
2913 add di,bp ;offset BP relative ;an000; dms;
2915 cld ;forward move ;an000; dms;
2916 cli ;ints off ;an000; dms;
2917 rep movsb ;move the data ;an000; dms;
2918 sti ;ints on ;an000; dms;
2922 pop es ;restore regs ;an000; dms;
2923 pop ds ; ;an000; dms;
2924 pop si ; ;an000; dms;
2925 pop di ; ;an000; dms;
2926 pop dx ; ;an000; dms;
2927 pop bx ; ;an000; dms;
2928 pop ax ; ;an000; dms;
2930 ret ;return to caller ;an000; dms;
2932 ER_Xchg_Dest_To_Buffer endp ;end proc ;an000; dms;
2937 ;=========================================================================
2938 ; ER_Xchg_Buffer_To_Source ; This routine performs the actual exchange
2939 ; from the destination buffer to the source
2942 ; Inputs : BP - carries type of memory for source/dest
2943 ; Bit 0 - Destination (EMS if set)
2944 ; Bit 1 - Source (EMS if set)
2945 ; ER_Move_Xchg_Buffer2 - Destination data
2947 ; Outputs : Adjusted segment:offset or page/offset
2948 ;=========================================================================
2950 ER_Xchg_Buffer_To_Source proc ; ;an000; dms;
2952 push ax ;save regs ;an000; dms;
2953 push bx ; ;an000; dms;
2954 push dx ; ;an000; dms;
2955 push di ; ;an000; dms;
2956 push es ; ;an000; dms;
2958 test cs:[bp].ER_Mem_Type,ER_Source_EMS_Memory;Source EMS? ;an000; dms;
2959 jz ER_Xchg_Buf2_Conv_Mem ;no - adjust seg:off ;an000; dms;
2960 jmp ER_Xchg_Buf2_EMS_Mem ;yes- continue move ;an000; dms;
2962 ER_Xchg_Buf2_Conv_Mem:
2964 mov ax,ds ;adjust segment:off ;an000; dms;
2965 mov dx,si ; ;an000; dms;
2966 call ER_Segment_Adjust ; ;an000; dms;
2967 mov ds,ax ;new segment:off ;an000; dms;
2968 mov si,dx ; ;an000; dms;
2969 jmp ER_Xchg_Buf2_Count ;determine count ;an000; dms;
2971 ER_Xchg_Buf2_EMS_Mem:
2973 cmp si,4000h ;beginning of log page ;an000; dms;
2974 je ER_Xchg_Buf2_EMS_Next ;yes - get next page ;an000; dms;
2975 mov bx,cs:[bp].ER_Source_Page ;pass log. page to call ;an000; dms;
2976 call ER_Map_Next_Src_Page ;no - map in current pg;an000; dms;
2977 jmp ER_Xchg_Buf2_Count ;get count for move ;an000; dms;
2979 ER_Xchg_Buf2_EMS_Next:
2981 inc cs:[bp].ER_Source_Page ;adjust log page ;an000; dms;
2982 mov bx,cs:[bp].ER_Source_Page ;pass log. page to call ;an000; dms;
2983 call ER_Map_Next_Src_Page ;map in the page ;an000; dms;
2984 xor si,si ;reinit pointer ;an000; dms;
2988 mov cx,cs:[bp].ER_Current_Move_Count ;get move count ;an000; dms;
2990 mov ax,ds ;get destination seg ;an000; dms;
2991 mov es,ax ;put into ds for buffer ;an000; dms;
2993 mov di,si ;get destination off ;an000; dms;
2994 add si,cx ;adjust source ptr ;an000; dms;
2995 push si ;save across xchg ;an000; dms;
2996 push ds ; ;an000; dms;
2998 mov ax,cs ;get seg for buffer ;an000; dms;
2999 mov ds,ax ;put into es ;an000; dms;
3000 mov si,offset cs:ER_Move_Xchg_Buffer2 ;offset of buffer ;an000; dms;
3001 add si,bp ;offset BP relative ;an000; dms;
3003 cld ;forward move ;an000; dms;
3004 cli ;ints off ;an000; dms;
3005 rep movsb ;move the data ;an000; dms;
3006 sti ;ints on ;an000; dms;
3008 pop ds ;restore ptr ;an000; dms;
3009 pop si ; ;an000; dms;
3013 pop es ;restore regs ;an000; dms;
3014 pop di ; ;an000; dms;
3015 pop dx ; ;an000; dms;
3016 pop bx ; ;an000; dms;
3017 pop ax ; ;an000; dms;
3019 ret ;return to caller ;an000; dms;
3021 ER_Xchg_Buffer_To_Source endp ;end proc ;an000; dms;
3025 ;=========================================================================
3026 ; ER_Xchg_Buffer_To_Dest ; This routine performs the actual exchange
3027 ; from the source buffer to the destination.
3029 ; Inputs : BP - carries type of memory for source/dest
3030 ; Bit 0 - Destination (EMS if set)
3031 ; Bit 1 - Source (EMS if set)
3032 ; ER_Move_Xchg_Buffer1 - Source data
3034 ; Outputs : Adjusted segment:offset or page/offset
3035 ;=========================================================================
3037 ER_Xchg_Buffer_To_Dest proc ; ;an000; dms;
3039 push ax ;save regs ;an000; dms;
3040 push bx ; ;an000; dms;
3041 push dx ; ;an000; dms;
3042 push si ; ;an000; dms;
3043 push ds ; ;an000; dms;
3045 test cs:[bp].ER_Mem_Type,ER_Dest_EMS_Memory ;Dest EMS? ;an000; dms;
3046 jz ER_Xchg_Buf1_Conv_Mem ;no - adjust seg:off ;an000; dms;
3047 jmp ER_Xchg_Buf1_EMS_Mem ;yes- continue move ;an000; dms;
3049 ER_Xchg_Buf1_Conv_Mem:
3051 mov ax,es ;adjust segment:off ;an000; dms;
3052 mov dx,di ; ;an000; dms;
3053 call ER_Segment_Adjust ; ;an000; dms;
3054 mov es,ax ;new segment:off ;an000; dms;
3055 mov di,dx ; ;an000; dms;
3056 jmp ER_Xchg_Buf1_Count ;determine count ;an000; dms;
3058 ER_Xchg_Buf1_EMS_Mem:
3060 cmp di,4000h ;beginning of log page ;an000; dms;
3061 je ER_Xchg_Buf1_EMS_Next ;yes - get next page ;an000; dms;
3062 mov bx,cs:[bp].ER_Dest_Page ;pass log. page to call ;an000; dms;
3063 call ER_Map_Next_Dest_Page ;no - map in current pg;an000; dms;
3064 jmp ER_Xchg_Buf1_Count ;get count for move ;an000; dms;
3066 ER_Xchg_Buf1_EMS_Next:
3068 inc cs:[bp].ER_Dest_Page ;adjust log page ;an000; dms;
3069 mov bx,cs:[bp].ER_Dest_Page ;pass log. page to call ;an000; dms;
3070 call ER_Map_Next_Dest_Page ;map in the page ;an000; dms;
3071 mov di,EMS_Page_Size_In_Bytes ;reinit pointer ;an000; dms;
3075 mov cx,cs:[bp].ER_Current_Move_Count ;get move count ;an000; dms;
3076 mov ax,cs ;get seg for buffer ;an000; dms;
3077 mov ds,ax ;put into es ;an000; dms;
3078 mov si,offset cs:ER_Move_Xchg_Buffer1 ;offset of buffer ;an000; dms;
3079 add si,bp ;offset BP relative ;an000; dms;
3081 cld ;forward move ;an000; dms;
3082 cli ;ints off ;an000; dms;
3083 rep movsb ;move the data ;an000; dms;
3084 sti ;ints on ;an000; dms;
3088 pop ds ;restore regs ;an000; dms;
3089 pop si ; ;an000; dms;
3090 pop dx ; ;an000; dms;
3091 pop bx ; ;an000; dms;
3092 pop ax ; ;an000; dms;
3094 ret ;return to caller ;an000; dms;
3096 ER_Xchg_Buffer_To_Dest endp ;end proc ;an000; dms;
3100 ;=========================================================================
3101 ; ER_Map_Next_Src_Page : This routine maps in the page needed by
3102 ; the source of the move/exchange.
3104 ; Inputs : ER_Source_Phys_Page - Physical page of source
3105 ; ER_Source_Handle - Handle of source
3108 ; Outputs : newly mapped page
3109 ;=========================================================================
3111 ER_Map_Next_Src_Page proc ;map next src. page ;an000; dms;
3113 mov ax,cs:[bp].ER_Source_Phys_Page ;map the source page ;an000; dms;
3114 mov dx,cs:[bp].ER_Source_Handle ;handle to use ;an000; dms;
3115 call Map_L_To_P ;map the page ;an000; dms;
3117 ret ;return to caller ;an000; dms;
3119 ER_Map_Next_Src_Page endp ;end proc ;an000; dms;
3121 ;=========================================================================
3122 ; ER_Map_Next_Dest_Page : This routine maps in the page needed by
3123 ; the destination of the move/exchange.
3125 ; Inputs : ER_Dest_Phys_Page - Physical page of source
3126 ; ER_Dest_Handle - Handle of source
3127 ; BX - logical page to map
3129 ; Outputs : newly mapped page
3130 ;=========================================================================
3132 ER_Map_Next_Dest_Page proc ;map next dest. page ;an000; dms;
3134 mov ax,cs:[bp].ER_Dest_Phys_Page ;map the dest. page ;an000; dms;
3135 mov dx,cs:[bp].ER_Dest_Handle ;handle to use ;an000; dms;
3136 call Map_L_To_P ;map the page ;an000; dms;
3138 ret ;return to caller ;an000; dms;
3140 ER_Map_Next_Dest_Page endp ;end proc ;an000; dms;
3142 ;=========================================================================
3143 ; ER_Move_Data : This routine will perform the actual move of the
3144 ; data for the function 5700h.
3146 ; Inputs : DS:SI - Pointer to Move_Source_Dest_Struc data
3148 ; Outputs : AH - Non-zero on error
3149 ;=========================================================================
3151 ER_Move_Data proc ;move the data ;an000; dms;
3153 push bx ;save regs ;an000; dms;
3154 push cx ; ;an000; dms;
3155 push dx ; ;an000; dms;
3156 push di ; ;an000; dms;
3157 push si ; ;an000; dms;
3158 push ds ; ;an000; dms;
3159 push es ; ;an000; dms;
3161 call ER_Save_Context ;save off max of 2 pages;an000; dms;
3162 call ER_Det_Src_Dest_Seg ;determine segs ;an000; dms;
3163 call ER_Det_Move_Count ;ER_10h_Move_Count = ;an000; dms;
3165 ;ER_10h_Move_Remainder =
3166 ; # of bytes remaining
3170 ;set the flags to signal
3171 ;the memory type in use
3172 ;for Source/Destination.
3174 xor al,al ;al signals type of mem ;an000; dms;
3175 or al,[si].Source_Memory_Type ;get source memory type ;an000; dms;
3176 shl al,1 ;put into bit 1 ;an000; dms;
3177 or al,[si].Dest_Memory_Type ;get dest. memory type ;an000; dms;
3178 cbw ;make it a word value ;an000; dms;
3179 mov cs:[bp].ER_Mem_Type,ax ;put flags in var ;an000; dms;
3180 ;bp = bit 0 - dest mem
3183 mov di,cs:[bp].ER_Dest_Off ;get dest. offset ;an000; dms;
3184 mov es,cs:[bp].ER_Dest_Seg ;get dest. seg ;an000; dms;
3186 mov si,cs:[bp].ER_Source_Off ;get src. offset ;an000; dms;
3187 mov ds,cs:[bp].ER_Source_Seg ;get src. seg ;an000; dms;
3191 call ER_Move_Source_To_Buffer ;move data to buffer ;an000; dms;
3192 call ER_Move_Buffer_To_Dest ;move buffer to dest. ;an000; dms;
3194 cmp cs:[bp].ER_Move_Count_High,0 ;end of move? ;an000; dms;
3195 jne ER_Move_Data_Loop ;no - continue loop ;an000; dms;
3196 cmp cs:[bp].ER_Move_Count_Low,0 ;end of move? ;an000; dms;
3197 jne ER_Move_Data_Loop ;no - continue loop ;an000; dms;
3198 ;yes - end of loop ;an000; dms;
3200 ER_Move_Data_Error_Exit:
3202 call ER_Restore_Context ;restore the context ;an000; dms;
3204 pop es ;restore regs ;an000; dms;
3205 pop ds ; ;an000; dms;
3206 pop si ; ;an000; dms;
3207 pop di ; ;an000; dms;
3208 pop dx ; ;an000; dms;
3209 pop cx ; ;an000; dms;
3210 pop bx ; ;an000; dms;
3212 ret ;return to caller ;an000; dms;
3214 ER_Move_Data endp ;end proc ;an000; dms;
3218 ;=========================================================================
3219 ; ER_Exchange_Data : This routine will perform the actual exchange of
3220 ; data for the function 5701h.
3222 ; Inputs : DS:SI - Pointer to Move_Source_Dest_Struc data
3224 ; Outputs : AH - Non-zero on error
3225 ;=========================================================================
3227 ER_Exchange_Data proc ;xchg the data ;an000; dms;
3229 push bx ;save regs ;an000; dms;
3230 push cx ; ;an000; dms;
3231 push dx ; ;an000; dms;
3232 push di ; ;an000; dms;
3233 push si ; ;an000; dms;
3234 push ds ; ;an000; dms;
3235 push es ; ;an000; dms;
3237 call ER_Save_Context ;save off max of 2 pages;an000; dms;
3238 call ER_Det_Src_Dest_Seg ;determine segs ;an000; dms;
3239 call ER_Det_Move_Count ;ER_10h_Move_Count = ;an000; dms;
3241 ;ER_10h_Move_Remainder =
3242 ; # of bytes remaining
3246 ;set the flags to signal
3247 ;the memory type in use
3248 ;for Source/Destination.
3250 xor al,al ;al signals type of mem ;an000; dms;
3251 or al,[si].Source_Memory_Type ;get source memory type ;an000; dms;
3252 shl al,1 ;put into bit 1 ;an000; dms;
3253 or al,[si].Dest_Memory_Type ;get dest. memory type ;an000; dms;
3254 cbw ;make it a word value ;an000; dms;
3255 mov cs:[bp].ER_Mem_Type,ax ;put flags in var ;an000; dms;
3256 ;bp = bit 0 - dest mem
3259 mov di,cs:[bp].ER_Dest_Off ;get dest. offset ;an000; dms;
3260 mov es,cs:[bp].ER_Dest_Seg ;get dest. seg ;an000; dms;
3262 mov si,cs:[bp].ER_Source_Off ;get src. offset ;an000; dms;
3263 mov ds,cs:[bp].ER_Source_Seg ;get src. seg ;an000; dms;
3267 call ER_Xchg_Source_To_Buffer ;move source to buf 1 ;an000; dms;
3268 call ER_Xchg_Dest_To_Buffer ;move dest. to buf 2 ;an000; dms;
3269 call ER_Xchg_Buffer_To_Source ;move buf2 to source ;an000; dms;
3270 call ER_Xchg_Buffer_To_Dest ;move buf1 to dest. ;an000; dms;
3272 cmp cs:[bp].ER_Move_Count_High,0 ;end of move? ;an000; dms;
3273 jne ER_Xchg_Data_Loop ;no - continue loop ;an000; dms;
3274 cmp cs:[bp].ER_Move_Count_Low,0 ;end of move? ;an000; dms;
3275 jne ER_Xchg_Data_Loop ;no - continue loop ;an000; dms;
3276 ;yes - end of loop ;an000; dms;
3278 ER_Xchg_Data_Error_Exit:
3280 call ER_Restore_Context ;restore the context ;an000; dms;
3282 pop es ;restore regs ;an000; dms;
3283 pop ds ; ;an000; dms;
3284 pop si ; ;an000; dms;
3285 pop di ; ;an000; dms;
3286 pop dx ; ;an000; dms;
3287 pop cx ; ;an000; dms;
3288 pop bx ; ;an000; dms;
3290 ret ;return to caller ;an000; dms;
3292 ER_Exchange_Data endp ;end proc ;an000; dms;
3298 ;=========================================================================
3299 ;=============== Function 5Ah Logic - Allocate Raw Pages =============
3300 ;=========================================================================
3303 ;=========================================================================
3304 ; Alloc_Raw - This routine allocates raw EMS pages, pages
3305 ; less than the standard 16k page. These pages
3306 ; are a sub-multiple of 16k. In the IBM version
3307 ; of this implementation the raw page is defined
3308 ; as 16k, thus we do not need to do anything
3309 ; special here. We map this call to the proc
3310 ; GET_HANDLE (function 43h) to allocate a handle.
3312 ; Inputs : AH - 5Ah (Allocate Raw Pages)
3313 ; BX - Number of raw pages to allocate
3315 ; Outputs : AH - Non-zero if error (Determined by Get_Handle proc)
3316 ; DX - Handle if no error
3317 ;=========================================================================
3319 Alloc_Raw proc ;Allocate raw pages ;an000; dms;
3325 PUSH DS ;save these registers
3330 ;Remove test for BX = 0. This is @RH4
3331 ; valid under LIM 4.0
3333 cmp al,AR_Sub_Max ;sub function out of range? ;an000; dms;
3334 jna AR_OKSub ;no ;an000; dms;
3335 mov ah,EMS_Code8F ;yes-signal error ;an000; dms;
3336 jmp AR_Exit ;exit routine ;an000; dms;
3340 CMP BX,TOTAL_EMS_PAGES ;Enough total EMS pages?
3346 cli ;ints off ;an000; dms;
3347 CMP BX,FREE_PAGES ;Enough unallocated pages?
3348 sti ;ints on ;an000; dms;
3352 ;-----------------------------------------------------
3353 ; Search for a free handle @RH1 º
3354 ;-----------------------------------------------------
3356 MOV CX,NUM_HANDLES ;loop counter is #handles
3357 DEC CX ;handle 0 reserved for op. sys. @RH1
3358 MOV DX,1 ;handle assignment set to 1 @RH1
3359 MOV DI,TYPE H_LOOKUP_STRUC ;init table index to 1st entry @RH1
3360 ;--------------------------------
3361 CLI ;interrupts OFF during allocation
3362 ;--------------------------------
3364 CMP HANDLE_LOOKUP_TABLE.H_PAGES[DI],REUSABLE_HANDLE
3365 ;Is this handle available? @RH1
3366 JE AR_HFREE ;yes end search dx=handle id @RH1
3367 INC DX ;next handle assignment
3368 ADD DI,TYPE H_LOOKUP_STRUC ;next entry in handle lookup @RH1
3369 ;repeat for all table entries
3371 MOV AH,EMS_CODE85 ;no available handles
3372 JMP AR_EXIT ;go to exit ;GGA
3374 ;-----------------------------------------------------
3375 ; If here then there's enough pages for request. @RH1 º
3376 ; DX = handle #, DI = ptr to hndl lookup entry @RH1 º
3379 MOV CX,NUM_HANDLES ;loop counter
3380 DEC CX ;handle 0 reserved for op. sys. @RH1
3381 ;si = index to hndl lookup tbl @RH1
3382 MOV SI,TYPE H_LOOKUP_STRUC ; for adding pages (skip 0 entry) @RH1
3383 XOR AX,AX ;clear page counter
3384 CLC ;clear carry for addition
3386 CMP HANDLE_LOOKUP_TABLE.H_PAGES[SI],REUSABLE_HANDLE
3387 JE AR_PGSUM_BOT ;If handle is free don't add @RH4
3388 ADD AX,HANDLE_LOOKUP_TABLE.H_PAGES[SI]
3389 ;add lengths (pages) of PALs @RH1
3390 ADD SI,TYPE H_LOOKUP_STRUC ; next entry in handle lookup @RH1
3393 CMP AX,TOTAL_EMS_PAGES ;pages in handle lookup > total? @RH1
3394 JNA AR_CALCHLUP ;no OK @RH1
3395 MOV AH,EMS_CODE80 ;software error..we screwed up @RH1
3396 JMP AR_EXIT ;go to exit @RH1 ;GGA
3398 AR_CALCHLUP: ;calculate entry in hndl lkup tbl @RH1
3399 cmp bx,0 ;page request? ;an000; dms;
3400 jne AR_Alloc_Cont ;yes continue ;an000; dms;
3401 cli ;ints off ;an001; dms;
3402 mov Handle_LookUp_Table.H_Pages[di],bx ;new page count ;an001; dms;
3403 sti ;ints on ;an001; dms;
3404 xor ah,ah ;clear flag ;an000; dms;
3405 jmp AR_Exit ;exit routine ;an000; dms;
3409 cli ;ints off ;an001; dms;
3410 mov cx,bx ;alloc count ;an000; dms;
3411 call EMS_Page_Contig_Chk ;do we have contig pgs. ;an001; dms;
3412 jnc AR_Alloc ;yes continue process ;an001; dms;
3413 mov ah,EMS_Code88 ;no signal error ;an001; dms;
3414 sti ;ints on ;an001; dms;
3415 jmp AR_Exit ;exit routine ;an001; dms;
3419 call EMS_Link_Set ;set up links ;an001; dms;
3422 sub Free_Pages,bx ;free = free - requested pages
3423 mov Handle_LookUp_Table.H_Pages[di],bx ;page count ;an000; dms;
3424 mov Handle_LookUp_Table.H_Pal_Ptr[di],si ;initialize to ptr for ;ac001; dms;
3426 sti ;ints on ;an001; dms;
3427 xor ah,ah ;clear flag ;an000; dms;
3438 ret ;return to caller ;an000; dms;
3440 Alloc_Raw endp ;end proc ;an000; dms;
3443 ;=========================================================================
3444 ;=============== Function 5Ch Logic - Prepare for Warm Boot =============
3445 ;=========================================================================
3448 ;=========================================================================
3449 ; Prepare_Boot - This routine prepares the hardware for a
3450 ; warm boot. Since we have no special hardware
3451 ; requirements at this time, this routine sets
3452 ; a good error level and returns to the caller.
3454 ; Inputs : AH - 5Ch (Prepare for Warm Boot)
3456 ; Outputs : AH - Non-zero if error (Determined by Get_Handle proc)
3457 ;=========================================================================
3459 Prepare_Boot proc ;prepare for warm boot ;an000; dms;
3461 xor ah,ah ;signal no error ;an000; dms;
3463 ret ;return to caller ;an000; dms;
3465 Prepare_Boot endp ;end proc ;an000; dms;