data segment ioport equ 0c800h-0280h;选择工作方式 adcin2 equ ioport + 029ah dac equ ioport + 0290h io8255a equ ioport + 0288h;8255A; io8255ctl equ ioport + 028bh;8255写控制字地址 io8253a equ ioport + 0280h;8253A io8253ctl equ ioport + 0283h;8253写控制字地址 msg1 db 'The radio will be recorded,press y to start:',0ah,0dh,'$' msg2 db 'The radio will be play the record,press y to begin:',0ah,0dh,'$' msg3 db 'Continue?',0ah,0dh,'$' msg4 db 30000 dup(?) data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax message1: mov dx,offset msg1 mov ah,09h int 21h ;输出录音提示 mov ah,01h int 21h ;检测按键是否按下 cmp al,'y' ;无则返回提示信息 jne message1 call record1 ;调用录音子程序 message2: mov dx,offset msg2 mov ah,09h int 21h mov ah,01h int 21h cmp al,'y' jne exit ;没有按键则返回提示信息 call play ;调用播放子程序 exit: ;退出程序 mov ah,4ch int 21h delay proc ;时延子程序 push ax push dx mov dx,io8255ctl mov al,10010000B out dx,al ;初始化程序 mov dx,io8253ctl mov al,00010000b out dx,al mov dx,io8253a ;8253方式0设置计数200个 mov al,200 out dx,al mov dx,io8255a delay1: in al,dx test al,01h ;检测PAO是否为1 jz delay1 pop dx pop ax ret delay endp record1 proc ;录音子程序 push dx mov di,offset msg4 ;置数据区首地址 mov cx,30000 mov dx,adcin2 again1: out dx,al call delay ;时延 in al,dx mov [di],al inc di loop again1 pop dx ret record1 endp play proc ;播放子程序 push dx mov cx,30000 ;计数 mov dx,dac mov si,offset msg4 ;置数据区首址 again: mov al,[si] out dx,al call delay inc si ;自加1 loop again ;延时 pop dx ret play endp code ends end start
转载自原文链接, 如需删除请联系管理员。
原文链接:数字录音机,转载请注明来源!
相关推荐