10 KEYOFF:SCREEN0:WIDTH40:DEFINTA-Z 20 ' Automated firmware update/reflash for the GR8NET 30 ' developed by Eugeny Brychkov 20210831 (20211117) 40 CALLNETGETDA(,A):IFA=1ORA=2ORA=4ORA=8THEN100 50 PRINT"More than one GR8NET adapter detected." 60 PRINT"Only one adapter is supported in the" 70 PRINT"system for the reload from scratch." 80 PRINT"Please remove from the system all but" 90 PRINT"one target adapter.":STOP 100 CALLNETGETMMV(A):IFA>65THEN150 110 PRINT"Insufficient buffer RAM. Please reboot" 120 PRINT"the machine and hold arrow down and F3" 130 PRINT"keys forcing GR8NET in mapper mode 0" 140 PRINT"and no RAM disk activated.":STOP 150 PRINT"This program will automatically reload" 160 PRINT"GR8NET firmware from scratch.":PRINT 170 PRINT"If you have special configuration," 180 PRINT"please press CTRL-STOP now, perform" 190 PRINT"_NETVAREXPRT, save generated BASIC" 200 PRINT"program to some location (disk or" 210 PRINT"tape), and, after GR8NET update" 220 PRINT"finishes, load saved BASIC program," 230 PRINT"perform _NETVARIMPRT and then" 240 PRINT"_NETSAVE to restore the configuration.":PRINT:PRINT"Press Y to continue"; 250 DEFUSR=&H156:A=USR(0):A$=INPUT$(1):IFA$<>"Y"THENPRINT:PRINT"Aborted":STOP 260 RO=1:PRINT:PRINT:CALLNETGETMEM(201,24732,SC):SC=SC-16:IFSC<>8THENPRINT"The serial flash chip in your GR8NET":PRINT"is not of 16MB size: OPL4 ROM":PRINT"will not be flashed into it.":PRINT:RO=0 270 PRINT"Before doing anything, please select" 280 PRINT"Kanji ROM image vendor:":PRINT"1. Panasonic (FS-A1GT)":PRINT"2. Sanyo (PHC-70FD2)":PRINT"3. Sony (HB-F1XDJ)" 290 PRINT"4. Mitsubishi (ML-TS2)":PRINT"5. Custom (A2C for emulators)" 300 KJ=0:INPUT"Choice";KJ:IFKJ<1ORKJ>5THEN300 310 PRINT:PRINT"If you want unused space":PRINT"to be erased, type Y>";:A$=INPUT$(1):IFASC(A$)>31THENPRINTA$; 320 ER=0:PRINT:IFA$="Y"THENER=1 330 PRINT:PRINT"Please ensure there will be no" 340 PRINT"interruption to the power during" 350 PRINT"firmware update operations.":F=1 360 B$="http://www.gr8bit.ru:80/software/firmware/GR8NET/" 370 PRINT:PRINT"Step 1/8":PRINT:CALLNETBLOAD(B$+"gr8net-fpga-reg.bin"):CALLFLUPDATE(0,F) 380 PRINT:PRINT"Step 2/8":PRINT:CALLNETBLOAD(B$+"gr8net-fpga-mp3.bin"):CALLFLUPDATE(4,F) 390 PRINT:PRINT"Step 3/8":PRINT:CALLNETBLOAD(B$+"gr8net-fpga-opl4.bin"):CALLFLUPDATE(8,F) 400 IFRO=0THENSE=12:OP=0:OF=0:GOTO450ELSESE=44:OP=12:OF=0 410 PRINT:PRINT"Step 4/8":PRINT:CALLNETBLOAD(B$+"OPL4ROM/gr8net-opl4r0.bin"):CALLFLUPDATE(12,F) 420 PRINT:PRINT"Step 5/8":PRINT:CALLNETBLOAD(B$+"OPL4ROM/gr8net-opl4r1.bin"):CALLFLUPDATE(20,F) 430 PRINT:PRINT"Step 6/8":PRINT:CALLNETBLOAD(B$+"OPL4ROM/gr8net-opl4r2.bin"):CALLFLUPDATE(28,F) 440 PRINT:PRINT"Step 7/8":PRINT:CALLNETBLOAD(B$+"OPL4ROM/gr8net-opl4r3.bin"):CALLFLUPDATE(36,F) 450 IFKJ=1THENP$="gr8net-fpga-pakanjirom.bin" 460 IFKJ=2THENP$="gr8net-fpga-sakanjirom.bin" 470 IFKJ=3THENP$="gr8net-fpga-sokanjirom.bin" 480 IFKJ=4THENP$="gr8net-fpga-mikanjirom.bin" 490 IFKJ=5THENP$="gr8net-fpga-emukanjirom.bin" 500 PRINT:PRINT"Step 8/8":PRINT:CALLNETBLOAD(B$+"Kanji-ROM/"+P$):CALLFLUPDATE(SE,F) 510 IFER=0THEN530 520 PRINT:PRINT"Erasing remaining space";:ONERRORGOTO630:SS=2^SC-1:FORI=SE+4TOSS:CH$=".":CALLFLERASE(I):PRINTCH$;:NEXTI:ONERRORGOTO0:PRINT 530 PRINT:PRINT"Next step is the last step":PRINT"of the update: please power":PRINT"cycle the machine AFTER it finishes":PRINT 540 CALLNETBLOAD(B$+"update.bin"):CALLNETGETMEM(65,26620,V1,V2,V3,V4): 550 Q=INP(94):Q=(QAND240)+1:OUT94,Q:S=INP(95):RESTORE580:GOSUB590:POKE&HA005,S:CALLNETSETMEM(255,27644,0,SE,OP,OF) 560 POKE&HA000,0:POKE&HA001,SE:POKE&HA002,OP:POKE&HA003,OF:DEFUSR1=&HA004:A=USR1(0):CALLNETFWUPDATE(11) 570 STOP 580 DATA"3e002640cd24003e4132e15f2a00603d32e15f1600d9060421fc6b7e23d95fa7ed52d910f62100a011fc6b010400edb006042100a07e23d95f19d910f8d93e4132e15f2200603eff32e15f3ac1fc2640cd2400fbc9XX" 590 P=&HA004 600 READA$:A=LEN(A$):IFA=0OR(AAND1)=1THENPRINT"Error in hex":STOP 610 A=A/2-1:FORI=0TOA:B$=MID$(A$,I*2+1,2):IFB$="XX"THENRETURN 620 POKEP,VAL("&H"+B$):P=P+1:NEXTI:GOTO600 630 CH$="!":RESUMENEXT