]> git.sur5r.net Git - cc65/blob - libsrc/creativision/psg.s
Initial Creativision Import
[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:     
25     lda #200
26 l2:
27     sbc #1
28     bne l2
29     
30     lda #200
31 l3:
32     sbc #1
33     bne l3
34     
35     dey
36     bne l1
37     
38     rts
39     
40
41 ;* Creativision Sound Player
42 ;*
43 ;* Based on BIOS sound player.
44 ;* Pass a pointer to a set of note triples, terminated with a tempo byte
45 ;* and the len (max 255)
46
47 _bios_playsound:
48
49     pha                 ; Save Length Byte
50     
51     sei
52         
53     lda         #$D5    ; BIOS volume table low
54     sta         $4
55     lda         #$FC    ; BIOS volume table high
56     sta         $5
57     
58     jsr         popa    ; Get Sound table pointer low
59     sta         $0
60     jsr         popa    ; Get Sound table pointer high
61     sta         $1
62     
63     pla
64     tay                 ; Put length in Y
65     dey
66     php
67     jmp         $fbed   ; Let BIOS do it's thing
68