10 KEYOFF:SCREEN0:WIDTH40:DEFINTA-Z 20 ' Automated firmware update/reflash for the GR8NET 30 ' developed by Eugeny Brychkov 20211116 (20211117) 40 PRINT"This reflash program is designed to be" 50 PRINT"used for mono GR8NETs with 2MB serial" 60 PRINT"flash chip. If you have 16MB GR8NET" 70 PRINT"you can write 8-bit OPL4 ROM into the" 80 PRINT"flash chip into location of your" 90 PRINT"choice and configure ROM image to use" 100 PRINT"with _NETOPL4IMG command.":PRINT 110 CALLNETGETDA(,A):IFA=1ORA=2ORA=4ORA=8THEN170 120 PRINT"More than one GR8NET adapter detected." 130 PRINT"Only one adapter is supported in the" 140 PRINT"system for the reload from scratch." 150 PRINT"Please remove from the system all but" 160 PRINT"one target adapter.":STOP 170 CALLNETGETMMV(A):IFA>65THEN220 180 PRINT"Insufficient buffer RAM. Please reboot" 190 PRINT"the machine and hold arrow down and F3" 200 PRINT"keys forcing GR8NET in mapper mode 0" 210 PRINT"and no RAM disk activated.":STOP 220 PRINT"This program will automatically reload" 230 PRINT"GR8NET firmware from scratch.":PRINT 240 PRINT"If you have special configuration," 250 PRINT"please press CTRL-STOP now, perform" 260 PRINT"_NETVAREXPRT, save generated BASIC" 270 PRINT"program to some location (disk or" 280 PRINT"tape), and, after GR8NET update" 290 PRINT"finishes, load saved BASIC program," 300 PRINT"perform _NETVARIMPRT and then" 310 PRINT"_NETSAVE to restore the configuration.":PRINT:PRINT"Press Y to continue"; 320 DEFUSR=&H156:A=USR(0):A$=INPUT$(1):IFA$<>"Y"THENPRINT:PRINT"Aborted":STOP 330 RO=0:PRINT:PRINT:PRINT"If you want unused space":PRINT"to be erased, type Y>";:A$=INPUT$(1):IFASC(A$)>31THENPRINTA$; 340 ER=0:PRINT:IFA$="Y"THENER=1 350 MO=8:CALLNETGETMIX(MI):IF(MIAND&H8000)<>0THENMO=0 360 IFMO<>0THENPRINT:PRINT"Setting mono mixing on" 370 PRINT:PRINT"Please ensure there will be no" 380 PRINT"interruption to the power during" 390 PRINT"firmware update operations.":F=1 400 B$="http://www.gr8bit.ru:80/software/firmware/GR8NET/" 410 PRINT:PRINT"Step 1/5":PRINT:CALLNETBLOAD(B$+"gr8net-fpga-reg.bin"):CALLFLUPDATE(0,F) 420 PRINT:PRINT"Step 2/5":PRINT:CALLNETBLOAD(B$+"gr8net-fpga-opl4.bin"):CALLFLUPDATE(4,F) 430 PRINT:PRINT"Step 3/5":PRINT:CALLNETBLOAD(B$+"OPL4ROM/8-bit/yrw801-8-0.bin"):CALLFLUPDATE(8,F) 440 PRINT:PRINT"Step 4/5":PRINT:CALLNETBLOAD(B$+"OPL4ROM/8-bit/yrw801-8-1.bin"):CALLFLUPDATE(16,F) 450 PRINT:PRINT"Step 5/5":PRINT:CALLNETBLOAD(B$+"OPL4ROM/8-bit/yrw801-8-2.bin"):CALLFLUPDATE(24,F) 460 PRINT:PRINT"Erasing remaining space";:ONERRORGOTO570:SS=2^SC-1:FORI=30TO31:CH$=".":CALLFLERASE(I):PRINTCH$;:NEXTI:ONERRORGOTO0:PRINT 470 PRINT:PRINT"Next step is the last step":PRINT"of the update: please power":PRINT"cycle the machine AFTER it finishes":PRINT 480 CALLNETBLOAD(B$+"update.bin"):CALLNETGETMEM(65,26620,V1,V2,V3,V4): 490 Q=INP(94):Q=(QAND240)+1:OUT94,Q:S=INP(95):RESTORE520:GOSUB530:POKE&HA005,S:CALLNETSETMEM(255,27644,0,0,8,MO):'sector 8, mono mixing 500 POKE&HA000,0:POKE&HA001,SE:POKE&HA002,OP:POKE&HA003,OF:DEFUSR1=&HA004:A=USR1(0):CALLNETFWUPDATE(11) 510 STOP 520 DATA"3e002640cd24003e4132e15f2a00603d32e15f1600d9060421fc6b7e23d95fa7ed52d910f62100a011fc6b010400edb006042100a07e23d95f19d910f8d93e4132e15f2200603eff32e15f3ac1fc2640cd2400fbc9XX" 530 P=&HA004 540 READA$:A=LEN(A$):IFA=0OR(AAND1)=1THENPRINT"Error in hex":STOP 550 A=A/2-1:FORI=0TOA:B$=MID$(A$,I*2+1,2):IFB$="XX"THENRETURN 560 POKEP,VAL("&H"+B$):P=P+1:NEXTI:GOTO540 570 CH$="!":RESUMENEXT