home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / msj / msjv3_1 / lim4 / start.asm < prev    next >
Encoding:
Assembly Source File  |  1989-03-02  |  2.8 KB  |  102 lines

  1. ; Figure 11
  2. ; ========
  3.  
  4.  
  5. NAME start
  6.  
  7. ; Use the DOSSEG directive to insure that the code segment is the 
  8. ; first segment in the module. Since this piece of code will be 
  9. ; loaded in at the page frame at D000:0000H the map and call use 
  10. ; D000:0000H as the entry point.
  11.  
  12. DOSSEG
  13.  
  14. data SEGMENT PUBLIC 'DATA'
  15. Data  ends
  16.  
  17. CODE SEGMENT PUBLIC 'CODE'
  18.     ASSUME CS:CODE, DS:DATA
  19. start proc far
  20.      push    ds
  21.      PUSH    dx
  22.      mov     DX,data               ; get my data seg into ds
  23.      mov     ds,dx
  24.      pop     dx
  25.      mov     ah, 09                ; set function for dos 
  26.                                    ; display string
  27.      mov     dx, offset enter_msg
  28.      int    21H
  29.  
  30. ;    Use search for handel to find handle
  31.  
  32.      mov    si, offset handle_name
  33.      mov    ax, 5401H              ; set function to serch for 
  34.                                    ; named handle
  35.      int    67H                    ; invoke emm
  36.      or ah, ah
  37.      jnz exit
  38.  
  39. ; DX = handle number     
  40. ;
  41. ;  Set Register for map and call and call EMM with INT 67
  42.  
  43.      mov     si, offset map_call  
  44.      mov     al, 0                 ; indicate that values are pages
  45.      mov     ah, 56H               ; set function to map and call
  46.      int     67H                   ; invoke emm 
  47.      or ah, ah
  48.      jnz exit
  49.      
  50.      mov     ah, 09                ; set function for dos 
  51.                                    ; display string
  52.      mov     dx, offset exit_msg
  53.      int 21H
  54. exit:
  55.      pop     ds
  56.      ret
  57. start endp
  58. CODE ENDS
  59.  
  60. data SEGMENT PUBLIC 'DATA'
  61.  
  62. ; EQUATES
  63.  
  64. cr    equ  0Dh
  65. lf    equ  0AH
  66.  
  67. ; Structures
  68.  
  69. log_phys_map_struct      STRUC
  70.    log_page_number     DW ? 
  71.    phys_page_number    DW ? 
  72. log_phys_map_struct      ENDS
  73.  
  74. map_call_struct      STRUC
  75.     target_address      DD ?       ; Pointer to which EMM will  
  76.                                    ; transfer control 
  77.     new_page_map_length DB ?       ; number new pages to be mapped 
  78.                                    ; on call
  79.     new_page_map_ptr    DD ?       ; pointer to array of 
  80.                                    ; log_phys_map_struc
  81.     old_page_map_length DB ?       ; number of pages to mapped on 
  82.                                    ; return
  83.     old_page_map_ptr    DD ?       ; pointer to array of 
  84.                                    ; log_phys_map_struc
  85.     reseved             DW 4 DUP (?)
  86. map_call_struct ENDS
  87.  
  88. ; Data decalrations
  89.  
  90. new_map  log_phys_map_struct <1,1> ; maping befor call
  91. old_map  log_phys_map_struct <0,0> ; mapping after call
  92.  
  93. map_call  map_call_struct <0D0004000H,1,new_map,1,old_map>
  94.  
  95. handle_name db 'mapcall',0         ; handle name is asciz string                                            
  96. enter_msg   db 'Entering Module 1',cr,lf,'$'
  97. exit_msg    db 'Exiting Module 1',cr,lf,'$'
  98.  
  99. Data  ends
  100.  
  101. end  start
  102.