20000 CLS:PRINT TAB(27) "WEAK BIT WRITING ROUTINE":PRINT"":PRINT"You must specify the drive, track, side and sector on which weak bits are to be written, as well as the location (in hex) of each byte with weak bits."
20010 PRINT"Up to ten bytes with weak bits can be written. Note that the sector must already contain the proper data, and that the format table must contain the correct information about the track and sector."
20020 ON KEY(10) GOSUB 10670
20030 PRINT"":PRINT TAB(27) "Press any key to begin."
20080 ST%=VAL(STI$):IF ST%<0 THEN BEEP:PRINT"REDO!:goto 20070
20090 STI%=ST%
20100 S0%=1:PRINT"Sector ";:PRINT S0%;" ";:GOSUB 12430:IF LEN(KB$)<>0 THEN S0%=VAL(KB$)
20110 IF S0%<1 THEN PRINT"REDO!":GOTO 20100
20120 FS%=LFE%+256*ST%:GOSUB 12530:WNS%=PEEK(FS%):IF S0%>WNS% THEN PRINT"REDO! Sector # is too large!":GOTO 20100
20130 WE%=PEEK(FS%+5*S0%-3):IF (WE% AND &H30)<> 0 THEN PRINT"Can't write weak bits to a sector with a missing address mark or an ID field CRC error. Retype sector number.":GOTO 20100
20140 WN%=PEEK(FS%+5*S0%+1):IF WN%>5 THEN PRINT"Can't write weak bits to a sector with N>5. Retype sector number.":GOTO 20100
20150 WL%=128*2^WN%
20160 WS%=1:REP%=&HB0:WK%=3:PRINT"":PRINT"Weak bit locations: Press <CR> key when finished entering locations.":PRINT""
20170 PRINT"Type byte offset for location of weak bits (range: ";HEX$(WK%+1);" to ";HEX$(WL%);" ";:GOSUB 12430
20180 IF KB$="" GOTO 20220
20190 WO%=VAL("&H"+KB$):IF WO%>WK% AND WO%<=WL% GOTO 20210