]> git.sur5r.net Git - cc65/blob - libsrc/creativision/psg.s
Cleanups for Creativision.
[cc65] / libsrc / creativision / psg.s
1 ; void __fastcall__ psg_outb( unsigned char b );
2 ; void __fastcall__ psg_delayms( unsigned char c);
3 ; void __fastcall__ bios_playsound( void *b, unsigned char c);
4 ; void psg_silence( void );
5
6         .export          _psg_outb, _psg_silence, _psg_delay
7         .export          _bios_playsound
8         .import          popa
9         .include        "creativision.inc"
10
11 _psg_outb:
12
13         ;* Let BIOS output the value
14         jmp $FE77
15
16 _psg_silence:
17
18         jmp $FE54
19
20
21 _psg_delay:
22
23         tay
24 l1:     lda #200
25 l2:     sbc #1
26         bne l2
27
28         lda #200
29 l3:     sbc #1
30         bne l3
31
32         dey
33         bne l1
34
35         rts
36
37
38 ;* Creativision Sound Player
39 ;*
40 ;* Based on BIOS sound player.
41 ;* Pass a pointer to a set of note triples, terminated with a tempo byte
42 ;* and the len (max 255)
43
44 _bios_playsound:
45
46         pha                     ; Save Length Byte
47         sei
48
49         lda         #$D5        ; BIOS volume table low
50         sta         $4
51         lda         #$FC        ; BIOS volume table high
52         sta         $5
53
54         jsr         popa        ; Get Sound table pointer low
55         sta         $0
56         jsr         popa        ; Get Sound table pointer high
57         sta         $1
58
59         pla
60         tay                     ; Put length in Y
61         dey
62         php
63         jmp         $FBED       ; Let BIOS do it's thing