home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / MEMORIA / EMMFOOL1.ZIP / EMMFOOL.8 next >
Encoding:
Text File  |  1990-04-19  |  3.2 KB  |  183 lines

  1. ;
  2. ;  This program allows the print screen interrupt to set up the printer
  3. ;  and then reset it after the screen dump.
  4.  
  5. ;  This file is written to assemble with A86.
  6. ;
  7. ;  9 Dec 1989
  8. ;
  9. ;  Steven Key
  10. ;
  11. ; The command  a86 emmfool.8
  12. ; will produce a com file that will intercept all extended memory calls, and
  13. ; return a version number 4.0 for the call 46h, get version.  All other calls
  14. ; will be ignored.
  15. ;
  16. ;
  17.  
  18. TRUE    =       -1
  19. FALSE    =    0
  20.  
  21. Main:
  22.         Jmp HIHO        ; jump to Terminate code.
  23.  
  24. Already_Mess    db      'Emm foolem  already loaded. $',0d,0a
  25.                 db      'Copyright Steven Key.',0d,0a
  26.  
  27. OurID           = 077
  28. ourstack:       dw      32 dup 0 ; Internal stack for safety.
  29. end_stack:
  30.  
  31. stk_seg         dw      ?       ; Store stack seg here.
  32. stk_ptr         dw      ?       ; Store stack ptr here.
  33. CurrentP        dw      ?       ; current selected printer.
  34.  
  35. OldInt67        label dword far     ; print screen handler.
  36. Oldint67Off     dw      ?
  37. Oldint67Seg     dw      ?
  38.  
  39. Old2f           label dword far     ; print screen handler.
  40. Old2fOff        dw      ?
  41. Old2fSeg        dw      ?
  42.  
  43. ;
  44. ;  This is our own 02f int handler.
  45.  
  46. OurTack:
  47.   cs cmp ah,OurID
  48.   jz Is_Us
  49.   cs jmp  Old2f
  50.  
  51. Is_Us:
  52.   or al,al
  53.   jnz Get_Seg
  54.   mov al,0ff            ; return 0ff if it's us they want.
  55.  
  56. Get_Seg:
  57.   cmp al,1
  58.   jnz Badfunction
  59.   mov es,cs
  60.   iret
  61.  
  62. BadFunction:
  63.   stc
  64.   iret
  65.  
  66. OurTick:                ; this is the resident code.
  67.  
  68.   cmp ah,046
  69.   jne >l1
  70.   mov ax, 0040
  71.   iret
  72. l1:
  73.   cs jmp oldint67
  74.  
  75. pb0port =       061     ; port for speaker bit
  76. errlen1 =     10
  77. errlen2 =     15
  78. errlow  =     55
  79. errhi   =     55
  80.  
  81. ErrBeep:
  82. ;  push ax,bx,cx,dx
  83. ;  mov cx, errlen1
  84. errbeep1:
  85. ;  mov dx,errlow
  86. ;  mov bx,errlen2
  87. ;  call dotone
  88. ;  mov dx,errhi
  89. ;  mov bx,errlen2
  90. ;  call dotone
  91. ;  loop errbeep1
  92. ;  pop dx,cx,bx,ax
  93. ;  ret
  94.  
  95. DoTone:
  96. ;  push ax,bx,cx
  97. ;  in al,pb0port
  98. ;  mov ah,al
  99. ;l1:
  100. ;  and al,0fc
  101. ;  out pb0port,al
  102. ;  mov cx,dx
  103. ;l2:
  104. ;  loop l2
  105. ;  or al,2
  106. ;  out pb0port ,al
  107. ;  mov cx,dx
  108. ;l3:
  109. ;  loop l3
  110. ;  dec bx
  111. ;  jnz l1
  112. ;  out pb0port,al
  113. ;
  114. ;  pop cx,bx,ax
  115. ;  ret
  116.  
  117.  
  118. progsize = $/16
  119.  
  120.  
  121.  
  122. HIHO:
  123. ;
  124. ; See if we are already loaded.
  125.  
  126.   mov ah,OurId
  127.   mov al,0
  128.   int 02f               ; let dos tell us if there is another.
  129.   cmp al,0ff
  130.   jnz Get_PID
  131.   push 0
  132.   pop es
  133.   mov al,1
  134.   mov ah,OurID
  135.   int 02f
  136.   jc Get_PID
  137.   mov bx,es
  138.   cmp bx,0
  139.   jz Get_PID
  140.   jmp Already_loaded
  141.  
  142.  
  143. Get_PID:
  144. ;
  145. ; Let's find our ID, and save it.
  146.  
  147.   mov ah,035
  148.   mov al,067             ; extended memory handler.
  149.   int 021
  150.   mov OldInt67Off, bx
  151.   mov OldInt67Seg, es
  152.  
  153.   mov ah,035
  154.   mov al,02f            ; tsr manager.
  155.   int 021
  156.   mov Old2foff,bx
  157.   mov Old2fseg,es
  158.  
  159.   mov ah,025            ; set vector
  160.   mov al,067            ; extended memory handler.
  161.   mov dx,offset OurTick
  162.   int 021
  163.  
  164.   mov ds,cs             ; put us in the tsr manager chain.
  165.   mov ah,025
  166.   mov al,02f
  167.   mov dx,offset OurTack
  168.   int 021
  169.  
  170.   mov ah,031            ; now tsr
  171.   mov al,0
  172.   mov dx, progsize +1
  173.   int 021
  174.  
  175. Already_Loaded:
  176.   mov dx, offset  Already_Mess
  177.   mov ah,09
  178.   int 021
  179.  
  180.   mov al,2
  181.   mov ah,04c
  182.   int 021
  183.