1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 ; MACRO definitions for expanded memory manager
5 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7 ; 1. MACRO to save mapping context in case somebody else has
8 ; mapped the page registers.
10 save_mapping_context
macro
11 local save_agn_m
,save_err_m
,save_ok_m
,save_exit_m
13 ; the save mapping call for the above board -->
19 ; on return ax = 0 signifies success
22 push ax ; save registers
25 ; set up emm registers and execute call to save mapping context
28 mov dx,cs:[above_pid
] ; get emm handle
29 mov ah,above_save_map_pid
; save map call
30 int 67h
; call the manager
31 or ah,ah ; is there an error?
32 jz save_ok_m
; if not we are done
34 ; error in saving mapping context, check for error
36 cmp ah,above_error_busy
; if the emm manager was busy
37 jz save_agn_m
; we would like to try again
39 ; unrecoverable error, indicate error type in al
42 pop dx ; pop the regs off the stack
44 mov al,0aah ; drive not ready
45 cmp ah,above_error_cntxt_no_stack
;
47 cmp ah,above_error_second_save
;
49 mov al,0bbh ; general failure
56 pop ax ; restore registers
60 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
62 ; 2. MACRO to restore the mapping context saved earlier
64 restore_mapping_context
macro
65 local rest_agn_m
, rest_ok_m
, rest_exit_m
67 ; the restore above map call -->
79 mov dx,cs:[above_pid
] ; get emm handle
80 mov ah,above_restore_map_pid
; restore map call
81 int 67h
; call manager
82 or ah,ah ; is there any error
83 jz rest_ok_m
; if not go to finish up
85 ; error condition, check for recoverable error
87 cmp ah,above_error_busy
; if manager was busy
88 jz rest_agn_m
; we sure can try again
89 cmp ah,above_error_no_cntxt
;
90 jz rest_ok_m
; ignore invalid pid error
96 mov al,0bbh ; general failure
107 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
109 ; 3. MACRO to map a page in the physical page map onto a logical
112 ; the map above page requires
115 ; mov al,physical_page# (0-3)
116 ; mov bx,logical_page#
118 ; ah = 0 success and this routine zaps ax,dx and bx
121 local map_agn_m
,map_exit_m
,map_fin_m
123 mov ah,above_map
; function map page
124 mov dx,cs:[above_pid
] ; get emm handle
132 push dx ; "damn call above_map zaps these registers"
138 or ah,ah ; is there an error?
139 jz map_fin_m
; if not go to finish up
141 ; error condition - check for recoverable error
143 cmp ah,above_error_busy
; if manager was busy
144 jz map_agn_m
; we sure can try again
146 ; unrecoverable error
149 mov al,0aah ; device not ready error
161 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
165 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
167 ; 1) MACRO to switch es:di with ds:si
169 src_dest_switch
macro
180 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;