Well, "music" might be a strong term. "Sufficiently harmonious tones" might be better.
Attached is a .bin and .bas file of a program that generates, well, sufficiently harmonious tones in the key of A major. It's fairly compact and efficient. I've tried to include a lot of comments. I thought I might use it in a game, but it doesn't really suit the project. I'm posting it here in case it might benefit someone else.
Basically it picks a random bass note and a random melody note and plays them. It keeps track of note length and plays things in correct time. (The bass moves in quarter notes, the melody moves in eighth notes, with some variations possible.) It's very basic but could be built out for more interesting (and perhaps musical) results.
I'm happy to answer any questions. Enjoy!