home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / emm501s.zip / EMM501.ASM next >
Assembly Source File  |  1993-05-11  |  2KB  |  62 lines

  1. ;
  2. ; EMM501.ASM        v1.0
  3. ;
  4. ; Purpose:          Disable Clipper S'87->5.01a from using EMS
  5. ;                   in situations where the pageframe is not
  6. ;                   present or the EMM driver is disabled.
  7. ;
  8. ; Written by Malc.
  9. ;
  10. ; masm emm501 /ml;
  11. ; tasm emm501 /ml;
  12. ; optasm emm501 /ml;
  13. ;
  14. ;
  15. ;
  16. .model large
  17.  
  18. public   __e_avail
  19.  
  20. .code
  21.  
  22. __e_avail proc      far
  23.           push      bp
  24.           mov       bp,sp
  25.           push      ds
  26.           push      si
  27.           push      di
  28.           mov       al,67h                      ; Int 67
  29.           mov       ah,35h                      ; Get vector address function
  30.           int       21h                         ; Get handler address
  31.           mov       di,0ah                      ; Offset 10 in driver header
  32.           push      cs                          ; Segment of string
  33.           pop       ds                          ; Set up segment
  34.           mov       si,offset cs:sig            ; Signature to match
  35.           cld                                   ; Forwards
  36.           mov       cx,4                        ; Number of words
  37.           rep       cmpsw                       ; Compare them
  38.           jnz       fail                        ; No match
  39.           mov       ah,41h                      ; Get pageframe address
  40.           int       67h                         ; Call driver
  41.           or        ah,ah                       ; Was there an error
  42.           jnz       fail                        ; Yes - no pageframe
  43.           mov       ah,42h                      ; Get number of pages
  44.           int       67h                         ; Call driver
  45.           or        ah,ah                       ; Was there an error
  46.           jnz       fail                        ; Yes, so no ems
  47.           mov       al,10h                      ; Multiply by 16
  48.           mul       bx                          ; Gives number of KB available
  49.           jmp       short done                  ; All done
  50. fail:
  51.           xor       ax,ax                       ; Indicate no ems available
  52. done:
  53.           pop       di
  54.           pop       si
  55.           pop       ds
  56.           pop       bp
  57.           ret
  58. __e_avail endp
  59. sig       db        'EMMXXXX0'
  60.           end
  61.  
  62.