80x86微机原理与接口技术实验指导书 下载本文

MOV AX,4240H

DIV WORD PTR [SI] ;取出频率值计算计数初值,0F4240H / 输出频率 MOV DX,MY8254_COUNT0 OUT DX,AL ;装入计数初值 MOV AL,AH OUT DX,AL

MOV DL,[DI] ;取出演奏相对时间,调用延时子程序 CALL DALLY ADD SI,2 INC DI

CMP WORD PTR [SI],0 ;判断是否到曲末? JE BEGIN JMP PLAY

DALLY PROC ;延时子程序 D0: MOV CX,0010H D1: MOV AX,0F00H D2: DEC AX

JNZ D2 LOOP D1 DEC DL JNZ D0 RET

DALLY ENDP CODE ENDS

END START

CMP BL, 00H JNE AA4 CALL DELAYL JMP AA0 DELAY: PUSH CX MOV CX, 0100H DLAY1: LOOP DLAY1 POP CX RET

DELAYL: PUSH CX MOV CX, 0010H DL1: CALL DELAY LOOP DL1 POP CX RET CODE ENDS END START