home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1985 May / Ahoy_Magazine_85-05_1985_Double_L.d64 / dskdu (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  4KB  |  164 lines

  1. 1 n$="*dskdu*":n1$="by mark johansen"
  2. 2 da=8:goto8000
  3. 10 rem*hex in
  4. 12 n=0:if len(h$)=0 then return
  5. 14 for hx=1tolen(h$):n1=asc(mid$(h$,hx,1)):n1=n1-48:if n1>9 then n1=n1-7
  6. 16 n=n*16+n1:next
  7. 18 return
  8. 1000 rem*read
  9. 1010 print"[147]";n$:print"";n1$:print
  10. 1020 input"track";h$:gosub10:t=n
  11. 1030 input"sector";h$:gosub10:s=n
  12. 1110 print#15,"u1:2,0,"t;s:gosub9000:if er>0 then 1000
  13. 1120 print#15,"b-p:2,0"
  14. 1130 d%(0)=0:poke 828,peek(71):poke 829,peek(72):sys880
  15. 1160 gosub9000:if er>0 then 1000
  16. 2000 rem*view/mod
  17. 2010 p=0
  18. 2100 rem flash screen
  19. 2102 if p<0 then p=192
  20. 2104 if p>192 then p=0
  21. 2110 print"[147]track ";hx$(t/16);hx$(t and 15)
  22. 2120 print"sector ";hx$(s/16);hx$(s and 15)
  23. 2130 print
  24. 2140 for l=p to p+63 step 4:print hx$(l/16);hx$(land15);":";
  25. 2150 for by=l to l+3:print hx$(d%(by)/16);hx$(d%(by)and15);" ";:next
  26. 2160 for by=l to l+3:c$=chr$(d%(by)):if c$<" " or c$>"_" or c$=chr$(34) then c$="."
  27. 2170 print c$;:next
  28. 2180 print:next
  29. 2200 rem*allow mods
  30. 2210 l=0:c=0
  31. 2220 by=p+l*4+c/2:hx=cand1:h1$(0)=hx$(d%(by)/16):h1$(1)=hx$(d%(by)and15):c1=int(c*1.5)
  32. 2225 poke 781,l+3:poke 782,c1+3:poke 783,0:sys65520
  33. 2230 poke 204,0
  34. 2240 get i$:if i$="" then 2240
  35. 2250 poke 204,1:print h1$(hx);
  36. 2260 if i$="[133]" then p=p-64:goto2100
  37. 2270 if i$="[134]" then p=p+64:goto2100
  38. 2280 if i$="[136]" then 1000
  39. 2285 if i$="[138]" then t=d%(0):s=d%(1):goto1110
  40. 2290 if i$="" then 2750
  41. 2300 if i$="" then 2700
  42. 2310 if i$="[145]" then 2800
  43. 2320 if i$="[157]" then 2850
  44. 2330 if i$="[140]" then 3000
  45. 2340 if i$="[137]" then 4000
  46. 2350 if i$="" then 2210
  47. 2400 if i$<"0" or i$>"f" or i$>"9" and i$<"a" then 7000
  48. 2410 print "[157]"i$;
  49. 2430 h1$(hx)=i$:h$=h1$(0)+h1$(1)
  50. 2450 gosub10:d%(by)=n
  51. 2460 poke 781,l+3:poke 782,c/2+15:poke 783,0:sys65520
  52. 2470 c$=chr$(d%(by)):if c$<" " or c$>"_" or c$=chr$(34) then c$="."
  53. 2480 print c$;
  54. 2490 rem fall thru into cursor right
  55. 2700 rem cursor right
  56. 2710 c=c+1:if c>7 then c=0:goto2750
  57. 2720 goto2220
  58. 2750 rem cursor down
  59. 2760 l=l+1:if l>15 then l=0
  60. 2770 goto2220
  61. 2800 rem cursor up
  62. 2810 l=l-1:if l<0 then l=15
  63. 2820 goto2220
  64. 2850 rem cursor left
  65. 2860 c=c-1:if c<0 then c=7:goto2800
  66. 2870 goto2220
  67. 3000 rem*write
  68. 3010 print"[147]preparing to write"
  69. 3020 print" track ";hx$(t/16);hx$(t and15);" sector ";hx$(s/16);hx$(s and15)
  70. 3030 print:print"<ret> to write":print"any other key to abort"
  71. 3040 get i$:if i$="" then 3040
  72. 3050 if i$<>chr$(13) then 2100
  73. 3100 rem do write
  74. 3110 print#15,"b-p:2,0"
  75. 3120 print"writing ..."
  76. 3130 d%(0)=d%(0):poke 828,peek(71):poke 829,peek(72):sys910
  77. 3140 print#15,"u2:2,0,";t;s:gosub9000:if er then 2100
  78. 3150 goto2100
  79. 4000 rem*quit
  80. 4010 close2:close15
  81. 4020 print"[147]done ..."
  82. 4030 poke 204,0:end
  83. 7000 rem*help
  84. 7010 print"[147]dskdu help":print
  85. 7020 print"f1 previous page"
  86. 7030 print"f3 next page"
  87. 7050 print"f7 read sector"
  88. 7060 print"f4 read next sector"
  89. 7065 print"   in file"
  90. 7070 print"f8 write sector"
  91. 7080 print"crsr controls"
  92. 7090 print"   up,down,left,right"
  93. 7100 print"home top left corner"
  94. 7120 print"0-9,a-f"
  95. 7130 print"   overwrite nibble"
  96. 7140 print"f2 quit"
  97. 7200 print:print"(any key to cont)"
  98. 7210 get i$:if i$="" then 7210
  99. 7220 goto2100
  100. 8000 poke53280,2:poke53281,0:poke646,1
  101. 8001 rem*init
  102. 8020 open15,da,15
  103. 8030 open2,da,2,"#"
  104. 8040 dim d%(255)
  105. 8050 dim hx$(15):for by=0to15:read hx$(by):next
  106. 8060 data 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f
  107. 8070 dim h1$(1)
  108. 8100 rem load ml routines
  109. 8110 read ad:if ad<0 then 8190
  110. 8120 read b:if b>=0 then poke ad,b:ad=ad+1:goto 8120
  111. 8130 goto 8110
  112. 8190 goto1000
  113. 8200 rem read/write routines
  114. 8210 data 840:rem setup
  115. 8220 data 173,60,3:rem lda 828
  116. 8230 data 174,61,3:rem ldx 829
  117. 8240 data 133,251:rem sta !251
  118. 8250 data 134,252:rem stx !252
  119. 8260 data 169,0:rem lda #0
  120. 8270 data 141,62,3:rem sta 830
  121. 8280 data 96,-1:rem rts
  122. 8300 data 860:rem advance pointer
  123. 8310 data 24:rem clc
  124. 8320 data 165,251:rem lda !251
  125. 8330 data 105,2:rem adc #2
  126. 8340 data 133,251:rem sta !251
  127. 8350 data 165,252:rem lda !252
  128. 8360 data 105,0:rem adc #0
  129. 8370 data 133,252:rem sta !252
  130. 8380 data 96,-1:rem rts
  131. 8400 data 880:rem read routine
  132. 8410 data 162,2:rem ldx #2
  133. 8420 data 32,198,255:rem jsr chkin
  134. 8430 data 32,72,3:rem jsr setup
  135. 8440 data 32,207,255:rem jsr chrin
  136. 8450 data 160,1:rem ldy #1
  137. 8460 data 145,251:rem sta (251,y
  138. 8470 data 32,92,3:rem jsr advptr
  139. 8480 data 206,62,3:rem dec 830
  140. 8490 data 208,241:rem bne -15
  141. 8500 data 32,204,255:rem jsr clrchn
  142. 8510 data 96,-1:rem rts
  143. 8600 data 910:rem write routine
  144. 8610 data 162,2:rem ldx #2
  145. 8620 data 32,201,255:rem jsr chkout
  146. 8630 data 32,72,3:rem jsr setup
  147. 8640 data 160,1:rem ldy #1
  148. 8650 data 177,251:rem lda (251,y
  149. 8660 data 32,210,255:rem jsr chrout
  150. 8670 data 32,92,3:rem jsr advptr
  151. 8680 data 206,62,3:rem dec 830
  152. 8690 data 208,241:rem bne -15
  153. 8700 data 32,204,255:rem jsr clrchn
  154. 8710 data 96,-1:rem rts
  155. 8720 data -1
  156. 9000 rem disk check
  157. 9020 input#15,er,er$,et,es
  158. 9030 if er=0 then return
  159. 9050 print "[147]";er;er$:print"";et;es
  160. 9060 print:print"f2 to quit":print"any other key to cont"
  161. 9070 get i$:if i$="" then 9070
  162. 9080 if i$="[137]" or i$="[133]" then 4000
  163. 9090 return
  164.