For your first question, I'll just quote the original GEMS source code:
Code:
* fmftbl contains a 16 bit freq number for each half step in a single octave (C-C)
fmftbl dw 644,682,723,766,811,859,910,965,1022,1083,1147,1215,1288
* psgftbl contains the 16 bit wavelength numbers for the notes A2 thru B7 (33-95)
psgftbl dw 03F9H, 03C0H, 038AH ; A2 > B2
dw 0357H, 0327H, 02FAH, 02CFH ; C3 > B3
dw 02A7H, 0281H, 025DH, 023BH
dw 021BH, 01FCH, 01E0H, 01C5H
dw 01ACH, 0194H, 017DH, 0168H ; C4 > B4
dw 0153H, 0140H, 012EH, 011DH
dw 010DH, 00FEH, 00F0H, 00E2H
dw 00D6H, 00CAH, 00BEH, 00B4H ; C5 > B5
dw 00AAH, 00A0H, 0097H, 008FH
dw 0087H, 007FH, 0078H, 0071H
dw 006BH, 0065H, 005FH, 005AH ; C6 > B6
dw 0055H, 0050H, 004CH, 0047H
dw 0043H, 0040H, 003CH, 0039H
dw 0035H, 0032H, 002FH, 002DH ; C7 > B7 (not very accurate!)
dw 002AH, 0028H, 0026H, 0023H
dw 0021H, 0020H, 001EH, 001CH
dw 001CH ; extra value for interpolation of B7
For your second question, you need to know that ADSR calculations usually work with
step values that are added to (attack) or subtracted from (decay/sustain/release) the
accumulator value. (That's a system completely different to defining delays between frames.)
An example:
Attack Rate $18 means that the "volume" values for the ticks/frames are: $18, $30, $48, $60, etc. (until the Attack Level is reached)
Also, since PSG volumes are only 4 bits, ADSR usually use 4.4 bit fixed point values for internal calculations. (If you don't know what "fixed point" means, you should look up "fixed-point arithmetic".)
Small note: For basic understanding, you should think of the accumulator value starting at 0 (silence) and go up to $FF (maximum volume) going back down to 0. (see
this picture)
However, GEMS seems to use inverted
level values (i.e. max. volume = $00, silence = $FF), probably because it matches the PSG's volume scale better. That way is a bit less intuitive though and not as easy to understand, IMO.