OpenCores
URL https://opencores.org/ocsvn/psg16/psg16/trunk

Subversion Repositories psg16

[/] [psg16/] [trunk/] [software/] [code snippets/] [Beep.asm] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 robfinch
PSG                     EQU             0xFFFF_FFFF_FFD5_0000
2
PSGFREQ0        EQU             0xFFFF_FFFF_FFD5_0000
3
PSGPW0          EQU             0xFFFF_FFFF_FFD5_0002
4
PSGCTRL0        EQU             0xFFFF_FFFF_FFD5_0004
5
PSGADSR0        EQU             0xFFFF_FFFF_FFD5_0006
6
 
7
;--------------------------------------------------------------------------
8
; Sound a 800 Hz beep
9
;--------------------------------------------------------------------------
10
;
11
Beep:
12
        subui   sp,sp,#16
13
        sm              [sp],r1/lr
14
        ori             r1,r0,#15               ; master volume to max
15
        sc              r1,PSG+128
16
        ori             r1,r0,#13422    ; 800Hz
17
        sc              r1,PSGFREQ0
18
        ; decay  (16.384 ms)2
19
        ; attack (8.192 ms)1
20
        ; release (1.024 s)A
21
        ; sustain level C
22
        setlo   r1,#0xCA12
23
        sc              r1,PSGADSR0
24
        ori             r1,r0,#0x1104   ; gate, output enable, triangle waveform
25
        sc              r1,PSGCTRL0
26
        ori             r1,r0,#25000000 ; delay about 1s
27
beep1:
28
        loop    r1,beep1
29
        ori             r1,r0,#0x0104   ; gate off, output enable, triangle waveform
30
        sc              r1,PSGCTRL0
31
        ori             r1,r0,#25000000 ; delay about 1s
32
beep2:
33
        loop    r1,beep2
34
        ori             r1,r0,#0x0000   ; gate off, output enable off, no waveform
35
        sc              r1,PSGCTRL0
36
        lm              [sp],r1/lr
37
        ret             #16
38
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.