home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / vrac / babys203.zip / FORPGMRS.EXE / TDSPF.ASM < prev   
Assembly Source File  |  1993-03-08  |  5KB  |  184 lines

  1.  
  2. MODEL SMALL
  3.  
  4. LOCALS
  5. JUMPS
  6.  
  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  8. ; TDSPD.ASM                                                              ;
  9. ;                                                                        ;
  10. ; (C)opyright - Budget Software Company                                  ;
  11. ;                                                                        ;
  12. ; Demonstrates the usage of DSPFILx.                                     ;
  13. ;                                                                        ;
  14. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  15.  
  16. global cpp _dspfil_init_me:far
  17. global cpp _dspfil_request_print:far
  18.  
  19. ;
  20. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  21. ; The following STRUC is passed to _dspfil_init_me
  22. ;
  23. init_dspfil STRUC
  24. original_int8     dd ?
  25. original_int16  dd ?
  26. original_intb    dd ?
  27. original_intc    dd ?
  28. original_intf   dd ?
  29. callback_fred    dd ?
  30. com1_int8_bytes dw ?
  31. com2_int8_bytes dw ?
  32. com3_int8_bytes dw ?
  33. com4_int8_bytes dw ?
  34. lpt1_int8_bytes dw ?
  35. lpt2_int8_bytes dw ?
  36. lpt3_int8_bytes dw ?
  37. lpt4_int8_bytes dw ?
  38. com_port_intb    db ?
  39. com_port_intc    db ?
  40. indicate_bios    db ?
  41. indicate_direct    db ?
  42. nbr_10000ths    dw ?
  43. ENDS
  44. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  45.  
  46. DATASEG
  47.  
  48.  
  49. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  50. ; Create an instance of my_init_dspfil
  51. ;
  52. my_init_dspfil init_dspfil ?
  53. ;
  54.  
  55. testfile db "c:\autoexec.bak",0
  56.  
  57.  
  58.  
  59. CODESEG
  60.  
  61. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  62. CODESEG
  63.     startupcode
  64.  
  65. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  66. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  67. ; Place the required data into my_init_dspctl
  68. ;
  69.        mov ax,@data
  70.        mov ds,ax
  71.     push ds                         ;
  72.     pop es                          ;
  73.     mov ax,0                        ;
  74.     mov ds,ax                       ;
  75.     mov di,offset my_init_dspfil    ;
  76.         mov si,8*4                      ;Get INT8 data.
  77.         mov ax,[si]                     ;
  78.     stosw                           ;
  79.         mov ax,[si+2]                   ;
  80.     stosw                           ;
  81.         mov si,16h*4                    ;Get INT16h data.
  82.         mov ax,[si]                     ;
  83.         stosw                           ;
  84.         mov ax,[si+2]                   ;
  85.         stosw                           ;
  86.         mov ax,0                        ;Don't hook intb.
  87.         mov cx,2                        ;
  88.     rep stosw                       ;
  89.         mov si,0ch*4                    ;get intc data.
  90.         mov ax,[si]                     ;
  91.         stosw                           ;
  92.         mov ax,[si+2]                   ;
  93.         stosw                           ;
  94.         mov ax,0                        ;Don't hook intf.
  95.         mov cx,2                        ;
  96.     rep stosw                       ;
  97.         mov ax,offset dspfil_callback   ;Pass far pointer to my "callback"
  98.     stosw                           ; procedure.
  99.     mov ax,@code                    ;
  100.     stosw                           ;
  101.         mov ax,100                      ;Set each port so that 100 bytes
  102.     mov cx,8                        ; will be attempted in an int8.
  103.     rep stosw                       ; (Only 1 port gets a crack at it
  104.                     ;  during a given timer interrupt.)
  105.     mov al,2                        ;Indicate intb is for COM2.
  106.     stosb                           ; (This isn't really necessary in
  107.                     ;  this example, since I'm not
  108.                     ;  hooking intb.)
  109.     mov al,1                        ;Indicate intc is for COM1.
  110.         stosb                           ;
  111.                                         ;
  112.                                         ;
  113.         mov al,00h                      ;Indicate that no ports should
  114.     stosb                ;  use the BIOS for outputting.
  115.         xor al,0ffh                     ;The opposite for "print directly"
  116.         stosb                           ;
  117.         mov ax,28h      ;;;chg'd        ;Indicate 10  10,000ths of a second
  118.     stosw                ; as the maximum amount of time
  119.                     ; in int8
  120. ;
  121. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  122. ; Call the init routine.
  123. ;
  124.  
  125.         mov ax,@data                    ;
  126.     mov ds,ax                       ;
  127.     mov dx,@data            ;Point DX:AX to STRUC.
  128.     mov ax,offset my_init_dspfil    ;
  129.  
  130.     call _dspfil_init_me            ;Init me
  131.  
  132.  
  133. ;
  134. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  135. ; Send a file for LPT1 printing.
  136.  
  137.         mov dx,@data
  138.         mov ax,offset testfile
  139.         mov bh,8
  140.         mov cl,'y'
  141.         call _dspfil_request_print
  142. ;
  143. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  144. ; Send a file for COM1 printing. (using int 1ah)
  145. ;
  146.         mov ah,0e4h
  147.         mov al,2
  148.         mov cl,1
  149.         mov dx,@data
  150.         mov es,dx
  151.         mov bx,offset testfile
  152.         int 1ah
  153.  
  154. ;
  155. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  156. ; T and SR
  157. ;
  158.  
  159.         mov dx,offset e_o_pgm
  160.         add dx,offset e_o_pgm_data
  161.     shr dx,4
  162.         add dx,10h
  163.         mov ah,31h
  164.         mov al,0
  165.         int 21h
  166.  
  167. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  168. ; when a file is done, it will callback here
  169. dspfil_callback proc CPP far
  170.         nop
  171.         nop
  172.         ret
  173.  
  174. e_o_pgm:
  175.  
  176. DATASEG
  177.  
  178. e_o_pgm_data label byte
  179.  
  180. ENDP
  181.  
  182.  
  183. END
  184.