dos33fsprogs/music/redbook_sound
2024-10-10 00:39:45 -04:00
..
ck1_sounds.inc keen: more work on keen sounds 2024-04-03 00:28:18 -04:00
convert_frequencies.c peasant: working on sound effects 2024-10-10 00:39:45 -04:00
generate_frequencies.c
hello.bas
longer_sound.s keen: have sound working 2024-04-03 00:54:32 -04:00
Makefile peasant: working on sound effects 2024-10-10 00:39:45 -04:00
note_frequencies.inc
pq_sounds.inc peasant: working on sound effects 2024-10-10 00:39:45 -04:00
README
redbook_sound.s
redbook.bas
sound_test.bas
test_keen.s keen: have sound working 2024-04-03 00:54:32 -04:00
test_pq.s peasant: working on sound effects 2024-10-10 00:39:45 -04:00
wrong_frequencies.inc

this code was widely shared for playing tones on Apple II
	by POKEing the machine language and CALLing from BASIC

it's originally by Paul Lutus, from the Apple II Red Book, p45

this code is just toggling the speaker ($C030) on and off with cycle-counted
frequncies.  

There are fancier ways to get music out of the speaker, see Electric Duet
(also by Paul Lutus), dac522 (by Michael Mahon), and play-btc and
a2stream by Oliver Schmidt.

using regular load/store/bit of $C030 is safe.  Some of the more
	advanced addressing modes can double-toggle due to how some 6502
	implementations run the address bus

these was a table of notes floating around, but it seems the note values
	were off a bit and also seems to have been calculated assuming
	a 1MHz clock but the Apple II actually runs at roughly 1.023MHz

	; the inner freq loop is roughly FREQ*10cycles
	; so the square wave generated has a period of
	;	freq*20*1.023us
	; or a frequency of 1/(freq*20.46e-6)

	; more exactly, it is (4+10F)+(13+10F) = 20F+17

Note this probably will be a bit off on PAL Apple IIs

The code was originally in the form of a machine language program that could
be POKEd to address $00 of the zero page, and called from Integer Basic.

Later this was adapted for Applesoft and loaded to $300 instead, although
when doing this Y was never initialized properly (Integer BASIC had it at $00
but Applesoft it would be $02).

see ../../utils/asoft_sound for some routines that are related but
have slightly different sounds to them