f19 ;; Test of implementation of the CT-VOICE driver INCLUDE SCREEN.MAC INCLUDE KEYB.MAC INCLUDE CONV.MAC CSEG SEGMENT ASSUME CS:CSEG,DS:CSEG ORG 100h start: jmp begin ;-------------------------------------------------------------------------- stackspace db 32 dup ('STACK ') newstack dw 0 ctv_drv LABEL dword ctv_off dw ? ctv_seg dw ? voc_stat dw ? voc_off1 dw ? voc_seg1 dw ? buf_init PROC NEAR mov bp,sp mov dx,word ptr[bp] mov sp,OFFSET newstack ;New stack pointer mov ah,4aH ;Mshrink mov bx,65535/16 ;Bytes left for program int 21H mov ah,48H ;Allocate memory for driver mov bx,65535/16 int 21H mov word ptr[ctv_seg],ax ;Pointer to allocated segment mov word ptr[ctv_off],0 mov ah,48h ;Allocate memory for voice file mov bx,65535/16 int 21h mov voc_seg1,ax mov voc_off1,0 mov bp,sp mov word ptr[bp],dx ret buf_init ENDP ;---------------------------------------------------------------------------- drv_name db 'CT-VOICE.DRV',0 load_ctv_drv PROC NEAR mov ah,3dh ;Open file mov al,0 mov dx,offset drv_name int 21h xchg ax,bx push ds mov ds,word ptr[ctv_seg] ;Change DS to driver segment mov ah,3fh ;Read driver into memory mov cx,65535 mov dx,00h int 21h pop ds ret load_ctv_drv ENDP ;-------------------------------------------------------------------------- fn_buf db 80,0 vocname db 80 dup(0) fhandle dw 0 dec_buf db 7 dup(0) sampling dw ? count dw ? read_file PROC NEAR Print 'File to play: ' readstr fn_buf mov bp,offset vocname mov si,OFFSET fn_buf+1 ;Remove trailing CR xor dx,dx mov dl,byte ptr[si] mov si,dx mov byte ptr [bp+si],00h mov ah,3dh ;Open file mov al,0 mov dx,offset vocname int 21h jc read_error xchg ax,bx push ds mov ds,voc_seg1 ;Change to Buffer Segment mov ah,3fh ;Read file mov cx,65535 mov dx,00h int 21h pop ds mov count,ax ;Save bytes read in COUNT abort: ret read_error: pushf cr_lf Print 'Error: file not found' cr_lf popf jmp abort read_file ENDP ;------------------------------------------------------------------------ begin: call buf_init call load_ctv_drv call read_file jc not_found mov bx,3 ;Initialize CT-VOICE driver call ctv_drv push cs ;Provide driver with status word pop es mov bx,5 mov di,offset voc_stat call ctv_drv mov bx,4 ;Turn on speaker mov al,0ffh call ctv_drv push es ;Output voice mov es,voc_seg1 ;Segment of voice mov di,1Ah ;Offset (beginning of data block) mov bx,6 call ctv_drv pop es cmp ax,0 jnz error again: cmp voc_stat,0 ;Wait for voice to end jnz again mov bx,9 ;Terminate driver call ctv_drv not_found: cr_lf mov ax,4c00h int 21h error: cr_lf Print 'Error on voice output' jmp not_found CSEG ENDS END start . 0