home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 19
/
CD_ASCQ_19_010295.iso
/
vrac
/
babys203.zip
/
FORPGMRS.EXE
/
TDSPF.ASM
< prev
Wrap
Assembly Source File
|
1993-03-08
|
5KB
|
184 lines
MODEL SMALL
LOCALS
JUMPS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; TDSPD.ASM ;
; ;
; (C)opyright - Budget Software Company ;
; ;
; Demonstrates the usage of DSPFILx. ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
global cpp _dspfil_init_me:far
global cpp _dspfil_request_print:far
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The following STRUC is passed to _dspfil_init_me
;
init_dspfil STRUC
original_int8 dd ?
original_int16 dd ?
original_intb dd ?
original_intc dd ?
original_intf dd ?
callback_fred dd ?
com1_int8_bytes dw ?
com2_int8_bytes dw ?
com3_int8_bytes dw ?
com4_int8_bytes dw ?
lpt1_int8_bytes dw ?
lpt2_int8_bytes dw ?
lpt3_int8_bytes dw ?
lpt4_int8_bytes dw ?
com_port_intb db ?
com_port_intc db ?
indicate_bios db ?
indicate_direct db ?
nbr_10000ths dw ?
ENDS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DATASEG
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Create an instance of my_init_dspfil
;
my_init_dspfil init_dspfil ?
;
testfile db "c:\autoexec.bak",0
CODESEG
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CODESEG
startupcode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Place the required data into my_init_dspctl
;
mov ax,@data
mov ds,ax
push ds ;
pop es ;
mov ax,0 ;
mov ds,ax ;
mov di,offset my_init_dspfil ;
mov si,8*4 ;Get INT8 data.
mov ax,[si] ;
stosw ;
mov ax,[si+2] ;
stosw ;
mov si,16h*4 ;Get INT16h data.
mov ax,[si] ;
stosw ;
mov ax,[si+2] ;
stosw ;
mov ax,0 ;Don't hook intb.
mov cx,2 ;
rep stosw ;
mov si,0ch*4 ;get intc data.
mov ax,[si] ;
stosw ;
mov ax,[si+2] ;
stosw ;
mov ax,0 ;Don't hook intf.
mov cx,2 ;
rep stosw ;
mov ax,offset dspfil_callback ;Pass far pointer to my "callback"
stosw ; procedure.
mov ax,@code ;
stosw ;
mov ax,100 ;Set each port so that 100 bytes
mov cx,8 ; will be attempted in an int8.
rep stosw ; (Only 1 port gets a crack at it
; during a given timer interrupt.)
mov al,2 ;Indicate intb is for COM2.
stosb ; (This isn't really necessary in
; this example, since I'm not
; hooking intb.)
mov al,1 ;Indicate intc is for COM1.
stosb ;
;
;
mov al,00h ;Indicate that no ports should
stosb ; use the BIOS for outputting.
xor al,0ffh ;The opposite for "print directly"
stosb ;
mov ax,28h ;;;chg'd ;Indicate 10 10,000ths of a second
stosw ; as the maximum amount of time
; in int8
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Call the init routine.
;
mov ax,@data ;
mov ds,ax ;
mov dx,@data ;Point DX:AX to STRUC.
mov ax,offset my_init_dspfil ;
call _dspfil_init_me ;Init me
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Send a file for LPT1 printing.
mov dx,@data
mov ax,offset testfile
mov bh,8
mov cl,'y'
call _dspfil_request_print
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Send a file for COM1 printing. (using int 1ah)
;
mov ah,0e4h
mov al,2
mov cl,1
mov dx,@data
mov es,dx
mov bx,offset testfile
int 1ah
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; T and SR
;
mov dx,offset e_o_pgm
add dx,offset e_o_pgm_data
shr dx,4
add dx,10h
mov ah,31h
mov al,0
int 21h
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; when a file is done, it will callback here
dspfil_callback proc CPP far
nop
nop
ret
e_o_pgm:
DATASEG
e_o_pgm_data label byte
ENDP
END