home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / DISKEXPL.ZIP / WEAK.BAS < prev   
Encoding:
BASIC Source File  |  1984-09-04  |  2.5 KB  |  37 lines

  1. 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."
  2. 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."
  3. 20020 ON KEY(10) GOSUB 10670
  4. 20030 PRINT"":PRINT TAB(27) "Press any key to begin."
  5. 20040 IF INKEY$="" GOTO 20040
  6. 20050 ON KEY(10) GOSUB 22000
  7. 20055 PRINT""
  8. 20060 GOSUB 10680:GOSUB 10750
  9. 20070 ST%=STI%:PRINT"Track   ";:PRINT ST%;" ";:GOSUB 12430:STI$=KB$:IF LEN(STI$)=0 GOTO 20100
  10. 20080 ST%=VAL(STI$):IF ST%<0 THEN BEEP:PRINT"REDO!:goto 20070
  11. 20090 STI%=ST%
  12. 20100 S0%=1:PRINT"Sector  ";:PRINT S0%;" ";:GOSUB 12430:IF LEN(KB$)<>0 THEN S0%=VAL(KB$)
  13. 20110 IF S0%<1 THEN PRINT"REDO!":GOTO 20100
  14. 20120 FS%=LFE%+256*ST%:GOSUB 12530:WNS%=PEEK(FS%):IF S0%>WNS% THEN PRINT"REDO! Sector # is too large!":GOTO 20100
  15. 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
  16. 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
  17. 20150 WL%=128*2^WN%
  18. 20160 WS%=1:REP%=&HB0:WK%=3:PRINT"":PRINT"Weak bit locations: Press <CR> key when finished entering locations.":PRINT""
  19. 20170 PRINT"Type byte offset for location of weak bits (range: ";HEX$(WK%+1);" to ";HEX$(WL%);" ";:GOSUB 12430
  20. 20180 IF KB$="" GOTO 20220
  21. 20190 WO%=VAL("&H"+KB$):IF WO%>WK% AND WO%<=WL% GOTO 20210
  22. 20200 PRINT"Improper location! Retype.":GOTO 20170
  23. 20210 WX%=WL%-WO%-2:IF WX%<1 THEN WX%=1
  24. 20213 WH%=INT(WX%/256):WLO%=WX%-256*WH%:POKE REP%,WLO%:POKE REP%+1,WH%:REP%=REP%+2:WK%=WO%:WS%=WS%+1
  25. 20215 IF WX%=1 GOTO 20220
  26. 20217 IF WS%<11 GOTO 20170
  27. 20220 WS%=WS%-1
  28. 20230 IF WS%<1 THEN PRINT"You must have at least one location!":GOTO 20170
  29. 20240 PRINT"":PRINT"Writing";WS%;" bytes with weak bits."
  30. 20250 POKE 49,19:POKE 50,0:POKE 51,WS%:POKE 52,DR%:POKE 56,ST%:POKE 55,S0%:POKE 57,DR%:POKE 58,HD%
  31. 20255 POKE &H18,0:POKE &H3D,0:C8%=PEEK(&HC8):POKE &HC8,0
  32. 20260 UU%=USR(UU%)
  33. 20265 POKE &HC8,C8%:IF ASYN$="S" OR ASYN$="s" THEN POKE &H3D,1:POKE &H18,1
  34. 20270 PRINT"Done. Do you want to write more weak bits <Y/N> ";:GOSUB 12430:IF KB$="Y" OR KB$="y" GOTO 20000
  35. 20280 GOTO 540
  36. 22000 RETURN 20000
  37.