10 ' Flash OPL4 ROM data into the GR8NET 20 ' designed by Eugeny Brychkov 20210318 (revision of 20210819) 30 DIMD(4):V=INP(&H5E):CALLNETGETDA(A,B):N=0:C=B:FORI=0TO3:IF(CAND1)=1THENN=N+1:D(I)=1ELSED(I)=0 40 C=C\2:NEXTI:IFN=1THEN110 50 PRINT"You have several GR8NET":PRINT"adapters in the system":PRINT:PRINT"ID";CHR$(9);"Slot":FORI=0TO3:IFD(I)=0THEN80 60 OUT&H5E,I*&H50+1:S=INP(&H5F):PRINTI;CHR$(9);HEX$(SAND3);:IF(SAND128)<>0THENPRINT".";HEX$((S\4)AND3); 70 IFI=ATHENPRINT" (default)"ELSEPRINT 80 NEXTI:OUT&H5E,V:PRINT 85 INPUT"Select ID: ";X:IFX<0ORX>3THEN85 90 IFD(X)=0THEN85 100 CALLNETSETDA(X) 110 CALLNETGETMMV(U):IFU<65THENPRINT"Insufficient GR8NET RAM:":PRINT"Please boot into":PRINT"mapper mode 0":END 120 P$="http://www.gr8bit.ru:80/software/firmware/GR8NET/OPL4ROM/gr8net-opl4r" 130 CALLNETGETMEM(201,&H609C,A):IFA=255THENA=21 140 S=2^(A-16):DEFUSR=342 150 PRINT"Important: the program will":PRINT"save current configuration" 160 PRINT"into ROM, if you do not want":PRINT"current configuration to be" 170 PRINT"saved then press CTRL-STOP":PRINT"now and perform clean boot";:X=USR(0):A$=INPUT$(1):PRINT 180 PRINT:PRINT"List of images in GR8NET":CALLFLLIST:A=64 190 PRINT:PRINT:PRINT"Image will require 32 sectors" 195 INPUT"Select starting sector: ";N:IFN<4THENPRINT"Overwriting factory image":PRINT"is not allowed":GOTO195 200 IFN+A>STHENPRINT"ROM will not fit":GOTO195 210 PRINT"Press uppercase Y":PRINT"to start >"; 220 X=USR(0):A$=INPUT$(1):PRINTA$:IFA$<>"Y"THENPRINT"Aborted":END 230 FORI=0TO3:GOSUB270:PRINT:PRINT"Loading part";I:CALLNETBLOAD(A$):PRINT:CALLFLUPDATE(N+I*8,1):NEXT 240 PRINT:PRINT"Update finished":PRINT"Updating configuration..."; 250 CALLNETGETMEM(191,&H6000,A):CALLNETSETMEM(255,&H5FFF,A,A):CALLNETSETMEM(255,&H6BFE,N):CALLNETSETMEM(255,&H6BFF,0) 260 CALLNETSAVE:PRINT"done":PRINT"Press any key for reset":A$=INPUT$(1):CALLNETMRESET:END 270 A$=STR$(I):A$=P$+RIGHT$(A$,LEN(A$)-1)+".bin":RETURN