⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 daiziqindaima.txt

📁 本文件提供的是8255控制扬声器发音实验的源代码
💻 TXT
字号:
tack segment stack
      dw 256(?)
stack ends
data  segment
f     dw 3030h,2551h,2272h,2012h,1908h,2551h,1908h,2272h,2551h,3030h,3030h,3816h,2865h, 2272h
a     dw ?
e     db 2,2,2,2,8,8,12,2,2,4,2,2,4,4
 d     equ $-e
data  ends
code segment
assume cs:code,ds:data,ss:stack,es:data
start:
          mov ax,data
      mov ds,ax
      mov dx,303h    
      mov al,80h
      out dx,al
      mov dx,307h    
      mov al,77h
      out dx,al
      
      mov si,offset f
      mov di,offset e
      mov cx,d
music:
      
      mov bl,[di]
      inc di
      cmp cx,0
      dec cx
      je start
     ; push ax          ;判断有无按键
      mov ah,11
      int 21h
      cmp al,0
;pop ax
      jne speakoff
      mov ax,[si]
      mov dx,305h      ;写计数初值
      out dx,al
      xchg ah,al
      out dx,al
mov dx,303h      
      mov al,01h
      out dx,al
      mov al,03h        
      out dx,al
inc si
    inc si
call delay
     mov dx,303h       
      mov al,0h
      out dx,al
      mov al,02h
out dx,al
   ;   inc di
   ;   inc si
    ;  inc si
      jmp music
speakoff:
         mov dx,303h
         mov al,0h
         out dx,al
         mov al,02h
         out dx,al
         mov ax,4c00h
         int 21h
delay proc
        push bx
        push ax
        mov ax,351ch
        int 21h
        mov a,bx
        pop ax
        pop bx
        cli
        push dx
        push ax
        push ds
        mov dx,seg new1ch
        mov ds,dx
        mov dx,offset new1ch
        mov ax,251ch
        int 21h
        pop ds
        pop ax
        pop dx
        sti
  de:   cmp bl,0
        jne de
        cli
        push ax
        push dx
        mov ax,251ch
        mov dx,es
push ds

        mov ds,dx
        mov dx,a
        int 21h
        sti
pop ds
        pop  dx
        pop  ax
        ret
delay   endp
new1ch  proc
        dec bl
        iret
new1ch  endp
code ends
end start 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -