10 '--- Written by Eugeny Brychkov 03 Sep 2014 20 '--- Updated for GR8NET 02 Feb 2016, SCC+ support as of 01 Mar 2018 30 PRINT"GR8NET SCC(+) DAC output test program" 40 RESTORE 700:FORI=0TO24:READA:POKE&HC000+I,A:NEXTI:DEFUSR=&HC000:DEFUSR1=&HC00D:DEFUSR2=&HC019 50 INPUT"Select slot ID";S:INPUT"Type (0=SCC, 1=SCC+)";TY:POKE&HC001,S:POKE&HC00E,S 60 A1=&HC013:A2=&HC010:A3=&HC011:A4=&HC003:A5=&HC004:A6=&HC01E:A7=&HC0FF 70 PRINT"Checking for GR8NET":A$="GR8NET":POKEA5,&H5F 80 FORI=1TO6:POKEA4,&HB7+I:A=USR(0):IFPEEK(A7)<>ASC(MID$(A$,I,1))THENPRINT"No GR8NET detected":STOP 90 NEXTI:POKEA4,&HE0:A=USR(0):A=PEEK(A7):IFA<>128ANDA<>240THENPRINT"Wrong GR8NET mode":STOP 100 '--- Setting SCC logical page in GR8NET banks 2 and 3 110 IFTY=0THENZ=0ELSEZ=1 120 POKEA3,&H5F:POKEA2,&HE2+Z:POKEA1,&HFE:A=USR1(0) 130 '--- Checking for SCC/SCC+ 140 PRINT"Checking for SCC";:IFTY=1THENPRINT"+"; 150 PRINT 160 '--- Setting SCC type and switching to SCC register page 170 IFTY=0THENLO=&H98:RL=128:NU=127:DR=&HE0:POKEA1,0:POKEA3,&H9F ELSELO=&HB8:RL=160:NU=159:DR=&HC0:POKEA1,32:POKEA3,&HBF 180 ONSTOPGOSUB680:STOPON 190 POKEA2,254:A=USR1(0) 200 '--- Muting channels 210 POKEA1,0:POKEA2,RL+15:POKEA3,LO:A=USR1(0) 220 '--- Checking for R/W register area 230 POKEA5,LO 240 FORI=0TONU 250 POKEA1,I+1:POKEA2,I:A=USR1(0) 260 POKEA4,I:A=USR(0) 270 IFPEEK(A7)<>I+1THENPRINT"R/W failed at register: ";I:GOTO690 280 NEXT I 290 PRINT"Register area found and tested" 300 '--- Clearing deformation register 310 POKEA1,0:POKEA2,DR:A=USR1(0) 320 '--- Testing channels 330 PRINT"Silence test" 340 '--- Clear all waveforms 350 FORI=0TONU:POKEA1,0:POKEA2,I:A=USR1(0):NEXTI 360 '--- Set all volumes to max 370 FORI=0TO4:POKEA2,RL+10+I:POKEA1,15:A=USR1(0) 380 '--- Enable all channels 390 POKEA1,31:POKEA2,RL+15:A=USR1(0) 400 PRINT"Press space key to continue":A$=INPUT$(1) 410 '--- Sine test 420 POKEA1,0:POKEA2,RL+15:A=USR1(0) 430 PRINT"Sine test - space key to suspend" 440 FORC=0TO4 450 '--- Clear wave 460 FORI=0TONU:POKEA1,0:POKEA2,I:A=USR1(0):NEXTI 470 '--- Set up wave for the respective channel 480 RESTORE740:CC=C:IFC=4ANDTY=0THENCC=3 490 FORI=0TO31:READA:IFA<0THENA=256+A 500 POKEA1,A:POKEA2,CC*32+I:A=USR1(0):NEXTI 510 '--- Reset volume 520 POKEA2,RL+10+C:POKEA1,0:A=USR1(0) 530 '--- Turn channel on 540 FORV=1TO15:POKEA2,RL+10+C:POKEA1,V:A=USR1(0) 550 FORI=0TO31:FQ=(I+1)*400:F=111875!/FQ 560 PRINT"CH";C;" FREQ";STR$(FQ);"Hz VOL";V; 570 PRINT" ";CHR$(13); 580 POKEA2,RL+15:POKEA1,0:A=USR1(0) 590 POKEA1,FMOD256:POKEA2,RL+C*2:A=USR1(0) 600 POKEA1,F/256:POKEA2,RL+1+C*2:A=USR1(0) 610 POKEA2,RL+15:POKEA1,2^C:A=USR1(0) 620 FORK=0TO50:NEXTK:A$=INKEY$:IFA$<>""THENA$=INPUT$(1) 630 POKEA2,RL+15:POKEA1,0:A=USR1(0) 640 NEXTI 650 NEXTV 660 NEXTC 670 '--- Finish 680 POKEA1,0:POKEA2,RL+15:A=USR1(0):POKEA1,0:POKEA2,255:A=USR1(0):PRINT 690 POKEA3,&H5F:POKEA2,&HE2:POKEA1,&H81:A=USR1(0):POKEA2,&HE3:POKEA1,&HC0:A=USR1(0):END 700 'READ MEMORY 710 DATA &H3E,1,&H21,0,&H40,&HCD,12,0,&HFB,&H32,255,&HC0,&HC9 720 'WRITE MEMORY 730 DATA &H3E,1,&H21,0,&H50,&H1E,1,&HCD,&H14,0,&HFB,&HC9 740 'SINE WAVE 750 DATA 0,24,48,70,89,105,117,124 760 DATA 127,124,117,105,89,70,48,24 770 DATA 0,-24,-48,-70,-89,-105,-117,-124 780 DATA -127,-124,-117,-105,-89,-70,-48,-24