Skip to content

Commit

Permalink
Added simple example files for SCMonitor and BASIC
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Langseth committed Oct 31, 2018
1 parent 517006c commit bf55e21
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Examples/descend.bas
@@ -0,0 +1,16 @@
1 REM Output decending tones on channel A
10 R=51 : REM &h33
20 D=50: REM &h32
30 OUT R,7 : REM select the mixer register
40 OUT D,254 : REM enable channel A only
41 OUT R,8 : REM channel A volume
42 OUT D,15 : REM set it to maximum Fixed
50 OUT R,0 : REM select channel A pitch
60 FOR N=1 TO 255
70 OUT D,N : REM set it
80 GOSUB 200
90 NEXT
100 GOTO 50
200 FOR X=1 TO 64
210 NEXT
220 RETURN
74 changes: 74 additions & 0 deletions Examples/scsound.txt
@@ -0,0 +1,74 @@
A quick example of how you can Output data to the sound chip,
using only SCMonitor. This example sets channel A to generate a
fixed frequency tone, all other channels and noise-generators are off:

SCMon command Description
o 33 7 Select Mixer register
o 32 ff All mixer channels off

o 33 8 Select Channel A Volume register
o 32 9 Fixed Volume = 9 (01001 binary)

o 33 9 Select Channel B Volume register
o 32 0 Fixed Volume = 0

o 33 a Select Channel C Volume register
o 32 0 Fixed Volume = 0

o 33 1 Select Channel A frequency, coarse tune
o 32 1 Rough tone adjust = 1

o 33 0 Select Channel A frequency, fine tune
o 32 ff Fine tone adjust = ff

o 33 7 Select Mixer register
o 32 fe Turn on Channel A Tone only

The same example as above, but without descriptions (to make copy/paste easy)
o 33 7
o 32 ff
o 33 8
o 32 9
o 33 9
o 32 0
o 33 a
o 32 0
o 33 1
o 32 1
o 33 0
o 32 ff
o 33 7
o 32 fe

A short-hand for the used registers follow. For more details about what the
registers do, read the data sheets in the Documentation directory.


Registers 0+1, 2+3 and 4+5 are Tone generator register pairs, Ch A/B/C resp.
Even register is Fine tune, Odd register is Coarse tune

Registers 8,9,A are the Level registers for channel A, B and C respectively.
1 bit mode, 4 bits of volume. The mode bit selects fixed/dynamic

Register 7 is the Mixer register.
Here are some values for the Mixer register to make selection of the different
Tone generators easy:
Binary Hex Selects:
1111 1111 FF <- All off
1111 1110 FE <- Ch A tone solo
1111 1101 FD <- Ch B tone solo
1111 1011 FB <- Ch C tone solo

1111 1100 FC <- A + B
1111 1010 FA <- A + C
1111 1001 F9 <- B + C
1111 1000 F8 <- A + B + C

Mixer bit map:
| IO | Noise channels | Tone channels |
| IOB | IOA | C | B | A | C | B | A |

Mixer bits are "low active", so 0xFF is "All off", while
0xC0 is "All audio channels and noise on".


28 changes: 28 additions & 0 deletions Examples/wiwowa.bas
@@ -0,0 +1,28 @@
1 REM Output ascending and descending "siren" using all three channels
2 REM Addresses 0x32 (data) and 0x33 (register) = 50, 51 decimal:
3 REM Mixer value for A+B+C Tone, no Noise, IO as OUT = 248 decimal/0xFE hex
10 R=51
20 D=50
30 OUT R, 7
40 OUT D,248
41 OUT R, 8
42 OUT D, 15
43 OUT R, 9
44 OUT D, 15
45 OUT R, 10
46 OUT D, 15
50 FOR N = 32 TO 250
55 M = 251 - N
56 O = ABS(M-N)
60 OUT R, 0
61 OUT D, N
62 OUT R, 2
63 OUT D, M
64 OUT R, 4
65 OUT D, O
70 GOSUB 200
80 NEXT
90 GOTO 50
200 FOR X=1 TO 64
210 NEXT
220 RETURN

0 comments on commit bf55e21

Please sign in to comment.