pato-z80-home-computer/assembly/bios/drivers/sn76489.asm

51 lines
1.1 KiB
NASM
Raw Normal View History

; TI SN76489 sound chip display driver
; @author Daniele Verducci
;
; USAGE:
; call Snd_init <-- inits sound (and silences default tone)
; call Snd_beep <-- system beep
; Sound card is on port 0
SND_DATA_REG: EQU IO_0
; Init device (silence all channels)
; Bits meaning:
; 1 R0 R1 R2 A0 A1 A2 A3
; Bit0 is 1
; Bit1,2,3 select the channel: 001, 011, 101, 111(noise)
; Bit4,5,6,7 selecy the attenuation (0000=full volume, 1111=silent)
Snd_init:
; silence ch1
ld a,%11111001
;ld a,%10011111
out (SND_DATA_REG),a
; silence ch2
ld a,%11111101
;ld a,%10111111
out (SND_DATA_REG),a
; silence ch3
ld a,%11111011
;ld a,%11011111
out (SND_DATA_REG),a
; silence noise ch
ld a,%11111111
out (SND_DATA_REG),a
ret
Snd_beep:
; ch1 max volume
ld a,%10010000
out (SND_DATA_REG),a
; play beep freq
ld a,%10000000
out (SND_DATA_REG),a
ld a,%00001000
out (SND_DATA_REG),a
; wait 1 sec
ld bc, 10
call Time_delay55
; silence ch1
ld a,%10011111
out (SND_DATA_REG),a
ret