0 ' GR8blaster device control application 1 ' Designed 24-Apr-2018 by Eugeny Brychkov 2 ' See KB0018 here: http://www.gr8bit.ru/gr8bit-knowledge-base.html 3 ' Location of application is http://www.gr8bit.ru/software/basic/utilities/gr8blast.asc 10 clear512:definta-y:screen0:print"GR8blaster control application":print"Designed 20180424 by Eugeny Brychkov":print:print"Wait...";chr$(13); 15 dimcl(16):ca=0:restore1000:fori=0to15:reada:ifa=0then30 20 cl(i)=a:ca=ca+1:nexti 30 p=cl(0):f$="gr8fpgar.bin" 40 reada$:l=len(a$)-1:ifl<0then70 50 fori=1tolstep2:q$=mid$(a$,i,2):v=val("&H"+q$):pokep,v:p=p+1:nexti:goto40 70 defusr=cl(2):a=usr(0):ifa<2then100 80 ifa=2thenprint"PSG port directions are incorrect"elseifa=3thenprint"Port 1 error"elseifa=4thenprint"Port 2 error"elseprint"GR8blaster not found" 90 stop 100 print"GR8blaster at port";a;"detected":print"Reading silicon ID...";:defusr=cl(3):a=usr(0):printhex$(a);:ifa<>&h14thenprint" - invalid":stopelseprint" - OK" 110 restore999 120 reada$:ifa$=""then130elseprint:printa$;:goto120 130 a$=input$(1):a=asc(a$):ifa<48ora>56then130 140 printa$:ona-48goto160,165,170,180,260,270,320,400 150 end 160 defusr=cl(4):a=usr(0):print"Status register ";:gosub996:print:goto110 165 defusr=cl(12):v=0:input"Status to write # [0]";v:ifv<0orv>255then165 166 a=usr(v):ifa<>0thenprint"Error writing"elseprint"Done" 167 goto 110 170 defusr=cl(5):a=usr(0):ifa=0thenprint"Chip is blank"elseprint"Not blank @ ";:a=peek(cl(1)):gosub996:a=peek(cl(1)+2):gosub996:a=peek(cl(1)+1):gosub996:print 175 goto110 180 s=0:input"Starting sector # [0]";s:ifs<0ors>31then180 190 n=32:input"Sector count [32]";n:ifn<0ors+n>32then180 200 ifn=0then110 210 onerrorgoto240 220 print"File name [";f$;"]";:inputf$:openf$as#1len=128:field#1,128asq$:a$=string$(128,0):defusr=cl(6):defusr1=cl(7) 230 pokecl(1),0:pokecl(1)+1,0:fori=0ton-1:forj=0to7:a=usr(s) 232 pokecl(1)+2,0:pokecl(1)+3,0:fork=0to63:a=usr1(a$):ifa<>0thenprint"Buffer error";a:goto250 235 lsetq$=a$:put#1:nextk:print".";:nextj:s=s+1:nexti:print"Success":goto250 240 print"Error occured";err;"/";erl:resume250 250 close:onerrorgoto0:goto110 260 gosub994:ifx<>1then110elseprint"Erasing...";:defusr=cl(8):a=usr(0):print"Success":goto110 270 s=0:input"Starting sector # [0]";s:ifs<0ors>31then270 280 n=32:input"Sector count [32]";n:ifn<0ors+n>32then270 290 ifn=0then110 300 gosub994:ifx<>1then110 305 defusr=cl(9):fori=stos+n-1:c=usr(i):ifc<>0thenprint"Erase error":goto110 310 print".";:nexti:print"Success":goto110 320 s=0:input"Starting sector # [0]";s:ifs<0ors>31then320 330 n=32:input"Sector count [32]";n:ifn<0ors+n>32then320 340 ifn=0then110 350 onerrorgoto240 360 print"File name [";f$;"]";:inputf$:openf$as#1len=128:z=lof(1):ifz0thenprint"Buffer error";a:goto250 380 nexti:a=usr(s):ifa<>0thenprint"Write error":goto250 390 print".";:nextj:s=s+1:nextk:print"Success":goto250 400 onerrorgoto240 410 s=0:input"Starting sector # [0]";s:ifs<0ors>31then410 420 print"File name [";f$;"]";:inputf$:openf$as#1len=128:z=lof(1):n=fix(z/8192):ifz-n*8192<>0thenprint"File size must be multiple of 8192":goto250 430 field#1,128asq$:a$=string$(128,0):defusr=cl(13):defusr1=cl(11):pokecl(1),0:pokecl(1)+1,0:fori=0ton/8-1:forj=0to7:pokecl(1)+2,0:pokecl(1)+3,0 440 fork=0to63:get#1:a$=q$:a=usr1(a$):ifa<>0thenprint"Buffer error";a:goto250 450 nextk:a=usr(s):ifa=3thenprint"Failed @ ";:a=s:gosub996:a=peek(cl(1)+1):gosub996:a=peek(cl(1)):gosub996:print:goto250 460 ifa=2thenprint"Argument error":goto250 470 print".";:nextj:s=s+1:nexti:print"Verify successful":goto250 994 print"Press Y to confirm>";:a$=input$(1):printa$:x=0:ifa$="Y"thenx=1 995 return 996 a$=hex$(a):iflen(a$)=1thena$="0"+a$ 997 printa$;:return 998 end 999 data"Menu","0. Exit","1. Read status register","2. Set status register","3. Check blank","4. Read data","5. Erase chip","6. Erase sectors","7. Write data","8. Verify","> ","" 1000 DATA-26624,-25708,-26624,-26475,-26447,-26417,-26333,-26291,-26242,-26186,-26076,-26114,-25970,-25927,0 1010 DATA"F33E07D3A0DBA2E6C0FE8020713E0FD3A03E8FD3A13E0ED3A0DBA2E638FE3820" 1020 DATA"603E0FD3A03ECFD3A13E0ED3A0DBA2E638FE38204F3E0FD3A03E8DD3A13E0ED3" 1030 DATA"A0DBA2E6083E0D018000110110281A3E0FD3A03EC7D3A13E0ED3A0DBA2E6083E" 1040 DATA"0701C001110420201E32799B7B326C9B2F32669B79328A9B7A32859B58011E02" 1050 DATA"011E03011E04011E051600ED53F8F73E023263F6C9F30100AB210000CD369B11" 1060 DATA"010021949BCD1B9BCD729BED5B949B18D8F3CD729BCD789B3E05CD4D9B110100" 1070 DATA"21949BCD1B9BCD729BED5B949B18BAF3CD729BCD789B010003210000CD369B01" 1080 DATA"0020C5010000D906083E0ED3A0DBA20F301ACD7E9BCD7E9B10EFD90B78B120E6" 1090 DATA"C10C10DECD729B1E00C38998CD729BC17932949BD9210000A7ED4222959B1E01" 1100 DATA"C38998F3CD729BCD789B06033AF8F74F2A949BCD369B21989B110020CD1B9BCD" 1110 DATA"729B2A949B1100201922949BC93A63F6FE03C27E982AF8F77EFE80C28198235E" 1120 DATA"235621989BED4B969B09018000EDB02A969B0180000922969B1E00C38998F3CD" 1130 DATA"729BCD789B3E06CD4D9BCD729BCD789B3EC7CD4D9BCD729BE3E3CD789B3E05CD" 1140 DATA"4D9B11010021949BCD1B9BCD729B3A949B0F38E618C33A63F6FE02C27E98F3CD" 1150 DATA"729BCD789B3E06CD4D9BCD729BCD789B06D83AF8F74F210000CD369BCD729BE3" 1160 DATA"E3CD789B3E05CD4D9B11010021949BCD1B9BCD729B3A949B0F38E6C379993A63" 1170 DATA"F6FE03C27E982AF8F77EFE80C28198235E235621989BED4B969B09018000EBED" 1180 DATA"B0C36F993A63F6FE02C27E98F3062021989BC5E5CD729BCD789B3E06CD4D9BCD" 1190 DATA"729BCD789B06023AF8F74F2A949BCD369B0600E17E23D9CD4D9BD910F7E5CD72" 1200 DATA"9BE3E3CD789B3E05CD4D9B1101002198BBCD1B9BCD729B3A98BB0F38E62A949B" 1210 DATA"1100011922949BE1C110A7C379993A63F6FE02C27E98F3CD729BCD789B3E06CD" 1220 DATA"4D9BCD729BCD789B3E01CD4D9B3AF8F7CD4D9BCD729BC3DF993A63F6FE02C27E" 1230 DATA"98F3CD729BCD789B06033AF8F74F2A949BCD369B21989B11002006083E0ED3A0" 1240 DATA"DBA20FCB11CD7E9BCD7E9B10EF79BE2016231B7AB320E3CD729B2A949B110020" 1250 DATA"1922949BC37999CD729B11989BA7ED52ED5B949B1922949BC3819806083E0ED3" 1260 DATA"A0DBA20FCB11CD7E9BCD7E9B10EF71231B7AB320E6C9CD729BCD789B78CD4D9B" 1270 DATA"79CD4D9B7CCD4D9B7DCD4D9BC9060807F5CD5E9BCD7E9BCD7E9BF110F2C93E0F" 1280 DATA"D3A008DBA2E60008300408F6000808D3A1C93E0FCD899BC93E00CD899BC93E0F" 1290 DATA"D3A0DBA2EE00D3A1C9F600083E0FD3A008D3A1C9" 1300 DATA""