Simple Monophonic Just Intonation Engine

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Simple Monophonic Just Intonation Engine
by on (#100056)
Simple Monophonic Just Intonation Engine is a music engine I have written for some of the Famicom games I am working on. It is very simple and does not even support looping (with one exception), but is sufficient for my use, mostly for sound effects. You could combine it with other music on the other square and on triangle channel. It is called "just intonation" because I used just intonation in this game, although it is not actually limited to just intonation.

Here is the code (for Unofficial MagicKit; convert to other assemblers if wanted):
Code:
   lda $4015
   and #$01
   bne nomusic
   ldx <musaddr
   lda musichi,x
   beq nomusic
   ldy #$01
   sty $4015
   sta $4003
   lda musiclo,x
   sta $4002
   inx
   stx <musaddr
nomusic   ;continues here