10MODE7 20DIM RomNo 0 30PROCGrope 40REM Remove old rom entirely 50REM MOS table first 60REM?(&2A1+?RomNo)=0 70REM Then remove workspace Byte 80REM?(&DF0+?RomNo)=0 90REM So now need BREAK to reinitialise 100DIM Code &4000 110REM Load DNFS30 into ROM 120PRINT"Loading original DNFS"; 130OSCLI("LOAD DNFS30 "+STR$~(Code)) 140PRINT" and writing to ROMulator" 150PROCWriteRom(Code,Code+&4000,&8000) 160REM LOAD PATCH to 8800 170PRINT"Loading patch"; 180OSCLI("LOAD NMIPTC2 "+STR$~(Code)) 190PRINT" and writing to ROMulator" 200PROCWriteRom(Code,Code+&400,&8800) 210REM Patch a jump into code 220REM to point to 8800 230PRINT"Patching in our tube code"; 240P%=&B93B 250O%=Code 260[OPT 6 270Jmp &8800 280] 290PRINT" and writing to ROMulator" 300PROCWriteRom(Code,Code+3,&B93B) 310REM Remove NFS by patching 320REM service jump to start of DFS 330PRINT"Patching out NFS service entry"; 340P%=&8003 350O%=Code 360[OPT 6 370Jmp &9F9D 380] 390PRINT" and writing to ROMulator" 400PROCWriteRom(Code,Code+3,&8003) 410REM Finally patch header & Help 420PRINT"Patching ROM name in header"; 430P%=&8009 440O%=Code 450[OPT 6 460EQUS "8"" Disk" 470] 480PRINT" and writing to ROMulator" 490PROCWriteRom(Code,Code+7,&8009) 500P%=&B3B4:O%=Code 510[OPT 6 520EQUS "DFS 1.2/8" 530] 540PROCWriteRom(Code,Code+9,&B3B4) 550P%=&BA2C 560O%=Code 570[OPT 6 580EQUS "DFS (8"")" 590] 600PROCWriteRom(Code,Code+8,&BA2C) 610END 620END 630DEFPROCWriteRom(First,Last,To) 640LOCAL Dynamic 650DIM Dynamic 100 660from=&70:to=&72 670FOR Pass=0 TO 2 STEP 2 680P%=Dynamic 690[OPT Pass 700 Php:Sei 710 Lda &F4:Pha 720 Lda #(?RomNo):Sta &F4:Sta &FE30 730Lda #First MOD 256:Sta from 740Lda #First DIV 256:Sta from+1 750Lda #To MOD 256:Sta to 760Lda #To DIV 256:Sta to+1 770Ldy #0 780.Loop 790 Lda from:Cmp #Last MOD 256:Bne notend 800 Lda from+1:Cmp #Last DIV 256:Beq end 810.notend 820 Lda (from),Y:Sta (to),Y 830 Inc from:Bne In0:Inc from+1:.In0 840 Inc to:Bne In1:Inc to+1:.In1 850Jmp Loop 860.end 870 Pla:Sta &F4:Sta &FE30 880 Plp:Rts 890] 900NEXT Pass 910CALL Dynamic 920ENDPROC 930DEFPROCGrope 940LOCAL GropeCode 950DIM GropeCode 100 960FOR Pass=0 TO 2 STEP 2 970P%=GropeCode 980[OPT Pass 990Ldx #15 1000Lda &F4:Pha 1010.Loop2 1020 Stx &F4:Stx &FE30 1030 Lda #0:Tay 1040 Sta &8006:Stx &8007 1050 Lda &8006:Bne another 1060 Lda #1:Sta &8006:Stx &8007 1070 Lda &8006:Cmp #1:Bne another 1080 Stx RomNo:Pla:Sta &F4:Sta &FE30:Rts 1090.another 1100 Dex 1110 Bpl Loop2 1120 BRK:EQUB 1:EQUS "No Romulator":BRK 1130] 1140NEXT Pass 1150CALL GropeCode 1160ENDPROC