|
ForumsSega Master System / Mark III / Game GearSG-1000 / SC-3000 / SF-7000 / OMV |
Home - Forums - Games - Scans - Maps - Cheats - Credits Music - Videos - Development - Hacks - Translations - Homebrew |
Author | Message |
---|---|
|
SMS, simple timer/delay for music
Posted: Thu Jul 08, 2010 8:33 am
|
Hi all,
I write music for SMS/GG, using both VGM (generating files containing PSG/YM2413 information) and by assembler (TASM). The documentation is excellent, still would like ask an advice or preferably short code snippet for an accurate timer. As I only do music, there's no need for any graphics, code may start straightly from .org $1000 or with some short initialization, after that I just load stuff to accumulator and output them correct addresses ($7F, $F0,$F1). So I would need a short accurate code snippet for delay, something very simple that I haven't found so far. Each program is for one use only, generating source material for a composition (or in some cases being the composition itself), recorded and then I start a new program for next composition. Pure chip programming, not trying to do melodies etc., it is like a series of sound effects, usually in endless loop. Any advices are highly appreciated ! Best, Jukka |
|
|
Posted: Thu Jul 08, 2010 9:34 am |
If you're not going to set up a proper VBlank setup then you can do something like:
WaitForVBlank: -: in a,($bf) and $80 jr z,- ret (untested, remember to disable interrupts) Alternative: http://www.smspower.org/forums/viewtopic.php?p=36883#36883 |
|
|
Posted: Thu Jul 08, 2010 10:12 am |
EDIT: Seems emulator problem, I tried first with Dega, stucks to the first sound, now tried with Meka too and works perfectly there ! Thanks Maxim.
-J Excellent, thanks Maxim, exactly what I was looking for (I've used simple VBlank with other consoles too). I copied the code, TASM didn't liked -: label, so I changed it, after setting the YM2413 registers I call the WaitForVBlank, but it seems to stuck there, to the first sound. I disabled interrupts simply by .org $0000 di .org $1000 jp Main Main: ;start loading register values to chip call WaitForVBlank ;rest of the code (loading more values and calling WaitForVBlank after each chip setting) Just using one call WaitForVBlank in testing, afterwards I will use a loop with it. Anyway it stucks to the first sound, any tips ? Thanks ! -Jukka
|
|