Files
rc2014-sid/sid-hl.4th
2026-02-23 20:23:34 +00:00

37 lines
882 B
Forth

( PS2! c c p-addr -- Data byte A, high address byte B, port address C - OUT to port with A and B registers set
: PC2! SWAP >< OR PC! ;
( SID! c c -- Data value, register 0-31; bits 5,6 are for interrupt settings; bit 7 /CS is handled
: SID!
2DUP 128 OR 84 PC2!
2DUP 127 AND 84 PC2!
128 OR 84 PC2! ;
( Voice control register flags
: SID:CTL:GATE 1 ;
: SID:CTL:SYNC 2 ;
: SID:CTL:RING 4 ;
: SID:CTL:TEST 8 ;
: SID:CTL:TRI 16 ;
: SID:CTL:SAW 32 ;
: SID:CTL:PWM 64 ;
: SID:CTL:NOISE 128 ;
( Frequency table:
: SID:NOTE:C4 4389 ;
: SID:NOTE:C4# 4650 ;
: SID:NOTE:D4 4927 ;
: SID:NOTE:D4# 5220 ;
: SID:NOTE:E4 5530 ;
: SID:NOTE:F4 5859 ;
: SID:NOTE:F4# 6207 ;
: SID:NOTE:G4 6577 ;
: SID:NOTE:G4# 6968 ;
: SID:NOTE:A4 7382 ;
: SID:NOTE:A4# 7821 ;
: SID:NOTE:B4 8286 ;
( Octave shifts
: SID:OCT:UP 2* ;
: SID:OCT:DOWN 2/ ;
: SID:VOICE ( n -- )