If you want to bypass the sending of values to the PSG, poke a &C9 here…

ASM BASIC INTER &3AC &3B5 &408

This is useful if you want, for example, to make digidrums (look at the DIGIDRUM section below). Also could be used if you want to generate a YM-list in order to have the fastest music code ever (but also a great amount of memory used by the list !). In this case, 'hearing' the song is useless, you would just have to run the player, get the values, code them and restart until the song is over, then read the YM values with your own player.

The normal value in this address is a &C3 (JUMP).

WARNING, there's a special case about the Register 7, its value is given through A before the jump ! So if you bypass the JUMP, but jump to that code later, don't forget to set A with the Register 7 value you took care to save…

!!! WARNING !!! IF you set a RET with the BASIC or INTER players, it will crash ! Why ? Because these players saves some registers (by PUSHing them) at the beginning, and recover them (by POPing) after having sent PSG values. So by bypassing it, the registers are never recovered, the RET will jump at a bad address. So instead of setting a RET, we'll jump directly to the code that will recover the registers. You must poke this : BASIC : poke #C3 (JUMP) in #3b5, and (Address of the player + #85F) next. (low byte then high byte). INTER : poke #C3 (JUMP) in #408, and (Address of the player + #8B2) next. (low byte then high byte).

BUT WARNING AGAIN !! By doing this we will be unable to get the Reg7 value, as it's given through A to the code that send PSG values (see below). We must save it first. You can do it where you want. The address #1F is used in this example, because no one use it. But we must do it outside the player, because this code addition will overflow on some other parts of the player. SO, we will our code in #3C, no one goes here. Here, we save A in #1F, and then JUMP to the code that recovers players :

Poke in ADPLAYER+#3B5 (BASIC) ou ADPLAYER+#408 the following bytes : #C3 #3C #00 (Jump #003c) In #3c, poke this : #32,#1F,#00, the two last bytes being where you want to save Reg7. Then poke the 3 bytes discussed above (the 1st WARNING). Now you can recover the Reg7 from #1f at any time.

I know it's really bad trick, I will perhaps improve that in futur player, however it's not very useful except in the YM case. And most BASIC coders won't ever need it, so…

If you use the ASM player : don't bother with this crap, poke a RET as said at the beginning, and save A !

Now comes the address of the code that send values to the PSG…

ASM BASIC INTER &6CD &6D6 &729

WARNING : The value of the REGISTER 7 is GIVEN through A !

Then, here are the addresses where you can get the values sent to the PSG. So if you need to code an equalizer, you can get all PSG values here. Of course, the addresses are various according to the players. They are quite useless if you use the INTERRUPT player, but hey, here are they anyway :

ASM BASIC INTERRUPT R0 &6D8 &6E1 &734 Low Byte Frequency, Channel 1 R1 &6F3 &6FC &74F High Byte Frequency, Channel 1 R2 &729 &732 &785 Low Byte Frequency, Channel 2 R3 &744 &74D &7A0 High Byte Frequency, Channel 2 R4 &77A &783 &7D6 Low Byte Frequency, Channel 3 R5 &795 &79F &7F1 High Byte Frequency, Channel 3

R6 &7CB &7D4 &827 Noise R7 NOT CODED Mixer (R7OLD &7E7 &7F0 &843)

R8 &70F &717 &76A Volume, Channel 1 R9 &75F &768 &7BB Volume, Channel 2 R10 &7B0 &7B9 &80C Volume, Channel 3

R11 &800 &809 &85C Low Byte Hardware Enveloppe Frequency R12 &81B &824 &877 High Byte Hard Enveloppe Frequency R13 &836 &83F &892 Hardware Enveloppe Shape

The Register 7 is NOT automodified ! It is GIVEN in A to the code that send values to the PSG (see above).

NOTE : If you add 2 to each address, you get the PREVIOUS value of the register. BEFORE sending a value to a register, the new value is compared to the previous one. If they are equal, there's no need to send it again, hence a saving of machine time. The exception is the Register 13, which is managed in any case if RETRIG is >0. (Note that I gave you the address of the old value of Reg7, since the new one is given through A).

documentations/software/starkos/howto.player.hook.ay3.update.txt · Last modified: 2009/05/13 15:25 by grim