当前位置: 代码迷 >> 汇编语言 >> 问一下,为什么小弟我一调用声音程序就显示除法溢出呢
  详细解决方案

问一下,为什么小弟我一调用声音程序就显示除法溢出呢

热度:8923   发布时间:2013-02-26 00:00:00.0
问一下,为什么我一调用声音程序就显示除法溢出呢
音乐数据段
;*****************************************************
 MDATA_SEG SEGMENT PARA
;======================================================================================
mus_freq dw 659,659,659,523,659,20000,784,20000,392
dw 20000,523,20000,392,20000,330,20000,440
dw 494,494,440,392,659,784,880,20000,698,784
dw 20000,659,20000,523,587,494,20000,523,20000,392,20000
dw 20000,330,20000,440,494,20000,494,440,20000,392,659
dw 784,880,698,784,20000,659,587,523,494
dw 20000,784,698,698,659,659,392,440,523,20000
dw 440,523,587,20000,784,698,698,659,20000,659,1046

mus_time dw 20,20,20,10,10,6,20,6,20
dw 6,10,6,10,6,10,6,20
dw 20,10,20,20,20,20,10,10,6,10,10
dw 6,10,6,10,10,20,6,10,6,10,6
dw 6,10,6,20,10,6,10,20,6,10,20
dw 20,20,20,20,6,20,10,10,40
dw 6,20,10,10,20,20,10,20,20,6
dw 10,10,20,6,10,10,20,20,6,20,20
dw 20,20,6,6,10,10,10,20,10
dw 6,10,10,20,10,10,6,10,6,10,6
dw 20,6,10,6,6,6,10
dw 6,10,10,10,6,10,6,10,10,20,6,10,10,10
dw 6,10,10,10,20,6,10,6,10,6,20,20
dw 6,6,10,10,10,10,6,20,10,10
dw 6,10,6,10,10,10,6,6,10,6,6,10,6
dw 20,6,6,6,10,10,6,10,6
dw 10,10,6,10,6,10,6,10,40,6,10,20
dw 6,10,6,10,10,10,6

dw 6,10,10,6,10,6,10,10,6,6,6
dw 6,20,6,20,6,20,6,20
dw 6,20,20,20,20,20,10,10,6,10
dw 6,10,20,6,10,6,10,20,20,6,10,6
dw 6,10,6,40,20,20,6,10,20
dw 20,20,10,10,6,10,10,6,10,6,10,10
dw 20,6,10,10,6,10,10,10,20
dw 6,10,20,6,10,20,20,10,20,6,40
dw 20,20,20,20,6,6,10,10,6,20
dw 6,10,10,10,6,10,40,6,10,20
dw 6,10,20,10,10,6,10,20,6,10,20,6
;======================================================================================
 MDATA_SEG ENDS
beepit PROC NEAR ; 定义意外事件声音
  MOV DI,800 ;定义声音频率
  MOV BX,100
  CALL beep ;定义延迟时间
  RET
beepit ENDP
beep PROC NEAR
  PUSH AX
  PUSH BX
  PUSH CX
  PUSH DX
  PUSH DI
  MOV AL,0b6h
  OUT 43h,AL
  MOV DX,12h
  MOV AX,348
  DIV DI
  OUT 42h,AL
  MOV AL,AH
  OUT 42h,AL
  IN AL,61h
  MOV AH,AL
  OR AL,3
  OUT 61h,AL
WAIT1: MOV CX,630
delay: LOOP delay
  DEC BX
  JNZ WAIT1
  MOV AL,AH
  OUT 61h,AL  
  POP DI
  POP DX
  POP CX
  POP BX
  POP AX
  RET
beep ENDP

;-------------------------------------------------------
music PROC NEAR
  ret`
  MOV DX,SEG mdata_seg ; mdata_seg
  MOV DS,DX
  LEA SI,mus_freq
  LEA BP,DS: mus_time
freq: MOV DI,[SI]
  CMP DI,-1
  JE END_mus
  MOV BX,DS:[BP]
  CALL beep
  ADD SI,2
  ADD BP,2
  JMP freq
END_mus:  
  RET  
music ENDP

------解决方案--------------------------------------------------------
  相关解决方案